Image acquisition method and device, electronic equipment and storage medium

By detecting facial regions and matching attributes during the acquisition of TCM facial diagnosis images, the problem of poor image quality captured by front-facing cameras was solved, the quality requirements of TCM facial diagnosis images were met, and the diagnostic effect was improved.

CN116189263BActive Publication Date: 2026-04-21PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
PING AN TECH (SHENZHEN) CO LTD
Filing Date
2023-02-14
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing technologies, TCM facial diagnosis images captured by front-facing cameras are easily affected by various factors, resulting in poor image quality that fails to meet the data quality requirements of TCM facial diagnosis and affects diagnostic results.

Method used

By performing face region detection on the image to be recognized, the matching of multiple actual attributes (such as face position, pose, partition brightness, blur and color cast) with standard attributes is checked in turn. The image is used as a traditional Chinese medicine face diagnosis image only when all attributes match.

Benefits of technology

This ensures that the acquired images meet the quality standards for TCM facial diagnosis, thus improving the image acquisition effect for TCM facial diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116189263B_ABST
    Figure CN116189263B_ABST
Patent Text Reader

Abstract

This application provides an image acquisition method, apparatus, electronic device, and storage medium. The image acquisition method includes: acquiring an image to be recognized in response to an instruction to acquire an image for traditional Chinese medicine facial diagnosis; performing face region detection on the image to be recognized to obtain a face region image; sequentially detecting whether each actual attribute of the face region image matches a standard attribute; the actual attributes are image attributes obtained from the face region detection of the image to be recognized, and the standard attributes are image attributes that meet the image quality standards for traditional Chinese medicine facial diagnosis; if each actual attribute matches the standard attribute, then the image to be recognized is used as the acquired image for traditional Chinese medicine facial diagnosis. This application enables the acquired image to meet the quality requirements of traditional Chinese medicine facial diagnosis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart healthcare technology, specifically to an image acquisition method, device, electronic device, and storage medium. Background Technology

[0002] In the field of smart healthcare, traditional Chinese medicine (TCM) facial diagnosis requires the collection of facial images. Currently, images are primarily captured using a front-facing camera. However, images captured via a front-facing camera are susceptible to various factors, resulting in poor image quality that fails to meet the data quality requirements of TCM facial diagnosis, thus affecting the effectiveness of the diagnosis. Summary of the Invention

[0003] One objective of this application is to provide an image acquisition method, device, electronic device, and storage medium that enables the acquired images to meet the quality requirements of traditional Chinese medicine facial diagnosis.

[0004] According to one aspect of the embodiments of this application, an image acquisition method is provided, including:

[0005] In response to the instruction to acquire images for traditional Chinese medicine facial diagnosis, an image to be identified is acquired; the image to be identified is the image whose quality standards for traditional Chinese medicine facial diagnosis need to be determined.

[0006] The image to be identified is subjected to face region detection to obtain a face region image; the face region image is an image composed of image regions corresponding to the face regions;

[0007] For the face region image, each actual attribute is sequentially detected to determine whether it matches a standard attribute; the actual attribute is the image attribute obtained from the face region detection of the image to be identified, and the standard attribute is the image attribute that meets the image quality standard of traditional Chinese medicine facial diagnosis.

[0008] If each of the actual attributes matches the standard attribute, then the image to be identified is used as the image to be collected for traditional Chinese medicine facial diagnosis.

[0009] According to one aspect of the embodiments of this application, an image acquisition device is provided, comprising:

[0010] The acquisition module is used to acquire images to be identified in response to instructions for acquiring images for traditional Chinese medicine facial diagnosis; the images to be identified are those that need to be identified to determine whether they meet the quality standards for traditional Chinese medicine facial diagnosis.

[0011] A face region detection module is used to detect face regions in the image to be identified to obtain a face region image; the face region image is an image composed of image regions corresponding to the face regions;

[0012] The quality detection module is used to sequentially detect whether each actual attribute of the face region image matches a standard attribute; the actual attribute is the image attribute obtained by detecting the face region of the image to be recognized, and the standard attribute is the image attribute that meets the image quality standard of traditional Chinese medicine facial diagnosis.

[0013] The facial diagnosis image acquisition module is used to acquire the image to be identified as the image for traditional Chinese medicine facial diagnosis if each of the actual attributes matches the standard attributes.

[0014] In some embodiments of this application, based on the above technical solutions, the image acquisition device is configured as follows:

[0015] Detect whether the first actual attribute matches the standard attribute; the first actual attribute includes at least one of a face position attribute and a face pose attribute, wherein the face position attribute is the distance and offset of the face from the image acquisition device, and the face pose attribute is the orientation of the face relative to the image acquisition device;

[0016] If the first actual attribute matches the standard attribute, then it is detected whether the second actual attribute matches the standard attribute; the second actual attribute includes at least one of face partition brightness attribute, face image blur attribute, and face image color cast attribute, wherein the face partition brightness attribute is the brightness attribute of the face sub-region, the face image blur attribute is the degree of blur of the face region image, and the face image color cast attribute is the degree of color shift of the face region image, and the actual attribute includes the first actual attribute and the second actual attribute.

[0017] In some embodiments of this application, based on the above technical solutions, the image acquisition device is configured as follows:

[0018] The face region image is divided into regions to obtain multiple sub-regions located in different parts of the face;

[0019] The brightness of each of the sub-regions is obtained separately;

[0020] If the brightness of each sub-region is within the corresponding standard brightness range, then the difference between the brightness of every two sub-regions is obtained; the standard brightness range is the brightness range of the sub-region that meets the quality standards of traditional Chinese medicine facial diagnosis.

[0021] If all the differences are within the standard deviation range, then the brightness attribute of the face partition matches the standard attribute; the standard deviation range is the range of brightness differences between different parts of the face that meet the quality standards of traditional Chinese medicine face diagnosis.

[0022] In some embodiments of this application, based on the above technical solutions, the image acquisition device is configured as follows:

[0023] The size of the face region image is reduced to obtain a reduced image; the reduced image is the image of the face region image after reduction.

[0024] The face region image and the reduced image are normalized to obtain the processed data;

[0025] The processed data is fitted to a generalized Gaussian distribution, and a first feature is extracted from the generalized Gaussian distribution; the first feature is a feature extracted from the generalized Gaussian distribution.

[0026] For each preset direction, the preset direction is fitted with an asymmetric generalized Gaussian distribution to obtain a second feature; the second feature is a feature extracted from the asymmetric generalized Gaussian distribution.

[0027] The first feature and the second feature are combined to obtain the target feature; the target feature is the feature obtained by combining the first feature and the second feature.

[0028] The target features are classified for fuzziness to obtain the fuzziness classification result;

[0029] Based on the fuzziness classification result, it is determined whether the fuzziness attribute of the face image matches the standard attribute.

[0030] In some embodiments of this application, based on the above technical solutions, the image acquisition device is configured as follows:

[0031] The color mode of the face region image is converted to lab mode to obtain lab data;

[0032] The average value of the lab data in channel a is calculated to obtain a first average value; the first average value is the average value of the lab data in channel a.

[0033] The average value of the lab data in the b channel is calculated to obtain a second average value; the second average value is the average value of the lab data in the b channel.

[0034] Based on whether the first mean is greater than the first standard threshold and whether the second mean is greater than the second standard threshold, the color cast attribute of the face image is detected to match the standard attribute; the first standard threshold is the a-channel color threshold that meets the quality standard of traditional Chinese medicine face diagnosis, and the second standard threshold is the b-channel color threshold that meets the quality standard of traditional Chinese medicine face diagnosis.

[0035] In some embodiments of this application, based on the above technical solutions, the image acquisition device is configured as follows:

[0036] Obtain the detection bounding box of the face region image;

[0037] Obtain the first size of the detection box and the second size of the image to be recognized; the first size is the size of the detection box, and the second size is the size of the image to be recognized.

[0038] The target ratio is obtained by comparing the first dimension with the second dimension; the target ratio is the ratio between the first dimension and the second dimension.

[0039] If the target ratio is within the standard ratio range, then the first position of the detection box and the second position of the image to be identified are obtained; the standard ratio range is the size ratio range of the face region image and the overall image that meets the quality standards of traditional Chinese medicine facial diagnosis; the first position is the position of the detection box and the second position is the position of the image to be identified.

[0040] The face offset is obtained based on the offset between the first position and the second position; the face offset is the offset of the face relative to the image acquisition device.

[0041] If the face offset is within the standard offset range, then the two-dimensional key points of the face in the face region image are obtained; the two-dimensional key points of the face are key points with two-dimensional positional information extracted from the face image region, and the standard offset range is the offset range of the face relative to the image acquisition device that meets the quality standards of traditional Chinese medicine face diagnosis.

[0042] The perspective transformation relationship between the two-dimensional key points corresponding to the preset three-dimensional key points and the preset three-dimensional key points is extracted to obtain a rotation matrix; the preset three-dimensional key points are key points with three-dimensional positional information extracted from the preset three-dimensional face model.

[0043] The rotation matrix is ​​transformed to obtain the pitch angle, yaw angle, and roll angle;

[0044] Based on the pitch angle, yaw angle, roll angle, and standard angle threshold, it is determined whether the facial posture attributes match the standard attributes; the standard angle threshold is a posture angle threshold that meets the quality standards of traditional Chinese medicine facial diagnosis.

[0045] In some embodiments of this application, based on the above technical solutions, the image acquisition device is configured as follows:

[0046] If any of the actual attributes is found to be mismatched with the standard attribute during the sequential testing process, the testing is stopped.

[0047] Output a prompt message indicating adjustments to the data acquisition environment;

[0048] The image to be identified is re-acquired;

[0049] The newly acquired images to be identified are re-detected.

[0050] According to one aspect of the embodiments of this application, an electronic device is provided, including: one or more processors; and a storage device for storing one or more programs, which, when executed by the one or more processors, cause the electronic device to implement the methods provided in the various optional implementations described above.

[0051] According to one aspect of the embodiments of this application, a computer program medium is provided, on which computer-readable instructions are stored, which, when executed by a computer's processor, cause the computer to perform the methods provided in the various optional implementations described above.

[0052] According to one aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations described above.

[0053] In the technical solution provided in this application embodiment, during the acquisition of TCM facial diagnosis images, multiple actual attributes of the face region of the image to be identified are detected sequentially. When each actual attribute matches the standard data, it indicates that the face region image meets the image quality standard of TCM facial diagnosis. Then, the image to be identified is used as the acquisition image for TCM facial diagnosis, so that the acquired image meets the quality requirements of TCM facial diagnosis.

[0054] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.

[0055] It should be understood that the above general description and the following detailed description are merely exemplary and do not limit this application. Attached Figure Description

[0056] The above and other objectives, features and advantages of this application will become more apparent from a detailed description of exemplary embodiments thereof with reference to the accompanying drawings.

[0057] Figure 1 A schematic flowchart of an image acquisition method according to Embodiment 1 of this application is shown.

[0058] Figure 2 A flowchart illustrating the image acquisition method according to Embodiment 2 of this application is shown.

[0059] Figure 3 A schematic diagram of the process of image acquisition in a specific scenario according to Embodiment 2 of this application is shown.

[0060] Figure 4 A flowchart illustrating the image acquisition method according to Embodiment 3 of this application is shown.

[0061] Figure 5 A schematic diagram of the structure of an image acquisition device according to Embodiment 4 of this application is shown.

[0062] Figure 6 A schematic diagram of the structure of an electronic device according to Embodiment 5 of this application is shown. Detailed Implementation

[0063] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided to make the description of this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. The drawings are merely illustrative of this application and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted.

[0064] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more exemplary embodiments. Numerous specific details are provided in the following description to give a full understanding of exemplary embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced with one or more specific details omitted, or other methods, components, steps, etc., can be employed. In other instances, well-known structures, methods, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.

[0065] Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0066] Figure 1 A schematic flowchart of an image acquisition method according to Embodiment 1 of this application is shown. The image acquisition method includes:

[0067] Step S101: In response to the instruction to acquire images for traditional Chinese medicine facial diagnosis, acquire the image to be recognized.

[0068] The image to be identified is the image that needs to be determined to meet the quality standards of traditional Chinese medicine facial diagnosis.

[0069] In this embodiment, the method can be applied to various electronic devices with image acquisition units, such as smartphones, tablets, and laptops.

[0070] The command to acquire images for traditional Chinese medicine facial diagnosis can be a touch-screen interactive control, a voice command, or an input device such as a keyboard or mouse; the form of the command is not limited here. The purpose of this command is to instruct the acquisition of images for traditional Chinese medicine facial diagnosis.

[0071] As an optional implementation method, the quality standards for TCM facial diagnosis include multiple standards such as face position standard, face posture standard, face zone brightness standard, face blur standard, and face color deviation standard.

[0072] Face position standards specify the location of a face within an image, such as the center. Face pose standards specify the direction the face should face; for example, the face should face directly forward, i.e., towards the camera.

[0073] The facial zoning brightness standard indicates that the brightness of different areas of a person's face is within a certain range, and the brightness difference between different areas is also within a certain range. For example, the brightness of the nose, cheeks, and mouth is within a certain range, and the brightness difference between the cheeks and nose is within a certain range, as is the brightness difference between the mouth and nose.

[0074] The face blur standard indicates the degree of blur in the image resolution of the face region within a certain range. The color cast standard indicates the degree of color shift in the face within a certain range.

[0075] In one specific scenario, a user holds a smartphone to capture images for traditional Chinese medicine facial diagnosis. After the user clicks the "Start Capture" button on the screen, the smartphone begins recording video and extracts image frames from the recorded video. These extracted image frames are then used as images to be identified for subsequent detection.

[0076] Step S102: Perform face region detection on the image to be recognized to obtain a face region image.

[0077] A face region image is an image composed of image regions corresponding to the face region;

[0078] Face region detection primarily involves identifying the facial regions of interest within the overall image to facilitate subsequent quality control. This is achieved by detecting face regions and obtaining corresponding bounding boxes, which are then used to define the face region image.

[0079] Step S103: For multiple actual attributes of the face region image, sequentially detect whether each actual attribute matches the standard attribute.

[0080] Actual attributes are the image attributes obtained from the detection of the face region in the image to be recognized, while standard attributes are the image attributes that meet the image quality standards for traditional Chinese medicine facial diagnosis.

[0081] The actual attributes include at least two of the following: face location attribute, face pose attribute, face partition brightness attribute, face image blur attribute, and face image color cast attribute.

[0082] As an optional implementation method, multiple actual attributes are detected sequentially, and the next actual attribute is detected only if the previous actual attribute matches the standard attribute, until all actual attributes match the standard attributes. Then, the image to be identified is used as the image to be collected for traditional Chinese medicine facial diagnosis.

[0083] As an optional implementation, several practical attributes include face position attributes. Detecting whether the face position attribute matches a standard attribute includes: acquiring a detection box of a face region image; acquiring a first size of the detection box and a second size of the image to be recognized; the first size is the size of the detection box, and the second size is the size of the image to be recognized; calculating the ratio between the first size and the second size to obtain a target ratio; the target ratio is the ratio between the first size and the second size; if the target ratio is within a standard ratio range, then based on the first position of the detection box and the second position of the image to be recognized; the standard ratio range is the size ratio range between the face region image and the overall image that meets the quality standards for traditional Chinese medicine facial diagnosis, the first position is the position of the detection box, and the second position is the position of the image to be recognized; based on the offset between the first position and the second position, obtaining a face offset; the face offset is the offset of the face relative to the image acquisition device; if the face offset is within a standard offset range, the face position attribute matches the standard attribute; if the face offset is not within a standard offset range, the face position attribute does not match the standard attribute.

[0084] The purpose of requiring face location attributes to match standard attributes is to ensure that the face in the image is not too far or too close to the image acquisition device, and that it is not biased to the surroundings.

[0085] As an optional implementation, several practical attributes include facial pose attributes. Detecting whether facial pose attributes match standard attributes includes: acquiring two-dimensional key points of the face in the facial region image; these two-dimensional key points are key points with two-dimensional positional information extracted from the facial image region, and the standard offset interval is the offset interval of the face relative to the image acquisition device that meets the quality standards of traditional Chinese medicine facial diagnosis; extracting the perspective change relationship between the two-dimensional key points corresponding to preset three-dimensional key points and the preset three-dimensional key points to obtain a rotation matrix; the preset three-dimensional key points are key points with three-dimensional positional information extracted from a preset three-dimensional facial model; transforming the rotation matrix to obtain pitch angle, yaw angle, and roll angle; and detecting whether facial pose attributes match standard attributes based on the pitch angle, yaw angle, roll angle, and standard angle threshold; the standard angle threshold is a pose angle threshold that meets the quality standards of traditional Chinese medicine facial diagnosis.

[0086] The requirement for facial pose attributes and standard attributes aims to control the facial posture in the acquired image to be in a normal and good posture, such as a posture facing the image acquisition unit.

[0087] As an optional implementation, several practical attributes include a face partition brightness attribute. Detecting whether the face partition brightness attribute matches a standard attribute includes: dividing the face region image into multiple sub-regions located at different parts of the face; acquiring the brightness of each sub-region; if the brightness of each sub-region falls within its corresponding standard brightness range, acquiring the difference between the brightness of any two sub-regions; the standard brightness range is the brightness range of sub-regions that meets the quality standards for traditional Chinese medicine facial diagnosis; if all differences fall within the standard deviation range, the face partition brightness attribute matches the standard attribute; the standard deviation range is the range of brightness differences between different parts of the face that meet the quality standards for traditional Chinese medicine facial diagnosis.

[0088] The requirement is to match the brightness attributes of the face regions with the standard attributes, in order to control the brightness of the face regions so that it is not too high or too low, while ensuring that the brightness of each region is relatively uniform.

[0089] As an optional implementation, several practical attributes include a facial image blur attribute. Detecting whether the facial image blur attribute matches a standard attribute includes: reducing the size of the facial region image to obtain a reduced image; the reduced image is the image of the facial region image after reduction; normalizing the facial region image and the reduced image to obtain processed data; fitting the processed data to a generalized Gaussian distribution and extracting a first feature from the generalized Gaussian distribution; the first feature is the feature extracted from the generalized Gaussian distribution; for each preset direction, fitting the preset direction to an asymmetric generalized Gaussian distribution to obtain a second feature; the second feature is the feature extracted from the asymmetric generalized Gaussian distribution; combining the first feature and the second feature to obtain a target feature; the target feature is the feature resulting from the combination of the first feature and the second feature; classifying the target feature for blur to obtain a blur classification result; and based on the blur classification result, detecting whether the facial image blur attribute matches a standard attribute.

[0090] The preset direction is the direction relative to a certain pixel. For example, the preset direction includes four directions: reference pixel and bottom, right, main diagonal, and secondary diagonal. The reference pixel is the pixel selected as the reference object in the chosen direction.

[0091] The requirement is to match the blurriness attribute of the facial image with the standard attribute in order to avoid the problem of poor results in traditional Chinese medicine facial diagnosis caused by image distortion.

[0092] As an optional implementation, several practical attributes include a facial image color cast attribute. Detecting whether the facial image color cast attribute matches a standard attribute includes: converting the color mode of the facial region image to a lab mode to obtain lab data; averaging the values ​​of the lab data in channel a to obtain a first mean; the first mean is the mean of the lab data in channel a; averaging the values ​​of the lab data in channel b to obtain a second mean; the second mean is the mean of the lab data in channel b; and detecting whether the facial image color cast attribute matches a standard attribute based on whether the first mean is greater than a first standard threshold and whether the second mean is greater than a second standard threshold; the first standard threshold is the a-channel color threshold that meets the quality standards for traditional Chinese medicine facial diagnosis, and the second standard threshold is the b-channel color threshold that meets the quality standards for traditional Chinese medicine facial diagnosis.

[0093] The requirement is to match the color cast attribute of the facial image with the standard attribute, so that the color distribution of the acquired image is within a reasonable range, thus avoiding affecting the subsequent diagnosis of facial color and shape in traditional Chinese medicine.

[0094] Step S104: If each actual attribute matches the standard attribute, then the image to be identified is used as the image to be collected for traditional Chinese medicine facial diagnosis.

[0095] All actual attributes match the standard attributes, indicating that the image to be identified meets the quality standards of traditional Chinese medicine, thus the image to be identified can be used as the image collected for traditional Chinese medicine facial diagnosis.

[0096] After the image to be identified is used as the image for TCM face diagnosis, TCM face diagnosis features can be extracted from the image using electronic devices. Based on the extracted features, it can be analyzed whether there are corresponding disease patterns, thereby improving the quality of TCM face diagnosis based on meeting the quality requirements of TCM face diagnosis.

[0097] In this embodiment, during the acquisition of images for traditional Chinese medicine facial diagnosis, multiple actual attributes of the face region in the image to be identified are detected sequentially. When each actual attribute matches the standard data, it indicates that the face region image meets the image quality standards for traditional Chinese medicine facial diagnosis. In this case, the image to be identified is used as the acquisition image for traditional Chinese medicine facial diagnosis, so that the acquired image meets the quality requirements for traditional Chinese medicine facial diagnosis.

[0098] In one embodiment, if any actual attribute does not match the standard attribute, the image to be identified is re-acquired.

[0099] Figure 2 A schematic flowchart of an image acquisition method according to Embodiment 2 of this application is shown. The image acquisition method includes:

[0100] Step S201: In response to the instruction to acquire images for traditional Chinese medicine facial diagnosis, acquire the image to be recognized.

[0101] The image to be identified is the image that needs to be determined to meet the quality standards of traditional Chinese medicine facial diagnosis.

[0102] In this embodiment, to make the process of detecting actual attributes and standard attributes more efficient and suitable for practical detection, the first actual attribute is detected first, followed by the second actual attribute. The second actual attribute is only detected if the first actual attribute matches the standard attribute. If the first actual attribute does not match the standard attribute, the image to be identified is directly considered to have quality that does not meet the image standards for traditional Chinese medicine facial diagnosis.

[0103] The first actual attribute includes at least one of the face location attribute and the face pose attribute. The second actual attribute includes at least one of the face partition brightness attribute, the face image blur attribute, and the face image color cast attribute. The probability of the second attribute matching the standard attribute is high only if the first actual attribute matches the standard attribute; otherwise, the probability of matching is low. Therefore, detecting the first actual attribute first, followed by the second actual attribute, is more consistent with the detection process in practical applications, resulting in higher efficiency and better performance.

[0104] As an optional implementation, the first actual attributes include face location attributes and face pose attributes. Detecting whether the first actual attributes match the standard attributes includes: first, detecting whether the face location attributes match the standard attributes; if they do not match, the image to be recognized does not meet the quality standards for traditional Chinese medicine facial diagnosis; if they match, then detecting whether the face pose attributes match the standard attributes. If the face location attributes meet the quality standards for traditional Chinese medicine facial diagnosis, the face pose attributes are more likely to meet the standards. If the face location attributes do not match, the probability of the face pose attributes not matching is relatively high. Considering detection efficiency, detecting the face location attributes first is more suitable for code deployment in practical applications.

[0105] As an optional implementation, the second practical attributes include face partition brightness attribute, face image blur attribute, and face image color cast attribute. The detection of these attributes can be performed in any order, but all three must meet the quality requirements of traditional Chinese medicine facial diagnosis.

[0106] Step S202: Perform face region detection on the image to be recognized to obtain a face region image.

[0107] A face region image is an image composed of image regions corresponding to the face region.

[0108] Step S203: Detect whether the first actual attribute matches the standard attribute.

[0109] The first actual attribute includes at least one of the face position attribute and the face pose attribute. The face position attribute is the distance and offset of the face from the image acquisition device, and the face pose attribute is the orientation of the face relative to the image acquisition device.

[0110] In one embodiment, detecting whether a first actual attribute matches a standard attribute includes: acquiring a detection box of a face region image; acquiring a first size of the detection box and a second size of the image to be recognized; the first size is the size of the detection box, and the second size is the size of the image to be recognized; calculating the ratio between the first size and the second size to obtain a target ratio; the target ratio is the ratio between the first size and the second size; if the target ratio is within a standard ratio range, then based on the first position of the detection box and the second position of the image to be recognized; the standard ratio range is the size ratio range between the face region image and the overall image that meets the quality standards of traditional Chinese medicine facial diagnosis, the first position is the position of the detection box, and the second position is the position of the image to be recognized; obtaining a face offset based on the offset between the first position and the second position; the face offset is the face relative to the image acquisition... The device offset; if the face offset is within the standard offset range, then the two-dimensional key points of the face in the face region image are obtained; the two-dimensional key points of the face are key points with two-dimensional positional information extracted from the face image region, and the standard offset range is the offset range of the face relative to the image acquisition device that meets the quality standards of traditional Chinese medicine face diagnosis; the perspective change relationship between the two-dimensional key points corresponding to the preset three-dimensional key points and the preset three-dimensional key points is extracted to obtain the rotation matrix; the preset three-dimensional key points are key points with three-dimensional positional information extracted from the preset three-dimensional face model; the rotation matrix is ​​transformed to obtain the pitch angle, yaw angle and roll angle; based on the pitch angle, yaw angle and roll angle and the standard angle threshold, the face pose attributes are detected to match the standard attributes; the standard angle threshold is the pose angle threshold that meets the quality standards of traditional Chinese medicine face diagnosis.

[0111] If the first actual attribute matches the standard attribute, then proceed to step S204.

[0112] Step S204: Detect whether the second actual attribute matches the standard attribute.

[0113] The second actual attribute includes at least one of the following: face partition brightness attribute, face image blur attribute, and face image color shift attribute. The face partition brightness attribute is the brightness attribute of the face sub-region, the face image blur attribute is the degree of blur of the face region image, and the face image color shift attribute is the degree of color shift of the face region image. The actual attributes include the first actual attribute and the second actual attribute.

[0114] In one embodiment, detecting whether the second actual attribute matches the standard attribute includes: dividing the face region image into multiple sub-regions located at different parts of the face; obtaining the brightness of each sub-region; if the brightness of each sub-region is within the corresponding standard brightness range, then obtaining the difference between the brightness of every two sub-regions; the standard brightness range is the brightness range of the sub-regions that meets the quality standards of traditional Chinese medicine face diagnosis; if each difference is within the standard deviation range, then the face partition brightness attribute matches the standard attribute; the standard deviation range is the range of brightness differences between different parts of the face that meet the quality standards of traditional Chinese medicine face diagnosis.

[0115] In one embodiment, detecting whether the second actual attribute matches the standard attribute includes: reducing the size of the face region image to obtain a reduced image; the reduced image is the face region image after reduction; normalizing the face region image and the reduced image to obtain processed data; fitting the processed data to a generalized Gaussian distribution and extracting a first feature from the generalized Gaussian distribution; the first feature is the feature extracted from the generalized Gaussian distribution; for each preset direction, fitting the preset direction to an asymmetric generalized Gaussian distribution to obtain a second feature; the second feature is the feature extracted from the asymmetric generalized Gaussian distribution; combining the first feature and the second feature to obtain a target feature; the target feature is the feature obtained by combining the first feature and the second feature; performing fuzziness classification on the target feature to obtain a fuzziness classification result; and detecting whether the fuzziness attribute of the face image matches the standard attribute based on the fuzziness classification result.

[0116] In one embodiment, detecting whether the second actual attribute matches the standard attribute includes: converting the color mode of the face region image to a lab mode to obtain lab data; averaging the values ​​of the lab data in the a channel to obtain a first mean; the first mean is the mean of the lab data in the a channel; averaging the values ​​of the lab data in the b channel to obtain a second mean; the second mean is the mean of the lab data in the b channel; and detecting whether the color cast attribute of the face image matches the standard attribute based on whether the first mean is greater than a first standard threshold and whether the second mean is greater than a second standard threshold; the first standard threshold is the a channel color threshold that meets the quality standard of traditional Chinese medicine face diagnosis, and the second standard threshold is the b channel color threshold that meets the quality standard of traditional Chinese medicine face diagnosis.

[0117] Step S205: If each actual attribute matches the standard attribute, then the image to be identified is used as the image to be collected for traditional Chinese medicine facial diagnosis.

[0118] Reference Figure 3As shown, in a specific scenario, a series of quality control strategies are added during the facial image data acquisition process to ensure that the final acquired facial images meet the requirements for subsequent traditional Chinese medicine diagnosis. These quality control strategies include face detection, facial landmark detection, face position control, face pose detection, facial partition brightness control, face blur control, and image color cast control.

[0119] In addition, the above-mentioned multiple detection processes have Figure 3 The sequence shown is used for quality control. Only if the first test in the sequence passes has a high probability of passing the subsequent tests. If the first test fails, the probability of the subsequent tests failing is extremely high. Therefore, to achieve the most efficient, effective, and practical testing in real-world applications, the following sequence can be followed: Figure 3 The tests are performed sequentially as shown. Figure 3 The specific means shown are merely one optional implementation method provided in this embodiment. Other specific technical means can also be selected in actual applications. This embodiment does not limit the specific technical means used.

[0120] like Figure 3 As shown, acquiring images of acceptable quality includes the following process:

[0121] Face detection. A lightweight face detection model based on BlazeFace can be implemented using TensorFlow.js to detect regions of interest (ROIs) on faces in video frames captured by a mobile camera. The detected ROI bounding boxes are used for subsequent facial landmark detection and face location determination modules.

[0122] Facial landmark detection. Facial landmark detection refers to detecting 468 key points in the facial region of a person in a video frame image captured by a camera. Based on the MediaPipe facial landmark detection model, a TensorFlow.js version is implemented to detect 468 key points in the facial region of interest detected by the face detection model on a mobile device. The obtained 468 key points are used for subsequent face pose detection control and facial segmentation brightness calculation control.

[0123] Face position control. The purpose of face position control is to ensure that the region of interest (ROI) of the face is within a suitable range in the image during shooting, neither too far away nor too close, nor too far to the sides. This is achieved by using face detection bounding boxes obtained from face detection and the image size. The ratio of the width of the face detection bounding box to the width of the image is used to determine whether the face region in the image is too far away or too close. A certain threshold is set; if the calculated ratio is greater than the threshold, the face region is considered too close to the camera; if the calculated ratio is less than the threshold, the face region is considered too far from the camera. Whether the face region is skewed to the sides refers to whether the face region is within a suitable range from the center of the image.

[0124] The specific implementation process of face position control can be as follows: first, determine the center point coordinates of the detected face region based on the face detection box; then, determine the center point coordinates of the image based on the image size; and finally, determine whether the face region is too high, too low, too far, or too close based on the face center point coordinates and the image center point coordinates.

[0125] Face pose control. Face pose control involves estimating the face's orientation in the image to ensure the final image shows a normal and favorable pose, preventing poor pose from affecting the recognition of facial features in traditional Chinese medicine diagnosis. This part uses Euler angles (pitch, yaw, and roll) to represent face pose information.

[0126] The main steps of face pose control are as follows: Define a 3D face model with four key points, namely the left corner of the eye, the right corner of the eye, the tip of the nose, and the left corner of the mouth; obtain the corresponding 2D face key points based on the facial key point detection; obtain the rotation matrix using the corresponding key point information, that is, treat it as a perspective transformation problem of N points to obtain the transformation relationship between the coordinates of the four points in the 3D world coordinate system and the point set in the 2D image coordinate system; convert the obtained rotation vector into three Euler angles, and achieve face pose control by setting a certain threshold for the three Euler angles.

[0127] Facial segment brightness control. Facial segment brightness control first divides the facial area into sub-regions, calculates the brightness of each sub-region, then sets upper and lower brightness thresholds to determine if the brightness of each sub-region is within an appropriate range, and then uses a brightness difference threshold to determine if the brightness difference between the sub-regions is within an appropriate range, finally obtaining an image with uniform brightness distribution within an appropriate range.

[0128] The human face can be divided into four regions: the left and right cheek regions, the nose region, the mouth region, etc. When judging the brightness difference between sub-regions, the brightness uniformity in the vertical direction of the image is controlled by comparing the brightness difference between the nose region and the mouth region, and the brightness uniformity in the horizontal direction of the image is controlled by comparing the brightness difference between the left and right cheek regions and the nose region.

[0129] Facial Image Blur Control. Facial image blur falls under the category of image distortion. Natural images captured in natural scenes possess certain statistical characteristics, which are altered by image distortion. Therefore, utilizing some statistical features as image features allows for reference-free image evaluation. Thus, extracting image statistical features as a criterion for judging image blur is feasible. This paper employs a machine learning method combining image feature extraction with an SVM classifier to determine facial image blur.

[0130] First, the RGB image is normalized using MSCN. Then, the processed data is fitted with a generalized Gaussian distribution to extract two features. Next, the correlation information between connected pixels is added, and the MSCN is calculated in four directions: the current pixel and the bottom, right, main diagonal, and secondary diagonal. Each direction is then fitted with an asymmetric generalized Gaussian distribution to obtain four features, resulting in 16 features. These two sets of features are combined to obtain 18 features. The above operations are performed on the original image data and an image at 0.5 times the original size, ultimately extracting 36 features. These 36 features are then input into an SVM for classification to determine whether the current image is blurry or sharp.

[0131] Color cast control in facial images. The purpose of color cast control in facial images is to ensure that the color distribution of the acquired image is within a reasonable range to avoid affecting subsequent diagnosis of facial features in Traditional Chinese Medicine. The process of color cast control in facial images includes: converting RGB image data into Lab data; calculating the mean values ​​of the a-channel and b-channel respectively; setting relevant thresholds and comparing the mean values ​​of the a-channel and b-channel respectively to determine whether the image has a color cast. It is worth noting that, in order to avoid the influence of some abnormal colors in the background, such as brightly colored clothing, the image processed here is a facial region image obtained by cropping the original image data based on the face detection bounding box.

[0132] Face position control ensures that the facial area is within a suitable range in the image; face pose control ensures that the face is facing the camera directly and does not exhibit abnormal postures; face partition brightness control ensures that the brightness of the captured facial area is within a suitable range and is evenly distributed; face image blur control ensures that the face is clear in the acquired image, and the combination of feature extraction methods and SVM classification makes the judgment of blur more robust; face image color cast control ensures that the color of the facial area in the acquired image is within a reasonable range, avoiding the influence of environmental factors on the recognition of facial color, lip color, and other features in subsequent face diagnosis.

[0133] Through the above series of operations, the quality of the final acquired facial images can be guaranteed to meet the requirements of subsequent TCM morphology recognition.

[0134] Figure 4 A schematic flowchart of an image acquisition method according to Embodiment 3 of this application is shown. The image acquisition method includes:

[0135] Step S301: In response to the instruction to acquire images for traditional Chinese medicine facial diagnosis, acquire the image to be recognized.

[0136] The image to be identified is the image that needs to be determined to meet the quality standards of traditional Chinese medicine facial diagnosis.

[0137] Step S302: Perform face region detection on the image to be recognized to obtain a face region image.

[0138] A face region image is an image composed of image regions corresponding to the face region.

[0139] Step S303: For multiple actual attributes of the face region image, sequentially detect whether each actual attribute matches the standard attribute.

[0140] Actual attributes are the image attributes obtained from the detection of the face region in the image to be recognized, while standard attributes are the image attributes that meet the image quality standards for traditional Chinese medicine facial diagnosis.

[0141] Step S304: If each actual attribute matches the standard attribute, then the image to be identified is used as the image to be collected for traditional Chinese medicine facial diagnosis.

[0142] Step S305: During the sequential detection process, if any actual attribute is found to be mismatched with the standard attribute, the detection is stopped.

[0143] In this embodiment, by sequentially detecting whether the actual attributes match the standard attributes, the image to be identified no longer meets the quality requirements of traditional Chinese medicine facial diagnosis when the actual attributes do not match the standard attributes. By stopping the detection in time, the problem of wasting resources caused by subsequent detection can be avoided.

[0144] Step S306: Output a prompt message indicating that the acquisition environment needs to be adjusted.

[0145] The prompt message is used to instruct the user to adjust the environment in which the image is being captured. The prompt message may include interface resource information or sound resource information.

[0146] As an optional implementation, the mismatched actual attributes are first obtained, followed by the associated prompts for those attributes. Different actual attributes are associated with different prompts. This allows users to adjust the data collection environment based on the prompts for specific actual attributes.

[0147] For example, if a mismatch is detected between the face position attribute and the standard attribute, the system will prompt the user to change position, move closer to or further away from the image acquisition device, or move their head in a certain direction to adjust their position relative to their surroundings. If a mismatch is detected between the face pose attribute and the standard attribute, the system will prompt the user to look up or down, etc. If a mismatch is detected between the face zone brightness attribute and the standard attribute, the system will prompt the user to improve the brightness of the surrounding environment.

[0148] Step S307: Reacquire the image to be identified.

[0149] After outputting the prompt message, re-acquire the image to be recognized.

[0150] In a specific scenario, after image acquisition begins, the electronic device continuously records video and checks in real time whether the images in the video meet the quality requirements of traditional Chinese medicine facial diagnosis. If they do not meet the requirements, the detection continues until the total detection time expires. If they meet the requirements, the images that meet the requirements are used as the images for traditional Chinese medicine facial diagnosis.

[0151] Step S308: Re-detect the re-acquired image to be identified.

[0152] The process of re-detecting the re-acquired image is largely the same as steps S302 to S306. It will not be described in detail here.

[0153] To avoid excessively long waiting times for users due to continuous re-detection, the detection process will terminate and the user will be notified of failure if the number of re-detections exceeds a certain limit or the detection time expires. In the event of detection failure, the user can try to re-capture images for traditional Chinese medicine facial diagnosis in a different environment or with a different image acquisition device.

[0154] In this embodiment, when any actual attribute does not match the standard attribute, a prompt message is output, instructing the user to adjust the acquisition environment and re-acquire the image to be identified for re-detection. This allows the user to adjust the environment in a timely manner when the image to be identified does not meet the quality requirements of traditional Chinese medicine facial diagnosis, thereby obtaining images that meet the quality requirements of traditional Chinese medicine facial diagnosis with high efficiency.

[0155] Figure 5 A schematic diagram of an image acquisition device according to Embodiment 4 of this application is shown. The image acquisition device includes:

[0156] The acquisition module 401 is used to acquire an image to be identified in response to an instruction to acquire images for traditional Chinese medicine facial diagnosis; the image to be identified is the image that needs to be identified to determine whether it meets the quality standards for traditional Chinese medicine facial diagnosis.

[0157] The face region detection module 402 is used to detect face regions in the image to be recognized and obtain a face region image; the face region image is an image composed of image regions corresponding to the face regions;

[0158] The quality detection module 403 is used to sequentially detect whether each actual attribute of the face region image matches the standard attribute. The actual attributes are the image attributes obtained by detecting the face region of the image to be recognized, and the standard attributes are the image attributes that meet the image quality standards of traditional Chinese medicine face diagnosis.

[0159] The face diagnosis image acquisition module 404 is used to acquire the image to be identified as the image for traditional Chinese medicine face diagnosis if each actual attribute matches the standard attribute.

[0160] In one exemplary embodiment of this application, the image acquisition device is configured as follows:

[0161] Detect whether the first actual attribute matches the standard attribute; the first actual attribute includes at least one of the face position attribute and the face pose attribute. The face position attribute is the distance and offset of the face from the image acquisition device, and the face pose attribute is the orientation of the face relative to the image acquisition device.

[0162] If the first actual attribute matches the standard attribute, then the second actual attribute matches the standard attribute. The second actual attribute includes at least one of the following: face partition brightness attribute, face image blur attribute, and face image color shift attribute. The face partition brightness attribute is the brightness attribute of the face sub-region, the face image blur attribute is the degree of blur of the face region image, and the face image color shift attribute is the degree of color shift of the face region image. The actual attributes include the first actual attribute and the second actual attribute.

[0163] In one exemplary embodiment of this application, the image acquisition device is configured as follows:

[0164] The face region image is divided into regions, resulting in multiple sub-regions located in different parts of the face;

[0165] Obtain the brightness of each sub-region separately;

[0166] If the brightness of each sub-region is within the corresponding standard brightness range, then the difference in brightness between any two sub-regions is obtained; the standard brightness range is the brightness range of the sub-region that meets the quality standards of traditional Chinese medicine facial diagnosis.

[0167] If all differences are within the standard deviation range, then the brightness attribute of the face region matches the standard attribute; the standard deviation range is the range of brightness differences between different parts of the face that meet the quality standards of traditional Chinese medicine face diagnosis.

[0168] In one exemplary embodiment of this application, the image acquisition device is configured as follows:

[0169] The size of the face region image is reduced to obtain a reduced image; the reduced image is the image of the face region image after reduction.

[0170] The face region image and the reduced image are normalized to obtain the processed data;

[0171] The processed data is fitted to a generalized Gaussian distribution, and the first feature is extracted from the generalized Gaussian distribution; the first feature is the feature extracted from the generalized Gaussian distribution.

[0172] For each preset direction, the preset direction is fitted with an asymmetric generalized Gaussian distribution to obtain the second feature; the second feature is the feature extracted from the asymmetric generalized Gaussian distribution.

[0173] The first feature and the second feature are combined to obtain the target feature; the target feature is the feature obtained by combining the first feature and the second feature.

[0174] The target features are classified by fuzziness to obtain the fuzziness classification results;

[0175] Based on the fuzziness classification results, it is determined whether the fuzziness attribute of the face image matches the standard attribute.

[0176] In one exemplary embodiment of this application, the image acquisition device is configured as follows:

[0177] Convert the color mode of the face region image to lab mode to obtain lab data;

[0178] The first mean is obtained by averaging the values ​​of the lab data in channel a; the first mean is the average value of the lab data in channel a.

[0179] The average value of the lab data in the b channel is calculated to obtain the second average value; the second average value is the average value of the lab data in the b channel.

[0180] Based on whether the first mean is greater than the first standard threshold and whether the second mean is greater than the second standard threshold, the color cast attribute of the face image is detected to match the standard attribute; the first standard threshold is the a-channel color threshold that meets the quality standard of traditional Chinese medicine face diagnosis, and the second standard threshold is the b-channel color threshold that meets the quality standard of traditional Chinese medicine face diagnosis.

[0181] In one exemplary embodiment of this application, the image acquisition device is configured as follows:

[0182] Obtain the detection bounding box of the face region image;

[0183] Obtain the first size of the detection bounding box and the second size of the image to be recognized; the first size is the size of the detection bounding box, and the second size is the size of the image to be recognized.

[0184] The target ratio is obtained by comparing the first dimension with the second dimension; the target ratio is the ratio between the first dimension and the second dimension.

[0185] If the target ratio is within the standard ratio range, then the first position of the detection box and the second position of the image to be identified are obtained. The standard ratio range is the size ratio range of the face region image and the overall image that meets the quality standards of traditional Chinese medicine facial diagnosis. The first position is the position of the detection box, and the second position is the position of the image to be identified.

[0186] The face offset is obtained based on the offset between the first position and the second position; the face offset is the offset of the face relative to the image acquisition device.

[0187] If the face offset is within the standard offset range, then the two-dimensional key points of the face in the face region image are obtained; the two-dimensional key points of the face are key points with two-dimensional positional information extracted from the face image region, and the standard offset range is the offset range of the face relative to the image acquisition device that meets the quality standards of traditional Chinese medicine face diagnosis.

[0188] The perspective transformation relationship between the two-dimensional key points corresponding to the preset three-dimensional key points and the preset three-dimensional key points is extracted to obtain the rotation matrix; the preset three-dimensional key points are key points with three-dimensional positional information extracted from the preset three-dimensional face model.

[0189] Transform the rotation matrix to obtain the pitch angle, yaw angle, and roll angle;

[0190] Based on pitch angle, yaw angle, roll angle and standard angle threshold, it is used to detect whether the facial pose attributes match the standard attributes; the standard angle threshold is the pose angle threshold that meets the quality standards of traditional Chinese medicine facial diagnosis.

[0191] In one exemplary embodiment of this application, the image acquisition device is configured as follows:

[0192] If any actual attribute is found to be mismatched with the standard attribute during the sequential testing process, the testing will stop.

[0193] Output a prompt message indicating adjustments to the data acquisition environment;

[0194] Reacquire the image to be identified;

[0195] The newly acquired images to be identified are re-detected.

[0196] The following is for reference. Figure 6 This is a schematic diagram illustrating the structure of the electronic device 50 according to Embodiment 5 of this application. Figure 6 The electronic device 50 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0197] like Figure 6 As shown, the electronic device 50 is manifested in the form of a general-purpose computing device. The components of the electronic device 50 may include, but are not limited to: at least one processing unit 510, at least one storage unit 520, and a bus 530 connecting different system components (including storage unit 520 and processing unit 510).

[0198] The storage unit stores program code, which can be executed by the processing unit 510 to perform the steps described in the explanatory section of the exemplary methods described above, according to various exemplary embodiments of this application. For example, the processing unit 510 can perform, as follows: Figure 1 The steps shown are as follows.

[0199] Storage unit 520 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 5201 and / or cache memory 5202, and may further include a read-only memory (ROM) 5203.

[0200] Storage unit 520 may also include a program / utility 5204 having a set (at least one) program module 5205, such program module 5205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0201] Bus 530 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0202] Electronic device 50 can also communicate with one or more external devices 600 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 50, and / or with any device that enables electronic device 50 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 550. Input / output (I / O) interface 550 is connected to display unit 540. Furthermore, electronic device 50 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 560. As shown, network adapter 560 communicates with other modules of electronic device 50 via bus 530. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 50, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0203] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the method according to the embodiments of this application.

[0204] In an exemplary embodiment of this application, a computer-readable storage medium is also provided, on which computer-readable instructions are stored, which, when executed by a computer's processor, cause the computer to perform the methods described in the above method embodiments.

[0205] According to one embodiment of this application, a program product for implementing the methods in the above-described method embodiments is also provided. This program product may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of this application is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0206] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0207] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0208] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0209] Program code for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as JAVA and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0210] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0211] Furthermore, although the steps of the method in this application are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0212] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the method according to the embodiments of this application.

[0213] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the appended claims.

Claims

1. An image acquisition method, characterized in that, include: In response to the instruction to acquire images for traditional Chinese medicine facial diagnosis, the image to be recognized is acquired; The image to be identified is the image that needs to be identified to determine whether it meets the quality standards of traditional Chinese medicine face diagnosis. The image to be identified is subjected to face region detection to obtain a face region image; the face region image is an image composed of image regions corresponding to the face regions; For the face region image, each actual attribute is sequentially detected to determine whether it matches a standard attribute; the actual attribute is the image attribute obtained from the face region detection of the image to be identified, and the standard attribute is the image attribute that meets the image quality standard of traditional Chinese medicine facial diagnosis. If each of the actual attributes matches the standard attribute, then the image to be identified is used as the image to be collected for traditional Chinese medicine facial diagnosis. The step of sequentially detecting whether each actual attribute of the face region image matches a standard attribute includes: Detect whether the first actual attribute matches the standard attribute; the first actual attribute includes at least one of face position attribute and face pose attribute, the face position attribute is the distance and offset of the face from the image acquisition device, and the face pose attribute is the orientation of the face relative to the image acquisition device; The step of detecting whether the first actual attribute matches the standard attribute includes: Obtain the detection bounding box of the face region image; Obtain the first size of the detection box and the second size of the image to be recognized; the first size is the size of the detection box, and the second size is the size of the image to be recognized. The target ratio is obtained by comparing the first dimension with the second dimension; the target ratio is the ratio between the first dimension and the second dimension. If the target ratio is within the standard ratio range, then the first position of the detection box and the second position of the image to be identified are obtained; the standard ratio range is the size ratio range of the face region image and the overall image that meets the quality standards of traditional Chinese medicine facial diagnosis; the first position is the position of the detection box and the second position is the position of the image to be identified. The face offset is obtained based on the offset between the first position and the second position; the face offset is the offset of the face relative to the image acquisition device. If the face offset is within the standard offset range, then the two-dimensional key points of the face in the face region image are obtained; the two-dimensional key points of the face are key points with two-dimensional positional information extracted from the face image region, and the standard offset range is the offset range of the face relative to the image acquisition device that meets the quality standards of traditional Chinese medicine face diagnosis. The perspective transformation relationship between the two-dimensional key points corresponding to the preset three-dimensional key points and the preset three-dimensional key points is extracted to obtain a rotation matrix; the preset three-dimensional key points are key points with three-dimensional positional information extracted from the preset three-dimensional face model. The rotation matrix is ​​transformed to obtain the pitch angle, yaw angle, and roll angle; Based on the pitch angle, yaw angle, roll angle, and standard angle threshold, it is determined whether the facial posture attributes match the standard attributes; the standard angle threshold is a posture angle threshold that meets the quality standards of traditional Chinese medicine facial diagnosis.

2. The method according to claim 1, characterized in that, For the face region image, the method further includes sequentially detecting whether each actual attribute matches a standard attribute, based on multiple actual attributes of the image, and includes: If the first actual attribute matches the standard attribute, then it is detected whether the second actual attribute matches the standard attribute; the second actual attribute includes at least one of face partition brightness attribute, face image blur attribute, and face image color cast attribute, wherein the face partition brightness attribute is the brightness attribute of the face sub-region, the face image blur attribute is the degree of blur of the face region image, and the face image color cast attribute is the degree of color shift of the face region image, and the actual attribute includes the first actual attribute and the second actual attribute.

3. The method according to claim 2, characterized in that, Detecting whether the second actual attribute matches the standard attribute includes: The face region image is divided into regions to obtain multiple sub-regions located in different parts of the face; The brightness of each of the sub-regions is obtained separately; If the brightness of each sub-region is within the corresponding standard brightness range, then the difference between the brightness of every two sub-regions is obtained; the standard brightness range is the brightness range of the sub-region that meets the quality standards of traditional Chinese medicine facial diagnosis. If all the differences are within the standard deviation range, then the brightness attribute of the face partition matches the standard attribute; the standard deviation range is the range of brightness differences between different parts of the face that meet the quality standards of traditional Chinese medicine face diagnosis.

4. The method according to claim 2, characterized in that, Detecting whether the second actual attribute matches the standard attribute includes: The size of the face region image is reduced to obtain a reduced image; the reduced image is the image of the face region image after reduction. The face region image and the reduced image are normalized to obtain the processed data; The processed data is fitted to a generalized Gaussian distribution, and a first feature is extracted from the generalized Gaussian distribution; the first feature is a feature extracted from the generalized Gaussian distribution. For each preset direction, the preset direction is fitted with an asymmetric generalized Gaussian distribution to obtain a second feature; the second feature is a feature extracted from the asymmetric generalized Gaussian distribution. The first feature and the second feature are combined to obtain the target feature; the target feature is the feature obtained by combining the first feature and the second feature. The target features are classified for fuzziness to obtain the fuzziness classification result; Based on the fuzziness classification result, it is determined whether the fuzziness attribute of the face image matches the standard attribute.

5. The method according to claim 2, characterized in that, Detecting whether the second actual attribute matches the standard attribute includes: The color mode of the face region image is converted to lab mode to obtain lab data; The average value of the lab data in channel a is calculated to obtain a first average value; the first average value is the average value of the lab data in channel a. The average value of the lab data in the b channel is calculated to obtain a second average value; the second average value is the average value of the lab data in the b channel. Based on whether the first mean is greater than the first standard threshold and whether the second mean is greater than the second standard threshold, the color cast attribute of the face image is detected to match the standard attribute; the first standard threshold is the a-channel color threshold that meets the quality standard of traditional Chinese medicine face diagnosis, and the second standard threshold is the b-channel color threshold that meets the quality standard of traditional Chinese medicine face diagnosis.

6. The method according to claim 1, characterized in that, After sequentially checking whether each actual attribute matches the standard attribute, the method further includes: If any of the actual attributes is found to be mismatched with the standard attribute during the sequential testing process, the testing is stopped. Output a prompt message indicating adjustments to the data acquisition environment; The image to be identified is re-acquired; The newly acquired images to be identified are re-detected.

7. An image acquisition device, characterized in that, include: The acquisition module is used to acquire the image to be recognized in response to the instruction to acquire images for traditional Chinese medicine facial diagnosis. The image to be identified is the image that needs to be identified to determine whether it meets the quality standards of traditional Chinese medicine face diagnosis. A face region detection module is used to detect face regions in the image to be identified to obtain a face region image; the face region image is an image composed of image regions corresponding to the face regions; The quality detection module is used to sequentially detect whether each actual attribute of the face region image matches a standard attribute; the actual attribute is the image attribute obtained by detecting the face region of the image to be recognized, and the standard attribute is the image attribute that meets the image quality standard of traditional Chinese medicine facial diagnosis. The facial diagnosis image acquisition module is used to acquire the image to be identified as the image for traditional Chinese medicine facial diagnosis if each of the actual attributes matches the standard attributes. The quality detection module is also used to detect whether the first actual attribute matches the standard attribute; the first actual attribute includes at least one of face position attribute and face pose attribute, the face position attribute is the distance and offset of the face from the image acquisition device, and the face pose attribute is the orientation of the face relative to the image acquisition device; The step of detecting whether the first actual attribute matches the standard attribute includes: Obtain the detection bounding box of the face region image; Obtain the first size of the detection box and the second size of the image to be recognized; the first size is the size of the detection box, and the second size is the size of the image to be recognized. The target ratio is obtained by comparing the first dimension with the second dimension; the target ratio is the ratio between the first dimension and the second dimension. If the target ratio is within the standard ratio range, then the first position of the detection box and the second position of the image to be identified are obtained; the standard ratio range is the size ratio range of the face region image and the overall image that meets the quality standards of traditional Chinese medicine facial diagnosis; the first position is the position of the detection box and the second position is the position of the image to be identified. The face offset is obtained based on the offset between the first position and the second position; the face offset is the offset of the face relative to the image acquisition device. If the face offset is within the standard offset range, then the two-dimensional key points of the face in the face region image are obtained; the two-dimensional key points of the face are key points with two-dimensional positional information extracted from the face image region, and the standard offset range is the offset range of the face relative to the image acquisition device that meets the quality standards of traditional Chinese medicine face diagnosis. The perspective transformation relationship between the two-dimensional key points corresponding to the preset three-dimensional key points and the preset three-dimensional key points is extracted to obtain a rotation matrix; the preset three-dimensional key points are key points with three-dimensional positional information extracted from the preset three-dimensional face model. The rotation matrix is ​​transformed to obtain the pitch angle, yaw angle, and roll angle; Based on the pitch angle, yaw angle, roll angle, and standard angle threshold, it is determined whether the facial posture attributes match the standard attributes; the standard angle threshold is a posture angle threshold that meets the quality standards of traditional Chinese medicine facial diagnosis.

8. An electronic device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the electronic device to perform the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, It stores computer-readable instructions that, when executed by the computer's processor, cause the computer to perform the method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Image detection method and device for face recognition, electronic equipment and medium

    CN110909568A

  • Multi-angle face recognition method and device, computer master device and storage medium

    CN113971833A