(19)
(11)EP 3 816 932 B1

(12)EUROPEAN PATENT SPECIFICATION

(45)Mention of the grant of the patent:
15.06.2022 Bulletin 2022/24

(21)Application number: 18926606.7

(22)Date of filing:  18.09.2018
(51)International Patent Classification (IPC): 
G06T 7/00(2017.01)
G06T 7/136(2017.01)
G06T 7/11(2017.01)
G06K 9/00(2022.01)
(52)Cooperative Patent Classification (CPC):
G06T 7/0012; G06T 7/11; G06T 7/136; G06T 2207/10004; G06T 2207/30201; G06K 9/6289; G06V 40/171; G06V 40/10; G06V 10/28; G06V 10/48; G06V 10/50
(86)International application number:
PCT/CN2018/106232
(87)International publication number:
WO 2020/015147 (23.01.2020 Gazette  2020/04)

(54)

SKIN DETECTION METHOD AND ELECTRONIC DEVICE

HAUTDETEKTIONSVERFAHREN UND ELEKTRONISCHE VORRICHTUNG

PROCÉDÉ DE DÉTECTION DE PEAU ET DISPOSITIF ÉLECTRONIQUE


(84)Designated Contracting States:
AL AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HR HU IE IS IT LI LT LU LV MC MK MT NL NO PL PT RO RS SE SI SK SM TR

(30)Priority: 16.07.2018 CN 201810775975

(43)Date of publication of application:
05.05.2021 Bulletin 2021/18

(73)Proprietor: Honor Device Co., Ltd.
Shenzhen, Guangdong 518040 (CN)

(72)Inventors:
  • DING, Xin
    Shenzhen, Guangdong 518129 (CN)
  • DONG, Chen
    Shenzhen, Guangdong 518129 (CN)
  • HU, Hongwei
    Shenzhen, Guangdong 518129 (CN)
  • JIANG, Yongtao
    Shenzhen, Guangdong 518129 (CN)
  • GAO, Wenmei
    Shenzhen, Guangdong 518129 (CN)

(74)Representative: Gill Jennings & Every LLP 
The Broadgate Tower 20 Primrose Street
London EC2A 2ES
London EC2A 2ES (GB)


(56)References cited: : 
WO-A1-2007/022095
CN-A- 106 983 493
CN-A- 107 424 167
CN-A- 106 529 429
CN-A- 107 392 858
US-A1- 2017 103 519
  
      
    Note: Within nine months from the publication of the mention of the grant of the European patent, any person may give notice to the European Patent Office of opposition to the European patent granted. Notice of opposition shall be filed in a written reasoned statement. It shall not be deemed to have been filed until the opposition fee has been paid. (Art. 99(1) European Patent Convention).


    Description


    [0001] This application claims priority to Chinese Patent Application No. 201810775975.X, filed with the Chinese Patent Office on July 16, 2018, and entitled "SKIN DETECTION METHOD AND APPARATUS".

    TECHNICAL FIELD



    [0002] This application relates to the field of image processing technologies, and in particular, to a computer implemented skin status detection method and an electronic device.

    BACKGROUND



    [0003] Objective detection and evaluation of a facial skin status play an important role in the booming cosmetics and skincare market. Currently, a facial skin status is usually detected and evaluated by analyzing a face image by using a specialized detection device. Specialized detection devices are relatively expensive, are usually used by professional organizations, and are unsuitable for ordinary people.

    [0004] Nowadays, mobile terminal-based skin detection becomes possible owing to improved imaging capabilities of mobile terminals, so that ordinary people can detect a skin status by using mobile terminals.

    [0005] Facial detection includes blackhead detection and pore detection. Currently, when a mobile terminal is used to detect blackheads and pores, a detection manner used is as follows: A captured face image is converted to specific color space, threshold-based global segmentation is then performed, and connected component analysis is performed, to select, as a detection result, a feature that meets a specified size. The captured face image is prone to be affected by a photographing environment factor such as a lighting condition. Therefore, it is relatively difficult to obtain a proper global threshold. This further affects a segmentation result, causing a relatively large error in the detection result.

    [0006] WO 2007/022095 A1 discloses a system and method for applying a reflectance modifying agent to improve the visual attractiveness of human skin.

    SUMMARY



    [0007] Embodiments of this application provide a computer implemented skin status detection method and an electronic device, to resolve an existing problem that there is a relatively large error in a detection result due to a lighting condition.

    [0008] According to a first aspect, an embodiment of this application provides a method according to claim 1.

    [0009] According to the solution provided in this embodiment of this application, the region of interest is divided into two regions based on a facial lighting condition, and segmentation thresholds corresponding to the two regions are determined respectively. This improves detection accuracy, in comparison with a solution in which only one global threshold is used for an image.

    [0010] In a possible design of the first aspect, the dividing the region of interest into a highlighted region and a non-highlighted region includes: performing first graying processing on the region of interest to obtain a first grayscale image; performing binarization processing on the first grayscale image to obtain a binary image of the first grayscale image; performing connected component analysis on the binary image of the first grayscale image to obtain at least one first connected component; and filtering out a connected component, of the at least one first connected component, whose area is less than a first preset threshold, to obtain the highlighted region, where a region other than the highlighted region in the region of interest is the non-highlighted region.

    [0011] The foregoing design provides a simple manner for locating the highlighted region and the non-highlighted region.

    [0012] In a possible design of the first aspect, the performing first graying processing on the region of interest to obtain a first grayscale image includes: multiplying a pixel value of a kth pixel included in the region of interest by a weight value corresponding to the kth pixel, where the weight value corresponding to the kth pixel is determined based on a corresponding grayscale value of the kth pixel in a second grayscale image of the region of interest, the second grayscale image of the region of interest is obtained by performing grayscale transformation on the region of interest, k takes all positive integers less than L, and L is a quantity of pixels included in the region of interest; performing grayscale transformation on an image that is obtained by multiplying each pixel included in the region of interest by a corresponding weight value, to obtain a third grayscale image; performing min-max normalization on the third grayscale image that is obtained through the transformation; and performing grayscale inversion processing on the third grayscale image that is obtained through the min-max normalization, to obtain the first grayscale image.

    [0013] According to the foregoing design, the graying processing outlines the highlighted region, so that a degree of distinction between the highlighted region and the non-highlighted region is increased, thereby further improving accuracy in detecting pores or blackheads.

    [0014] In a possible design of the first aspect, the performing connected component analysis on the binary image of the first grayscale image to obtain at least one first connected component includes: performing expansion and/or corrosion processing on the binary image of the first grayscale image; and obtaining at least one first connected component in the binary image that has undergone the expansion and/or corrosion processing.

    [0015] According to the foregoing design, expansion and/or corrosion processing is performed on a binary image of a grayscale image, thereby smoothing a boundary of each first connected component.

    [0016] In a possible design of the first aspect, the determining a first segmentation threshold of the highlighted region includes: performing fourth graying processing on the region of interest to obtain a fourth grayscale image, and obtaining a minimum grayscale value of an ith pixel included in the highlighted region in the fourth grayscale image and N neighboring pixels of the ith pixel, where i takes all positive integers less than or equal to M1, M1 is a quantity of pixels included in the highlighted region, and N is equal to a multiple of 4; and using an average value of M1 obtained minimum grayscale values as the first segmentation threshold.

    [0017] According to the foregoing design, the first segmentation threshold of the highlighted region is determined. This is conducive to improving accuracy in detecting pores or blackheads.

    [0018] In a possible design of the first aspect, the determining a second segmentation threshold of the non-highlighted region includes: performing fourth graying processing on the region of interest to obtain a fourth grayscale image, and obtaining a minimum grayscale value of a jth pixel included in the non-highlighted region in the fourth grayscale image and N neighboring pixels of the jth pixel, where j takes all positive integers less than or equal to M2, and M2 is a quantity of pixels included in the non-highlighted region; and using an average value of the M2 obtained minimum grayscale values as the second segmentation threshold.

    [0019] According to the foregoing design, the first segmentation threshold of the non-highlighted region is determined. This is conducive to improving accuracy in detecting pores or blackheads.

    [0020] In a possible design of the first aspect, the identifying, based on a fused image, pores and/or blackheads included in the region of interest includes: performing corrosion and/or expansion processing on the fused image; and identifying, based on the fused image that has undergone the corrosion and/or expansion processing, the pores and/or the blackheads included in the region of interest.

    [0021] According to the foregoing design, the fused image can be smoothed by performing the corrosion and/or expansion processing on the fused image.

    [0022] In a possible design of the first aspect, the identifying, based on a fused image, pores and/or blackheads included in the region of interest includes: removing a nose shadow region from the fused image; and determining, based on the fused image from which the nose shadow region is removed, the pores and/or the blackheads included in the region of interest.

    [0023] In a possible design of the first aspect, the nose shadow region is located in the following manner: performing fourth graying processing on the region of interest to obtain a fourth grayscale image, and performing binarization processing on the fourth grayscale image to obtain a binary image of the fourth grayscale image; performing connected component analysis on the binary image of the fourth grayscale image to obtain at least one second connected component; and filtering out a connected component, of the at least one second connected component, whose area is less than a second preset threshold, to obtain the nose shadow region.

    [0024] False detection of pores or blackheads in the nose shadow region occurs frequently. Therefore, according to the foregoing design, the nose shadow region is located, and the nose shadow region is removed from the region of interest before blackheads and pores are determined, thereby reducing a false detection rate.

    [0025] In a possible design of the first aspect, the performing connected component analysis on the binary image of the fourth grayscale image to obtain at least one second connected component includes: performing expansion and/or corrosion processing on the binary image of the fourth grayscale image; and obtaining at least one second connected component in the binary image, of the fourth grayscale image, that has undergone the expansion and/or corrosion processing.

    [0026] In a possible design of the first aspect, the performing fourth graying processing on the region of interest to obtain a fourth grayscale image includes: performing grayscale transformation on the region of interest to obtain the second grayscale image; performing min-max normalization on the second grayscale image; performing Gaussian differential filtering on the second grayscale image that has undergone the min-max normalization, to obtain a filtered image; performing min-max normalization on the filtered image; and obtaining a histogram of the filtered image that has undergone the min-max normalization, and based on the histogram of the filtered image, setting a grayscale value of a first type of pixels in the filtered image to 0, and setting a grayscale value of a second type of pixels in the filtered image to 255, where the grayscale value of the first type of pixels is less than or equal to a minimum grayscale value of other pixels in the filtered image, a percentage of a quantity of the first type of pixels in a total quantity of pixels in the filtered image is a%, a grayscale value of the second type of pixels is greater than or equal to a maximum grayscale value of other pixels in the filtered image, a percentage of a quantity of the second type of pixels in the total quantity of pixels in the filtered image is b%, and a and b are both positive integers. This is conducive to improving accuracy in detecting blackheads or pores.

    [0027] In a possible design of the first aspect, the identifying, based on a fused image, pores and/or blackheads included in the region of interest includes: obtaining at least one third connected component included in the fused image, and obtaining a parameter corresponding to each third connected component, where the parameter includes at least one of the following: a radius, a degree of circularity, and an internal-external color variation value; and identifying, based on the parameter corresponding to each third connected component, whether a location corresponding to the third connected component is a pore or a blackhead, where the degree of circularity is used to represent a degree of similarity between a shape of the third connected component and a circle, and the internal-external color variation value is a difference or a ratio between an internal pixel value and an external pixel value that correspond to the third connected component at a location of the region of interest. This is conducive to improving accuracy in detecting blackheads or pores.

    [0028] In a possible design of the first aspect, the method further includes: processing an image corresponding to identified pores to obtain a quantized pore indicator; calculating a quantized pore score of the region of interest based on the quantized pore indicator; and displaying the quantized pore score, where: the quantized pore indicator includes at least one of the following: a pore area ratio, a pore density, an average pore internal-external color variation value, and a ratio of a pore internal-external color variation value-weighted area; and the pore area ratio is a ratio of a total area of pores included in the region of interest to an area of the region of interest, the pore density is a ratio of a quantity of pores included in the region of interest to the area of the region of interest, the average pore internal-external color variation value is an average value of internal-external color variation values of the pores included in the region of interest, and the ratio of the pore internal-external color variation value-weighted area is a ratio, to the area of the region of interest, of a sum that is obtained by adding all values obtained by multiplying, by a corresponding area, an internal-external color variation value of each pore included in the region of interest.

    [0029] In a possible design of the first aspect, the method further includes: processing an image corresponding to identified blackheads to obtain a quantized blackhead indicator; calculating a quantized blackhead score of the region of interest based on the quantized blackhead indicator; and displaying the quantized blackhead score, where: the quantized blackhead indicator includes at least one of the following: a blackhead area ratio, a blackhead density, an average blackhead internal-external color variation value, and a ratio of a blackhead internal-external color variation value-weighted area; and the blackhead area ratio is a ratio of a total area of blackheads included in the region of interest to the area of the region of interest, the blackhead density is a ratio of a quantity of blackheads included in the region of interest to the area of the region of interest, the average blackhead internal-external color variation value is an average value of internal-external color variation values of the blackheads included in the region of interest, and the ratio of the blackhead internal-external color variation value-weighted area is a ratio, to the area of the region of interest, of a sum that is obtained by adding all values obtained by multiplying, by a corresponding area, an internal-external color variation value of each blackhead included in the region of interest.

    [0030] Quantized scores are determined by using indicators of a plurality of dimensions. This is more professional and scientific in comparison with an existing method of calculating a quantized score by using only an area.

    [0031] According to a second aspect, an embodiment of this application provides an electronic device, including a processor and a memory. The processor is coupled to the memory, the memory is configured to store a program instruction, and the processor is configured to read the program instruction stored in the memory, to implement the method according to any one of the first aspect or the possible designs of the first aspect.

    [0032] In addition, for the technical effects produced by the second aspect, refer to the descriptions in the first aspect. Details are not described herein again.

    [0033] It should be noted that in the embodiments of this application, "coupling" means direct or indirect mutual combination between two parts.

    BRIEF DESCRIPTION OF DRAWINGS



    [0034] 

    FIG. 1 is a schematic structural diagram of an electronic device according to an embodiment of this application;

    FIG. 2 is a schematic diagram of a user interface according to an embodiment of this application;

    FIG. 3A is a flowchart of a skin detection method according to an embodiment of this application;

    FIG. 3B-1 to FIG. 3B-3 are a schematic diagram of a preview user interface according to an embodiment of this application;

    FIG. 4A is a schematic diagram of an ROI of pores according to an embodiment of this application;

    FIG. 4B is a schematic diagram of an ROI of blackheads according to an embodiment of this application;

    FIG. 5A is a schematic diagram of a method of locating a highlighted region according to an embodiment of this application;

    FIG. 5B is a schematic diagram of a highlighted region mask according to an embodiment of this application;

    FIG. 6A is a schematic flowchart of a method of determining a segmentation threshold of a highlighted region according to an embodiment of this application;

    FIG. 6B is a schematic flowchart of a method of determining a segmentation threshold of a non-highlighted region according to an embodiment of this application;

    FIG. 7A is a schematic diagram of four neighbors of a pixel according to an embodiment of this application;

    FIG. 7B is a schematic diagram of eight neighbors of a pixel according to an embodiment of this application;

    FIG. 8A is a schematic flowchart of fourth graying processing according to an embodiment of this application;

    FIG. 8B is a schematic diagram of a histogram according to an embodiment of this application;

    FIG. 9 is a schematic flowchart of a method of determining a nose shadow region according to an embodiment of this application;

    FIG. 10 is a schematic diagram of an internal and an external of a connected component according to an embodiment of this application;

    FIG. 11 is a schematic flowchart of skin detection according to an embodiment of this application;

    FIG. 12A is a schematic diagram of an ROI of pores according to an embodiment of this application;

    FIG. 12B is a schematic diagram of a fourth grayscale image of an ROI of pores according to an embodiment of this application;

    FIG. 12C is a schematic diagram of a highlighted region according to an embodiment of this application;

    FIG. 12D is a schematic diagram of a binary image of a highlighted region according to an embodiment of this application;

    FIG. 12E is a schematic diagram of a binary image of a non-highlighted region according to an embodiment of this application;

    FIG. 12F is a schematic diagram of a binary image of a fused image according to an embodiment of this application;

    FIG. 12G is a schematic diagram of a nose shadow region according to an embodiment of this application;

    FIG. 13A to FIG. 13C are schematic diagrams of pore detection results according to an embodiment of this application;

    FIG. 14 is a schematic diagram of blackhead detection results according to an embodiment of this application;

    FIG. 15 is a schematic diagram of a skin quality analysis report according to an embodiment of this application; and

    FIG. 16 is a schematic diagram of an electronic device 1600 according to an embodiment of this application.


    DESCRIPTION OF EMBODIMENTS



    [0035] Embodiments disclosed in this application can be applied to an electronic device. In some embodiments of this application, the electronic device may be a portable electronic device including a function such as a personal digital assistant and/or a music player, for example, a mobile phone, a tablet computer, a wearable device (such as a smart watch) with a wireless communication function, or a vehicle-mounted device. An example embodiment of a portable electronic device includes but is not limited to a portable electronic device using iOS®, Android®, Microsoft®, or another operating system. The foregoing portable electronic device may alternatively be a laptop computer (Laptop) having a touch-sensitive surface (for example, a touch panel), or the like. It should also be understood that, in some other embodiments of this application, the electronic device may alternatively be a desktop computer that having a touch-sensitive surface (for example, a touch panel).

    [0036] FIG. 1 is a schematic structural diagram of an electronic device 100.

    [0037] The electronic device 100 includes a processor 110, an internal memory 121, and may include an external memory interface 120, , a universal serial bus (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 2, a wireless communications module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and the like. The sensor module 180 includes an ambient light sensor 180L. In addition, the sensor module 180 may further include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, an optical proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, a bone conduction sensor 180M, and the like. In some other embodiments, the electronic device 100 in this embodiment of this application may further include an antenna 1, a mobile communications module 150, a subscriber identity module (subscriber identification module, SIM) card interface 195, and the like.

    [0038] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural-network processing unit (neural-network processing unit, NPU). Different processing units may be independent devices, or may be integrated into one or more processors.

    [0039] In some embodiments, the processor 110 is provided with a memory, configured to store an instruction and data. For example, the memory in the processor 110 may be a cache memory. The memory may store an instruction or data recently used or cyclically used by the processor 110. If the processor 110 needs to use the instruction or data again, the processor 110 may directly invoke the instruction or data from the memory. This avoids repeated access and reduces a waiting time of the processor 110, thereby improving system efficiency.

    [0040] In some other embodiments, the processor 110 may further include one or more interfaces. For example, the interface may be a (universal serial bus, USB) interface 130. For another example, the interface may alternatively be an inter-integrated circuit (inter-integrated circuit, I2C) interface, an inter-integrated circuit sound (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver/transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general purpose input/output (general-purpose input/output, GPIO) interface, or a subscriber identity module (subscriber identity module, SIM) interface. It can be understood that in this embodiment of this application, different modules of the electronic device 100 may be connected through interfaces, so that the electronic device 100 can implement different functions, such as photographing and processing. It should be noted that a connection manner of the interfaces in the electronic device 100 is not limited in this embodiment of this application.

    [0041] The USB interface 130 is an interface compliant with a USB standard specification. For example, the USB interface 130 may include a mini USB interface, a micro USB interface, a USB type C interface, and the like. The USB interface 130 may be configured to connect to a charger to charge the electronic device 100, may also be configured to transmit data between the electronic device 100 and a peripheral device, and may also be configured to connect to a headset, to play audio through the headset. The interface may further be configured to connect to another electronic device, such as an AR device.

    [0042] The charging management module 140 is configured to receive a charging input from the charger. The charger may be a wireless charger, or may be a wired charger. In some wired charging embodiments, the charging management module 140 may receive a charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive a wireless charging input from a wireless charging coil of the electronic device 100. The charging management module 140 may further supply power to the electronic device through the power management module 141 while charging the battery 142.

    [0043] The power management module 141 is configured to connect to the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives an input and/or inputs from the battery 142 and/or the charging management module 140, to supply power to the processor 110, the internal memory 121, an external memory, the display screen 194, the camera 193, the wireless communications module 160, and the like. The power management module 141 may further be configured to monitor parameters such as a battery capacity, a quantity of battery circles, and a battery health status (electric leakage or impedance). In some other embodiments, the power management module 141 may alternatively be disposed in the processor 110. In some other embodiments, the power management module 141 and the charging management module 140 may alternatively be disposed in a same device.

    [0044] A wireless communication function of the electronic device 100 may be implemented by using the antenna 1, the antenna 2, the mobile communications module 150, the wireless communications module 160, the modem processor, the baseband processor, and the like.

    [0045] The antenna 1 and the antenna 2 are configured to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 may be configured to cover one or more communication frequency bands. Different antennas may be reused, to improve antenna utilization. For example, the antenna 1 may be reused as a diversity antenna of a wireless local area network. In some other embodiments, an antenna may be used in combination with a tuning switch.

    [0046] The mobile communications module 150 may provide a wireless communication solution applied to the electronic device 100, including 2G, 3G, 4G, 5G, or the like. The mobile communications module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (low noise amplifier, LNA), and the like. The mobile communications module 150 may receive an electromagnetic wave through the antenna 1; perform filtering, amplification, and other processing on the received electromagnetic wave; and transfer a processed electromagnetic wave to the modem processor for demodulation. The mobile communications module 150 may further amplify a signal modulated by the modem processor, convert an amplified signal into an electromagnetic wave by using the antenna 1, and radiate the electromagnetic wave through the antenna 1. In some embodiments, at least some function modules of the mobile communications module 150 may be disposed in the processor 110. In some embodiments, at least some function modules of the mobile communications module 150 may be disposed in a same device as at least some modules of the processor 110.

    [0047] The modem processor may include a modulator and a demodulator. The modulator is configured to modulate a to-be-sent low frequency baseband signal into an intermediate frequency or high frequency signal. The modulator is configured to demodulate a received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transfers the low frequency baseband signal obtained through demodulation to the baseband processor for processing. The low frequency baseband signal is transferred to the application processor after being processed by the baseband processor. The application processor outputs a voice signal through an audio device (including but not limited to the speaker 170A and the receiver 170B), or displays an image or a video through the display screen 194. In some embodiments, the modem processor may be an independent device. In some other embodiments, the modem processor may be independent of the processor 110, and is disposed in a same device as the mobile communications module 150 or another function module.

    [0048] The wireless communications module 160 may provide wireless communication solutions that are applied to the electronic device 100, for example, wireless local area network (wireless local area networks, WLAN) (such as wireless fidelity (wireless fidelity, Wi-Fi) network), bluetooth (bluetooth, BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication (near field communication, NFC), and infrared (infrared, IR) technologies. The wireless communications module 160 may be one or more devices integrated with at least one communication processing module. The wireless communications module 160 receives an electromagnetic wave signal through the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signal, and sends a processed signal to the processor 110. The wireless communications module 160 may further receive a to-be-sent signal from the processor 110, perform frequency modulation and amplification processing on the to-be-sent signal, convert a processed to-be-sent signal into an electromagnetic wave by using the antenna 2, and radiate the electromagnetic wave through the antenna 2.

    [0049] In some embodiments, in the electronic device 100, the antenna 1 is coupled to the mobile communications module 150, and the antenna 2 is coupled to the wireless communications module 160, so that the electronic device 100 can communicate with a network and another device by using a wireless communications technology. The wireless communications technology may include global system for mobile communications (global system for mobile communications, GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), wideband code division multiple access (wideband code division multiple access, WCDMA), time-division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC, FM, IR, and/or other technologies. The GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (global navigation satellite system, GLONASS), a BeiDou navigation satellite system (beidou navigation satellite system, BDS), a quasi-zenith satellite system (quasi-zenith satellite system, QZSS), and/or a satellite-based augmentation system (satellite-based augmentation systems, SBAS).

    [0050] The electronic device 100 implements a display function by using the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. The GPU is configured to perform mathematical and geometric calculation, and is configured to perform graphics rendering. The processor 110 may include one or more GPUs, and execute a program instruction to generate or change display information.

    [0051] The display screen 194 is configured to display an image, a video, and the like. The display screen 194 includes a display panel. The display panel may use a liquid crystal display (liquid crystal display, LCD), an organic light-emitting diode (organic light-emitting diode, OLED), an active-matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), a flexible light-emitting diode (flex light-emitting diode, FLED), a mini LED, a micro LED, a micro OLED, a quantum dot light emitting diode (quantum dot light emitting diodes, QLED), or the like. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.

    [0052] The electronic device 100 may implement a photographing function by using the ISP, the camera 193, the video codec, the GPU, the display screen 194, the application processor, and the like.

    [0053] The ISP is configured to process data fed back by the camera 193. For example, during photographing, after the shutter is opened, light is transferred to a photosensitive element of the camera, an optical signal is converted into an electrical signal, and the photosensitive element of the camera transfers the electrical signal to the ISP for processing, to convert the electrical signal into an image visible to human eyes. The ISP may further perform algorithm-based optimization on the image in terms of noise, brightness, and skin color. The ISP may further optimize parameters such as an exposure and a color temperature of a photographing scenario. In some embodiments, the ISP may be disposed in the camera 193.

    [0054] The camera 193 is configured to capture a static image or a video. An optical image of an object is generated through a lens and is projected to the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a complementary metal-oxide-semiconductor (complementary metal-oxide-semiconductor, CMOS)-based phototransistor. The photosensitive element converts an optical signal into an electrical signal, and transfers the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB or YUV format or the like. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

    [0055] The digital signal processor is configured to process a digital signal. The digital signal processor not only can process the digital image signal, but also can process another digital signal. For example, when the electronic device 100 selects a frequency, the digital signal processor is configured to perform Fourier transformation on frequency energy, or the like.

    [0056] The video codec is configured to compress or decompress a digital video. The electronic device 100 can support one or more types of video codecs. In this way, the electronic device 100 may play or record videos in a plurality of encoding formats, for example, moving picture experts group (moving picture experts group, MPEG)-1, MPEG-2, MPEG-3, and MPEG-4.

    [0057] The NPU is a neural-network (neural-network, NN) computation processor that rapidly processes input information by using a biological neural network structure, for example, by using a mode of transfer between human brain neurons, and may further perform continuous self-learning. Applications such as intelligent cognition of the electronic device 100, for example, image recognition, facial recognition, voice recognition, and text understanding, can be implemented by using the NPU.

    [0058] The external memory interface 120 may be configured to connect to an external memory card (for example, a micro SD card), to expand a storage capability of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120, to implement a data storage function, for example, to store music, video, and other files in the external memory card.

    [0059] The internal memory 121 may be configured to store computer executable program code, where the executable program code includes an instruction. The processor 110 runs the instruction stored in the internal memory 121, to perform various function applications and data processing of the electronic device 100. The internal memory 121 may include a program storage area and a data storage area. The program storage area may store an operating system, an application program required by at least one function (for example, a voice playing function or an image playing function), and the like. The data storage area may store data (for example, audio data, a phone book, and the like) created during use of the electronic device 100 and other data. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a non-volatile memory, such as at least one magnetic disk storage device, at least one flash memory device, and at least one universal flash storage (universal flash storage, UFS).

    [0060] The electronic device 100 may implement an audio function, such as music playing and recording, by using the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headset interface 170D, the application processor, and the like.

    [0061] The audio module 170 is configured to convert digital audio information into an analog audio signal output, and is also configured to convert an analog audio input into a digital audio signal. The audio module 170 may further be configured to encode and decode an audio signal. In some embodiments, the audio module 170 may be disposed in the processor 110, or some function modules of the audio module 170 may be disposed in the processor 110.

    [0062] The speaker 170A, also referred to as a "loudspeaker", is configured to convert an electrical audio signal into a voice signal. The electronic device 100 may be used for listening to music or answering a hands-free call by using the speaker 170A.

    [0063] The receiver 170B, also referred to as an "earpiece", is configured to convert an electrical audio signal into a voice signal. When a call or voice information is received on the electronic device 100, voice can be heard by putting the receiver 170B near a human ear.

    [0064] The microphone 170C, also referred to as a "voice tube" or a "megaphone", is configured to convert a voice signal into an electrical signal. When making a call or sending voice information, a user may put the microphone 170C near the mouth and speak, to input a voice signal into the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In some other embodiments, the electronic device 100 may be provided with two microphones 170C, which may further implement a noise reduction function in addition to voice signal collection. In some other embodiments, the electronic device 100 may alternatively be provided with three, four, or more microphones 170C, which implement voice signal collection and noise reduction, and may further identify a source of voice, to implement a directional recording function.

    [0065] The headset interface 170D is configured to connect to a wired headset. The headset interface 170D may be a USB interface 130, or may be a standard 3.5 mm open mobile terminal platform (open mobile terminal platform, OMTP) interface, a standard cellular telecommunications industry association of the USA (cellular telecommunications industry association of the USA, CTIA) interface, or the like.

    [0066] The pressure sensor 180A is configured to sense a pressure signal, and may convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The pressure sensor 180A may be of many types, for example, a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, or the like. A capacitive pressure sensor may include at least two parallel plates that contain a conductive material. When force is exerted on the pressure sensor 180A, a capacitance between electrodes is changed. The electronic device 100 determines a strength of the pressure based on a change of the capacitance. When a touch operation is exerted on the display screen 194, the electronic device 100 detects a strength of the touch operation by using the pressure sensor 180A. The electronic device 100 may also calculate a touch position based on a signal detected by the pressure sensor 180A. In some embodiments, touch operations that are exerted on a same touch position but have different touch operation strengths may correspond to different operation instructions. For example, when a touch operation with a touch operation strength less than a first pressure threshold is exerted on an icon of an SMS message application, an instruction for viewing an SMS message is executed. When a touch operation with a touch operation strength greater than or equal to the first pressure threshold is exerted on the icon of the SMS message application, an instruction for creating an SMS message is executed.

    [0067] The gyroscope sensor 180B may be configured to determine a movement posture of the electronic device 100. In some embodiments, angular velocities of the electronic device 100 relative to three axes (that is, x, y, and z axes) may be determined by using the gyroscope sensor 180B. The gyroscope sensor 180B may be configured to implement image stabilization during photographing. For example, when the shutter is pressed, the gyroscope sensor 180B detects an angle of shaking of the electronic device 100; and calculates, based on the angle, a distance that needs to be compensated by a lens module, to counteract the shaking of the electronic device 100 through a counter motion of the lens, thereby implementing image stabilization. The gyroscope sensor 180B may further be used in navigation and motion sensing gaming scenarios.

    [0068] The barometric pressure sensor 180C is configured to measure an atmospheric pressure. In some embodiments, the electronic device 100 calculates an altitude based on an atmospheric pressure value measured by the barometric pressure sensor 180C, to assist in positioning and navigation.

    [0069] The magnetic sensor 180D includes a Hall effect sensor. The electronic device 100 may detect opening and closing of a flip leather case by using the magnetic sensor 180D. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 may detect opening and closing of a clamshell by using the magnetic sensor 180D. In this way, based on a detected open/closed state of the leather case or a detected open/closed state of the clamshell, attributes such as auto-unlocking when the flip phone is flipped open can be set.

    [0070] The acceleration sensor 180E may detect magnitude of accelerations of the electronic device 100 in all directions (usually along three axes). When the electronic device 100 is still, the acceleration sensor 180E may detect a magnitude and a direction of gravity. The acceleration sensor 180E may further be configured to identify a posture of the electronic device, and is applied to landscape/portrait mode switching, a pedometer, and the like.

    [0071] The distance sensor 180F is configured to measure a distance. The electronic device 100 may measure a distance by using an infrared or laser ray. In some embodiments, in a photographing scenario, the electronic device 100 may measure a distance by using the distance sensor 180F, to implement rapid focusing.

    [0072] The optical proximity sensor 180G may include a light emitting diode (LED), an optical detector, and the like, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light by using the light emitting diode. The electronic device 100 detects reflected infrared light from a nearby object by using the photodiode. When detecting sufficient reflected light, the electronic device 100 can determine that there is an object near the electronic device 100. When detecting insufficient reflected light, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can detect, by using the optical proximity sensor 180G, that the user holds the electronic device 100 close to an ear during a call, so as to automatically turn off a screen, thereby saving power. The optical proximity sensor 180G may also be used for auto-unlocking and screen locking in a leather case mode and a pocket mode.

    [0073] The ambient light sensor 180L is configured to sense brightness of ambient light. The electronic device 100 may adaptively adjust brightness of the display screen 194 based on the sensed brightness of the ambient light. The ambient light sensor 180L may also be configured to automatically adjust white balance during photographing. The ambient light sensor 180L may further be configured to detect, in coordination with the optical proximity sensor 180G, whether the electronic device 100 is in a pocket, to prevent touch by mistake.

    [0074] The fingerprint sensor 180H is configured to collect a fingerprint. By using a feature of the collected fingerprint, the electronic device 100 may implement unlocking via the fingerprint, access an application lock, take a photo via the fingerprint, answer a call via the fingerprint, and the like.

    [0075] The temperature sensor 180J is configured to detect a temperature. In some embodiments, the electronic device 100 detects a temperature by using the temperature sensor 180J, to execute a temperature processing policy. For example, when a temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 degrades performance of a processor near the temperature sensor 180J, to reduce power consumption and implement thermal protection. In some other embodiments, when a temperature is lower than another threshold, the electronic device 100 heats up the battery 142, to prevent abnormal power-off of the electronic device 100 caused by a low temperature. In some other embodiments, when a temperature is lower than still another threshold, the electronic device 100 boosts an output voltage of the battery 142, to prevent abnormal power-off caused by a low temperature.

    [0076] The touch sensor 180K is also referred to as a "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also referred to as a "touch control screen". The touch sensor 180K is configured to detect a touch operation exerted on or near the touch sensor 180K. The touch sensor may transfer the detected touch operation to the application processor, to determine a touch event type. The display screen 194 may be used to provide a visual output related to the touch operation. In some other embodiments, the touch sensor 180K may alternatively be disposed on a surface of the electronic device 100 at a different location from the display screen 194.

    [0077] The bone conduction sensor 180M may obtain a vibration signal. In some embodiments, the bone conduction sensor 180M may obtain a vibration signal of a vibrating bone of a vocal-cord part of a human body. The bone conduction sensor 180M may also be in contact with pulses of the human body, to receive blood pressure fluctuating signals. In some embodiments, the bone conduction sensor 180M may alternatively be provided in a headset, to form a bone conduction headset. The audio module 170 may obtain a voice signal through parsing the vibration signal of the vibrating bone of the vocal-cord part of the human body obtained by the bone conduction sensor 180M, to implement a voice function. The application processor may obtain heart rate information through parsing the blood pressure fluctuating signals obtained by the bone conduction sensor 180M, to implement a heart rate detection function.

    [0078] The key 190 may include a power on/off key, a volume key, and the like. The key 190 may be a mechanical key, or may be a touch key. The electronic device 100 may receive a key input, to generate a key signal input that is related to user setting or function control of the electronic device 100.

    [0079] The motor 191 may generate a vibration alert. The motor 191 may be configured to produce an incoming call vibration alert, and may also be configured to provide a touch vibration feedback. For example, touch operations exerted on different applications (such as photographing and audio playing) may correspond to different vibration feedback effects. The motor 191 may also provide different vibration feedback effects correspondingly depending on touch operations exerted on different regions on the display screen 194. Different application scenarios (for example, time reminder, information receiving, alarm, and gaming) may also correspond to different vibration feedback effects. A touch vibration feedback effect may also be customized.

    [0080] The indicator 192 may be an indicator light, may be configured to indicate a charging status and a battery level change, and may also be configured to indicate a message, a missed call, a notification, and the like.

    [0081] The SIM card interface 195 is configured to connect to an SIM card. The SIM card may be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195, to come into contact with or be separated from the electronic device 100. The electronic device 100 may support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support a nano-SIM card, a micro-SIM card, a SIM card, and the like. A plurality of cards may be inserted into the same SIM card interface 195 at a same time. The plurality of cards may be of a same type or may be of different types. The SIM card interface 195 may also be compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with an external memory card. The electronic device 100 interacts with a network by using the SIM card, to implement call and data communication and the like. In some embodiments, the electronic device 100 uses an eSIM card, that is, an embedded SIM card. The eSIM card may be embedded in the electronic device 100, and cannot be separated from the electronic device 100.

    [0082] It can be understood that the structure illustrated in this embodiment of this application does not constitute a specific limitation on the electronic device 100. In some other embodiments of this application, the electronic device 100 may include more or fewer components than those illustrated in the figure, some components may be combined, some components may be split, or there may be a different component arrangement. The illustrated components may be implemented by hardware, software, or a combination of software and hardware.

    [0083] In addition, it should be noted that in this application, "at least one" means one or more, and "a plurality of' means two or more. The term "and/or" describes an association relationship for describing associated objects and represents that three relationships may exist. For example, A and/or B may represent the following three cases: Only A exists, both A and B exist, and only B exists, where A and B each may be in a singular or plural form. The character "/" generally indicates an "or" relationship between the associated objects. "At least one (item) of the following" or a similar expression thereof means any combination of these items, including a single item or any combination of a plurality of items. For example, at least one (item) of a, b, or c may represent a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c each may be in a singular or plural form. In addition, it should be understood that in the descriptions of this application, terms such as "first" and "second" are merely intended for distinction in description, but should not be construed as indicating or implying relative importance or indicating or implying a sequence.

    [0084] The following describes the embodiments of this application in detail by using the electronic device 100 as an example.

    [0085] It should be understood that in the embodiments of this application, application programs supported by the electronic device may include a photographing application, such as a camera. Moreover, the application programs supported by the electronic device may further include a plurality of other applications, such as drawing, gaming, phone, video player, music player, photo management, browser, calendar, and clock.

    [0086] In the embodiments of this application, applications supported by the electronic device may further include a skin detection application. The skin detection application may detect facial skin features (for example, wrinkles, pores, blackheads, color spots, and red areas on facial skin) of a user by using a captured face image, and provide a detection result report for the user. For example, the detection result report may include, without being limited to, scores for the features of the facial skin, comprehensive analysis of the facial skin, and the like; and may further display the face image of the user and mark corresponding issues on the face image based on a detection result concerning each feature, for example, marking blackheads in a nose tip region, marking winkles in a forehead region, and marking color spots in a cheek region. It can be understood that the detection result report may be presented to the user on a user interface. For example, the detection result report may be presented on a user interface 200 shown in FIG. 2, and includes a synthesis score, a skin age, and scores for pores, blackheads, fine lines, color spots, and red areas. In some other embodiments, the user interface 200 may further include a virtual button 201, a virtual button 202, a virtual button 203, a virtual button 204, and a virtual button 205. Using the virtual button 201 as an example, the electronic device 100 displays, on the display screen 194 in response to an operation on the virtual button 201, specific care advice concerning the pores. For functions of the virtual button 202, the virtual button 203, the virtual button 204, and the virtual button 205, refer to the function of the virtual button 201. Details are not described herein again.

    [0087] To enable more accurate detection of the facial skin of the user by using the electronic device, for example, in a user skin detection solution of the embodiments of this application, a photographing condition detection module, an image quality detection module, a region of interest (region of interest, ROI) detection module, a skin feature detection module, a result analysis module, and the like may be integrated into the processor 110. In some embodiments, a photographing condition detection module, an image quality detection module, a region of interest (region of interest, ROI) detection module, a skin feature detection module, a result analysis module, and the like may be integrated into the application processor in the processor 110. In some other embodiments, an artificial intelligence (artificial intelligence, AI) chip is integrated into the processor 110, and a photographing condition detection module, an image quality detection module, a region of interest (region of interest, ROI) detection module, a skin feature detection module, a result analysis module, and the like may be integrated into the AI chip, to implement user skin detection.

    [0088] The photographing condition detection module may detect a current photographing condition, to guide the user to take a photo under a required photographing condition, to ensure that a captured image meets a requirement, thereby ensuring accuracy of skin detection based on the image. For example, the required photographing condition is that there is sufficient ambient light, there is proper distance (for example, approximately 25 cm) between the face and the electronic device, the face is kept in a proper posture, eyes are opened or closed, glasses should be taken off, the forehead is not covered by bangs as far as possible, a focus is correct, there is no obvious shaking, and so on.

    [0089] After the photographing condition detection module detects the photographing condition successfully, the processor 110 enables smart light supplementation. For example, the photographing condition detection module determines that the detection is successful when the current photographing condition meets the requirement. Specifically, in the embodiments of this application, the electronic device may use different light supplementation modes (for example, a flash mode or a flashlight mode) to supplement light on the user face, to meet different facial skin feature detection requirements. After light is supplemented on the user face, the processor 110 may control the camera 193 to photograph the user face, to obtain a face image of the user.

    [0090] The image quality detection module may detect quality of the face image, to ensure that the captured image meets different facial skin feature detection requirements.

    [0091] After the image quality detection module detects that the quality of the image meets a requirement, the ROI detection module may determine a to-be-detected ROI in the face image. For example, an ROI of blackheads is a small region on the nose tip.

    [0092] The skin feature detection module may separately detect facial skin features in the determined ROI, for example, detecting wrinkles, pores, blackheads, color spots, red areas, a degree of oiliness, and the like on the skin.

    [0093] The result analysis module may analyze detection results, concerning the facial skin features, detected by the skin feature detection module; and provide a score, a ranking, and the like of each detection item of each skin feature.

    [0094] In addition, in some embodiments, the processor 110 may further be integrated with an image preprocessing module. The image preprocessing module may perform compression, cropping, and the like on the captured face image, for the ROI detection module, the skin feature detection module, and the like to perform subsequent processing.

    [0095] To output an analysis result concerning the face image or output the score and the like of each detection item, the processor 110 may further display, on the display screen 194, a detection report (including regions in which the detection results concerning the features are located on the face image, for example, marking blackheads in the nose tip region, marking winkles in the forehead region, and marking color spots in the cheek region; the score of each detection item; and the like) obtained after the detection, so that the user can view the detection report, thereby improving user experience.

    [0096] The inventor discovered that during skin detection, due to uneven lighting on a face, it is relatively difficult to obtain a global threshold suitable for binarization processing. If a threshold is determined by using a dark location as a reference, too many pores or blackheads may be detected at a brighter location (due to false detection). If a threshold is determined by using a bright location as a reference, too few pores or no pores may be detected at a darker location (due to missing of detection). A value of a threshold may be affected when lighting or a posture of a person is changed slightly, thereby affecting consistency between detection results.

    [0097] In view of this, the embodiments of this application provide a skin detection method and a terminal device, to detect blackheads and/or pores. An ROI region is divided into a highlighted region and a non-highlighted region based on a light reflection status on the face, and thresholds are respectively determined for the two regions for binarization processing, and then blackheads and/or pores are determined.

    [0098] FIG. 3A is schematic flowchart of a skin detection method according to an embodiment of this application. The method includes the following steps. The skin detection method is performed by the foregoing electronic device 100, and is performed by the processor 110 in the electronic device 100.

    [0099] S301. Obtain a region of interest in a face image.

    [0100] In a possible example, the skin detection method provided in this embodiment of this application can be applied to a skin test application. A face image is obtained by using the skin test application, and the skin detection method provided in this embodiment of this application is performed based on the face image. As shown in FIG. 3B-1 to FIG. 3B-3, the display screen 194 of the electronic device 100 displays an icon 300 of the skin test application. When detecting an operation on the icon 300, the electronic device 100 displays, in response to the operation on the icon 300, a user interface 310 of the skin test application on the display screen 194. The user interface 310 of the skin test application includes a skin test button 311. The electronic device 100 detects an operation on the skin test button 311. In response to the operation on the skin test button 311, the display screen 194 displays a photographing preview interface 320 of a camera application. The photographing preview interface 320 is configured to display an image collected by the camera 193. For example, the photographing preview interface 320 may include a preview region 321. The preview region 321 is configured to display the image collected by the camera 193. It should be understood that the image collected by the camera 193 may be a face image of a user. In addition, the camera 193 may be a front-facing camera of the electronic device 100, or may be a rear-facing camera of the electronic device 100. In some embodiments, to improving photographing quality, if resolution of the front-facing camera is lower than that of the rear-facing camera, the camera 193 is the rear-facing camera of the electronic device 100. To further improving the photographing quality, when ambient light meets a photographing condition, the electronic device 100 automatically photographs the image collected by the camera 193, to obtain a face image. It should be noted that the skin test button 311 in this embodiment of this application may also be referred to as a photographing button, and this embodiment of this application does not limit a name of the skin test button 311.

    [0101] In another possible example, the face image may alternatively be an image already stored in the electronic device.

    [0102] For example, after the face image is obtained, a facial feature location method is used, and the face image is further segmented to obtain the region of interest (ROI). During pore identifying, an ROI of pores includes the two cheeks on two sides of a face and a node region, as shown in FIG. 4A. During blackhead identifying, an ROI of blackheads includes a node region, as shown in FIG. 4B.

    [0103] S302. Divide the region of interest into a highlighted region and a non-highlighted region.

    [0104] For example, because light reflection on the face varies in the face image due to uneven light on the face, the region of interest is divided into the highlighted region and the non-highlighted region on this basis.

    [0105] S303. Separately determine a first segmentation threshold of the highlighted region and a second segmentation threshold of the non-highlighted region.

    [0106] S304. Obtain a binary image of the highlighted region based on the first segmentation threshold, and obtain a binary image of the non-highlighted region based on the second segmentation threshold.

    [0107] S305. Fuse the binary image of the highlighted region and the binary image of the non-highlighted region.

    [0108] S306. Identify, based on a fused image, pores and/or blackheads included in the region of interest.

    [0109] According to the skin detection method provided in this embodiment of this application, the region of interest is divided into the highlighted region and the non-highlighted region, the determined segmentation thresholds are allocated for the two regions, and binarization processing is performed on each region by using the segmentation threshold corresponding to the region. In comparison with a solution in which one segmentation threshold is determined for the region of interest, this can avoid impact of light on the segmentation thresholds, thereby improving accuracy in detecting pores and/or blackheads.

    [0110] In a possible implementation, in step S306, when pores and/or blackheads included in the region of interest are identified based on the fused image, corrosion and/or expansion processing may be first performed on the fused image; and the pores and/or the blackheads included in the region of interest are identified based on the fused image that has undergone the corrosion and/or expansion processing.

    [0111] It should be noted that the corrosion processing can eliminate boundary points of an object to reduce a target, and can eliminate noise points smaller than a structural element; and the expansion processing can combine all background points in contact with an object into the object, to enlarge a target, thereby filling in holes in the target.

    [0112] For example, corrosion-before-expansion processing may be performed on the fused image, or expansion-before-corrosion processing may be performed on the fused image. The corrosion-before-expansion processing can eliminate tiny noise on the image and smooth a boundary of an object. The expansion-before-corrosion processing can fill in tiny holes in the object and smooth the boundary of the object.

    [0113] In a possible implementation, step S302 of dividing the region of interest into a highlighted region and a non-highlighted region, that is, locating the highlighted region and the non-highlighted region, may be implemented in the following manner. As shown in FIG. 5A, the manner includes the following steps.

    [0114] S501. Perform first graying processing on the region of interest to obtain a first grayscale image.

    [0115] In a feasible example, grayscale transformation may be directly performed on the region of interest, to obtain the first grayscale image.

    [0116] For example, a grayscale transformation method may be linear transformation, piecewise linear transformation, nonlinear transformation, or the like.

    [0117] In another feasible example, the performing first graying processing on the region of interest may be implemented in the following manner:
    A1. Multiply a pixel value of a kth pixel included in the region of interest by a weight value corresponding to the kth pixel.

    [0118] The weight value corresponding to the kth pixel may be determined based on a corresponding grayscale value of the kth pixel in a second grayscale image of the region of interest, the second grayscale image of the region of interest is obtained by performing grayscale transformation on the region of interest, k takes all positive integers less than L, and L is a quantity of pixels included in the region of interest.

    [0119] For example, Wk represents the weight value corresponding to the kth pixel, and Wk = 1 - I_grayk/255, where I_grayk represents the grayscale value of the kth pixel in the second grayscale image of the region of interest.

    [0120] The second grayscale image of the region of interest may be obtained by performing grayscale transformation on the region of interest.

    A2. Perform grayscale transformation on an image that is obtained by multiplying each pixel included in the region of interest by a corresponding weight value, to obtain a third grayscale image.

    A3. Perform min-max normalization on the third grayscale image that is obtained through the transformation.

    A4. Perform grayscale inversion processing on the third grayscale image that is obtained through the min-max normalization, to obtain the first grayscale image.



    [0121] For example, to display the obtained highlighted region in white on a black backdrop, min-max normalization may be performed on the third grayscale image, to obtain a min-max normalized image of the third grayscale image, the min-max normalized image is subtracted from 255, and then grayscale inversion processing is performed. To subtract the min-max normalized image from 255 is to use a value obtained by subtracting a pixel value of a pixel in the min-max normalized image from 255, as a pixel value of the pixel.

    [0122] It should be noted that grayscale inversion is to perform a linear or nonlinear negation operation on a grayscale range of an image, to produce an image that is opposite to the input image in terms of grayscale.

    [0123] After the first graying processing in A1 to A4, the highlighted region is outlined, thereby increasing a degree of distinction between the highlighted region and the highlighted region.

    [0124] S502. Perform binarization processing on the first grayscale image to obtain a binary image of the first grayscale image.

    [0125] S503. Perform connected component analysis on the binary image of the first grayscale image to obtain at least one first connected component.

    [0126] S504. Filter out a connected component, of the at least one first connected component, whose area is less than a first preset threshold, to obtain the highlighted region, where a region other than the highlighted region in the region of interest is the non-highlighted region.

    [0127] For example, step S502 of performing connected component analysis on the binary image of the first grayscale image to obtain at least one first connected component may be implemented in the following manner:

    B1. Perform expansion and/or corrosion processing on the binary image of the first grayscale image.

    B2. Obtain at least one first connected component in the binary image that has undergone the expansion and/or corrosion processing.



    [0128] As shown in FIG. 5B, using an ROI of pores as an example, the white regions are located highlighted regions. Specifically, only the nose tip and the right cheek include highlighted regions, and other regions are non-highlighted regions.

    [0129] In a possible implementation, in step S303, the determining a first segmentation threshold of the highlighted region may be implemented in the following manner, as shown in FIG. 6A:

    S601a. Perform fourth graying processing on the region of interest to obtain a fourth grayscale image.

    S602a. Obtain a minimum grayscale value of an ith pixel included in the highlighted region in the fourth grayscale image and N neighboring pixels of the ith pixel, where i takes all positive integers less than or equal to M1, M1 is a quantity of pixels included in the highlighted region, and N is equal to a multiple of 4, to be specific, four neighbors, eighth neighbors, 16 neighbors, and the like are supported.



    [0130] As shown in FIG. 7A, four neighboring pixels of pixel p(x,y) include (x+l,y), (x-l,y), (x-l,y+l), and (x,y+1). As shown in FIG. 7B, eight neighboring pixels of pixel p(x,y) include (x+1,y), (x-1,y), (x,y+1), (x+1,y+1), (x+1,y-1), (x-1,y+1), and (x-1,y-1).

    [0131] S603a. Use an average value of M1 obtained minimum grayscale values as the first segmentation threshold.

    [0132] In a possible implementation, in step S303, the determining a first segmentation threshold of the non-highlighted region may be implemented in the following manner, as shown in FIG. 6B:

    S601b. Perform fourth graying processing on the region of interest to obtain a fourth grayscale image.

    S602b. Obtain a minimum grayscale value of a jth pixel included in the non-highlighted region in the fourth grayscale image and N neighboring pixels of the jth pixel, where j takes all positive integers less than or equal to M2, and M2 is a quantity of pixels included in the non-highlighted region.

    S603b. Use an average value of the M2 obtained minimum grayscale values as the second segmentation threshold.



    [0133] In a possible implementation, the performing fourth graying processing on the region of interest may include the following steps, as shown in FIG. 8A:

    S801. Perform grayscale transformation on the region of interest to obtain the second grayscale image.

    S802. Perform min-max normalization on the second grayscale image, that is, normalize pixels of the second grayscale image to [0,255].

    S803. Perform Gaussian differential filtering on the second grayscale image that has undergone the min-max normalization, to obtain a filtered image. That is, perform Gaussian filtering, of different degrees for two times, on the second grayscale image that has undergone the min-max normalization, and calculate a difference, to obtain a filtered image that is obtained after the Gaussian differential filtering.



    [0134] Pores or blackheads in the second grayscale image can be enhanced through the Gaussian differential filtering.

    [0135] S804. Perform min-max normalization on the filtered image.

    [0136] S805. Obtain a histogram of the filtered image that has undergone the min-max normalization, and based on the histogram of the filtered image, set a grayscale value of a first type of pixels in the filtered image to 0, and set a grayscale value of a second type of pixels in the filtered image to 255.

    [0137] The grayscale value of the first type of pixels is less than or equal to a minimum grayscale value of other pixels in the filtered image, a percentage of a quantity of the first type of pixels in a total quantity of pixels in the filtered image is a%, a grayscale value of the second type of pixels is greater than or equal to a maximum grayscale value of other pixels in the filtered image, a percentage of a quantity of the second type of pixels in the total quantity of pixels in the filtered image is b%, and a and b are both positive integers. The other pixels are pixels included in the filtered image other than the first type of pixels and the second type of pixels.

    [0138] A first type of pixels and a second type of pixels in an image are described by using the histogram shown in FIG. 8B as an example. For example, a total quantity of pixels in the image is 1000, and both a and b are 2. The first type of pixels includes one pixel whose grayscale value is 0, two pixels whose grayscale values are 1, three pixels whose grayscale values are 2, 10 pixels whose grayscale values are 3, and four pixels whose grayscale values are 4. There are six pixels whose grayscale values are 4. Therefore, any four pixels may be selected from the six pixels as the first type of pixels. A minimum grayscale value of other pixels is 4, and the grayscale values of the first type of pixels are all less than or equal to 4. The second type of pixels includes one pixel whose grayscale value is 255, 12 pixels whose grayscale values are 254, and seven pixels whose grayscale values are 253. A maximum grayscale value of other pixels is 252, and the grayscale values of the second type of pixels are all greater than 252.

    [0139] The inventor discovered, when conducting research concerning this application, that false detection of pores or blackheads in a nose shadow region occurs frequently. To reduce a false detection rate, the nose shadow region may be located, and the nose shadow region may be removed from the region of interest before blackheads and pores are determined. In view of this, when pores and/or blackheads included in the region of interest are identified based on the fused image, the nose shadow region may be removed from the fused image, and the pores and/or the blackheads included in the region of interest are determined based on the fused image from which the nose shadow region is removed.

    [0140] In a feasible example, the nose shadow region may be located in the following manner, as shown in FIG. 9:

    S901. Perform fourth graying processing on the region of interest to obtain a fourth grayscale image, and perform binarization processing on the fourth grayscale image to obtain a binary image of the fourth grayscale image. For a process of performing fourth graying processing on the region of interest, refer to the foregoing descriptions of FIG. 8A. Details are not described herein again.

    S902. Perform connected component analysis on the binary image of the fourth grayscale image to obtain at least one second connected component.



    [0141] Optionally, step S902 of performing connected component analysis on the binary image of the fourth grayscale image to obtain at least one second connected component may include: performing expansion and/or corrosion processing on the binary image of the fourth grayscale image; and obtaining at least one second connected component in the binary image, of the fourth grayscale image, that has undergone the expansion and/or corrosion processing. For example, expansion-before-corrosion processing or corrosion-before-expansion may be performed on the binary image of the fourth grayscale image.

    [0142] S903. Filter out a connected component, of the at least one second connected component, whose area is less than a second preset threshold, to obtain the nose shadow region.

    [0143] In a possible implementation, S304 of obtaining a binary image of the highlighted region based on the first segmentation threshold, and obtaining a binary image of the non-highlighted region based on the second segmentation threshold may be implemented in the following manner:
    performing fourth graying processing on the region of interest to obtain a fourth grayscale image; performing binarization processing on a corresponding highlighted region in the fourth grayscale image based on the first segmentation threshold, to obtain a binary image of the highlighted region; and performing binarization processing on a corresponding non-highlighted region in the fourth grayscale image based on the second segmentation threshold, to obtain a binary image of the non-highlighted region.

    [0144] It should be noted that, during the determining of the segmentation threshold of the highlighted region and the segmentation threshold of the non-highlighted region, the locating of the nose shadow region, and the obtaining of the binary image of the highlighted region and the binary image of the non-highlighted region, fourth graying processing may be performed on the region of interest, to obtain a fourth grayscale image. This operation may be performed only once in this embodiment of this application, and the fourth grayscale image is buffered and is fetched from the buffer when needed.

    [0145] In a possible implementation, step S306 of identifying, based on a fused image, pores and/or blackheads included in the region of interest may be implemented in the following manner:
    D1. Obtain at least one third connected component included in the fused image, and obtain a parameter corresponding to each third connected component, where the parameter includes at least one of the following: a radius, a degree of circularity, and an internal-external color variation value, and the degree of circularity is used to represent a degree of similarity between a shape of the third connected component and a circle.

    [0146] It should be noted that during the operation of removing the nose shadow region, the identifying, based on a fused image, pores and/or blackheads included in the region of interest includes: obtaining at least one third connected component included in the fused image from which the nose shadow region is removed.

    [0147] Connected component analysis is performed on the fused image; and a radius, a degree of circularity, or an internal-external color variation value of each third connected component is calculated and record.

    [0148] For example, Oi represents a degree of circularity of an ith third connected component, and Oi = 4Ď€ ∗ Area/Perimeter2. A shape of the third connected component is more likely a circle as Oi gets closer to 1. In the formula, the area is an area of the third connected component, and the perimeter is a perimeter of the third connected component.

    [0149] For example, an internal-external color variation value of the ith third connected component is represented by Vi.

    [0150] The internal-external color variation value of the third connected component may be determined in the following manner, without being limited to the following manner:
    In a first possible implementation:

    [0151] For the ith third connected component, minimum values (or average values), of all corresponding pixels of the third connected component in an original ROI image, respectively in three channels R, G, and B are calculated first and denoted as In R, In_G, and In_B. Then the ith third connected component is expanded outwardly by one circle (or N circles), and average values of pixels in the one circle (or the N circles) respectively in the three channels R, G, and B are calculated and denoted as Out_R, Out G, and Out B. Using the illustration in FIG. 10 as an example, the innermost rectangle represents a connected component. If the connected component is expanded by one circle, average values, of pixels covered by a rectangle in the middle, respectively in the channels R, G, and B may be calculated. If the connected component is expanded by two circles, average values, of pixels covered by a rectangle in the outermost circle, respectively in the channels R, G, and B may be calculated. Finally, for the ith third connected component, a value of (Out_R-In_R)+(Out_G-In_G)+(Out_B-In_B) is calculated and used as the internal-external color variation value of the connected component, that is, Vi = (OutR-InR) + (OutG-InG) + (Out_B-In_B).

    [0152] In a second possible implementation:
    A sum of internal-to-external color ratios of the third connected component in three channels is used as the internal-external color variation value of the third connected component: Vi = (In_R/Out_R) + (In_G/Out_G) + (In_B/Out_B).

    [0153] In a third possible implementation:
    A minimum value (or an average value) of grayscale values of all pixels, corresponding to each third connected component, in a grayscale image of the ROI (which may be the second grayscale image or the fourth grayscale image corresponding to the ROI) is calculated and denoted as In Gray. Then each third connected component is expanded outwardly by one circle (or N circles), and an average value of grayscale values of pixels in the one circle (or the N circles) is calculated and denoted as Out Gray. (Out Gray-In Gray) is calculated and used as the internal-external color variation value of the third connected component, that is, Vi = (Out_Gray-In_Gray).

    [0154] In a fourth possible implementation:
    An internal-to-external color ratio of a grayscale image of the ROI is calculated: In_Gray/Out_Gray, which is used as the internal-external color variation value of the third connected component, that is, Vi = In_Gray/Out_Gray.

    [0155] D2. Identify, based on the parameter corresponding to each third connected component, whether a location corresponding to the third connected component is a pore or a blackhead.

    [0156] Determination of an effective pore/blackhead: Based on the foregoing connected component analysis and calculation of various indicators: a pore is detected and a third connected component that meets a condition 1 is determined as a pore; and a blackhead is detected, and a third connected component that meets a condition 2 is determined as a blackhead. For example, the condition 1 may be as follows: A radius is within a range of [A1,B 1], an internal-external color variation value is greater than C1, and a degree of circularity is greater than D1; and the condition 2 may be as follows: A radius is within a range of [A2,B2], an internal-external color variation value is greater than C2, and a degree of circularity is greater than D2.

    [0157] After pores or blackheads included in the ROI are identified, a quantized score of the pores or blackheads may be calculated.

    [0158] For example, the quantized score of the pores may be determined in the following manner:
    processing an image corresponding to the identified pores to obtain a quantized pore indicator; calculating a quantized pore score of the region of interest based on the quantized pore indicator; and displaying the quantized pore score.

    [0159] The quantized pore indicator includes at least one of the following: a pore area ratio, a pore density, an average pore internal-external color variation value, and a ratio of a pore internal-external color variation value-weighted area; and
    the pore area ratio is a ratio of a total area of pores included in the region of interest to an area of the ROI. That is,

    . In the formula,

    represents the pore area ratio,

    represents an area of a jth pore, PO1 represents the area of the ROI, and n1 represents a quantity of pores.

    [0160] The pore density is a ratio of the quantity of pores included in the region of interest to the area of the region of interest. That is,

    , where

    represents the pore density.

    [0161] The average pore internal-external color variation value is an average value of internal-external color variation values of the pores included in the region of interest. That is,

    , where

    represents the average pore internal-external color variation value, and

    represents an internal-external color variation value of the jth pore.

    [0162] For a manner for determining an internal-external color variation value of a pore, refer to the descriptions of the manners for calculating an internal-external color variation value of a connected component.

    [0163] The ratio of the pore internal-external color variation value-weighted area is a ratio, to the area of the region of interest, of a sum that is obtained by adding all values obtained by multiplying, by a corresponding area, an internal-external color variation value of each pore included in the region of interest. That is,

    , where

    represents the ratio of the pore internal-external color variation value-weighted area.

    [0164] For example,

    , where w1 to w5 are weight values.

    [0165] For example, the quantized score of the blackheads may be determined in the following manner:
    processing an image corresponding to the identified blackheads to obtain a quantized blackhead indicator; and calculating a quantized blackhead score of the region of interest based on the quantized blackhead indicator.

    [0166] The quantized blackhead indicator includes at least one of the following a blackhead area ratio, a blackhead density, an average blackhead internal-external color variation value, and a ratio of a blackhead internal-external color variation value-weighted area.

    [0167] The blackhead area ratio is a ratio of a total area of blackheads included in the region of interest to the area of the ROI. That is,

    , where

    represents the blackhead area ratio,

    represents an area of a kth blackhead, PO1 represents the area of the ROI, and n2 represents a quantity of blackheads.

    [0168] The blackhead density is a ratio of the quantity of blackheads included in the region of interest to the area of the region of interest. That is,

    , where

    represents the blackhead density.

    [0169] The average blackhead internal-external color variation value is an average value of internal-external color variation values of the blackhead included in the region of interest. That is,

    , where

    represents the average blackhead internal-external color variation value, and

    represents an internal-external color variation value of the kth blackhead.

    [0170] For a manner for determining an internal-external color variation value of a blackhead, refer to the descriptions of the manners for calculating an internal-external color variation value of a connected component.

    [0171] The ratio of the blackhead internal-external color variation value-weighted area is a ratio, to the area of the region of interest, of a sum that is obtained by adding all values obtained by multiplying, by a corresponding area, an internal-external color variation value of each blackhead included in the region of interest. That is,



    , where

    represents the ratio of the blackhead internal-external color variation value-weighted area.

    [0172] For example,

    , where y1 to y5 are weight values.

    [0173] The following describes a skin detection process by using pore detection as an example, as shown in FIG. 11.

    [0174] Obtain an image: Obtain an ROI of pores, for example, as shown in FIG. 12A. Perform graying preprocessing on the ROI: perform fourth graying processing on the ROI of pores to obtain a fourth grayscale image of the ROI of pores, as shown in FIG. 12B. This may be implemented by using the process shown in FIG. 8A. Locate a highlighted region of the ROI of pores, that is, obtain a highlighted region mask, such as a highlighted region shown in FIG. 12C. This may be implemented by using the process shown in FIG. 5A. Locate a non-highlighted region of the ROI of pores. Based on the fourth grayscale image corresponding to the ROI of pores, determine a first segmentation threshold of the highlighted region, and determine a second segmentation threshold of the non-highlighted region. This may be implemented by using the processes shown in FIG. 6A and FIG. 6B. Perform, based on the first segmentation threshold, binarization processing on the fourth grayscale image corresponding to the ROI of pores, to obtain a binary image of the highlighted region, as shown in FIG. 12D. Perform, based on the second segmentation threshold, binarization processing on the fourth grayscale image of the ROI of pores, to obtain a binary image of the non-highlighted region, as shown in FIG. 12E. Fuse the binary image of the highlighted region and the binary image of the non-highlighted region, to obtain a fused image, as shown in FIG. 12F. Locate a nose shadow region based on the fourth grayscale image corresponding to the ROI of pores, to obtain a nose shadow region mask, as shown in FIG. 12G. Obtain the fused image from which the nose shadow region is removed, and determine a quantized score of pores based on pores included in an ROI in the fused image from which the nose shadow region is removed.

    [0175] FIG. 13A, FIG. 13B, and FIG. 13C show three examples of pore detection results. FIG. 14 shows four examples of blackhead detection results.

    [0176] In a possible implementation, for example, the processor 110 performs the skin detection method according to this application. After identifying pores and/or blackheads and determining a quantized pore score and a quantized blackhead score, the processor 110 may display the quantized pore score and the quantized blackhead score on the user interface presented on the display screen 194. For example, as shown in FIG. 2, the quantized blackhead score and the quantized pore score are displayed on the user interface presented on the display screen 194.

    [0177] After pores and/or blackheads are detected by using the skin detection method provided in this embodiment of this application, a detection result report may further be provided to a user. The detection result report may include but is not limited to the quantized pore score, the quantized blackhead score, skincare advice, a graphical result, and the like. A face image of the user may be displayed on the user interface presented on the display screen 194, and blackheads and pores are marked on the face image in different display manners. The detection result report may be a report presented on a user interface 1500 shown in FIG. 15. Presentation of the user interface 1500 may be triggered when the electronic device 100 detects that the user taps the virtual button 201 or 202 shown in FIG. 2, or may be triggered when the electronic device 100 detects that the user taps on a display region in which the quantized blackhead score or the quantized pore score is located on the user interface. Using the user interface 200 shown in FIG. 2 as an example, displaying of the user interface 1500 is triggered when the electronic device 100 detects that the user taps on a display region in which an entry "Blackheads 69 points" is located on the display screen 194. Certainly, presentation of the user interface 1500 may alternatively be triggered in another manner. A manner for triggering presentation of the user interface 1200 is not specifically limited in this embodiment of this application.

    [0178] The foregoing embodiments may be used in combination, or may be used independently.

    [0179] In the foregoing embodiment provided in this application, the method provided in this embodiment of this application is described from a perspective in which the electronic device is an execution body. To implement the functions in the method provided in this embodiment of this application, the electronic device may include a hardware structure and/or a software module, and implement the foregoing functions in a form of a hardware structure, a software module, or a combination of a hardware structure and a software module. Whether a specific function of the foregoing functions is implemented in a manner of a hardware structure, a software module, or a combination of a hardware structure and a software module depends on particular applications and design constraint conditions of the technical solutions.

    [0180] Based on the same concept, FIG. 16 shows an electronic device 1600 according to this application. For example, the electronic device 1600 includes at least one processor 1610 and a memory 1620, and may further include a display screen 1630 and a camera 1640. The processor 1610 is coupled to the memory 1620, and the display screen 1630 is coupled to the camera 1640. In this embodiment of this application, coupling is indirect coupling or communicative connection between apparatuses, units, or modules. The coupling may be in electrical, mechanical, or other forms, and is used to exchange information between the apparatuses, units, or modules.

    [0181] Specifically, the memory 1620 is configured to store a program instruction, the camera 1640 is configured to capture an image, and the display screen 1630 is configured to display a photographing preview interface when the camera 1640 is started for photographing, where the photographing preview interface includes an image collected by the camera 1640. The display screen 1630 may further be configured to display a user interface mentioned in the foregoing embodiment, for example, the user interface shown in FIG. 2, the interface shown in FIG. 4A, the user interface shown in FIG. 10, the user interface shown in FIG. 11, and the user interface shown in FIG. 12. The processor 1610 is configured to invoke and execute the program instruction stored in the memory 1620, to perform the steps in the skin detection method shown in FIG. 3A.

    [0182] It should be understood that the electronic device 1600 may be configured to implement the skin detection method shown in FIG. 3A according to the embodiments of this application. For related features, refer to the foregoing descriptions. Details are not described herein again.

    [0183] A person skilled in the art may clearly understand that the embodiments of this application may be implemented by hardware, firmware or a combination thereof. When the present invention is implemented by software, the foregoing functions may be stored in a computer-readable medium or transmitted as one or more instructions or code in the computer-readable medium. The computer-readable medium includes a computer storage medium and a communications medium, where the communications medium includes any medium that enables a computer program to be transmitted from one place to another. The storage medium may be any available medium accessible to a computer. By way of example and not limitation, the computer readable medium may include a RAM, a ROM, an electrically erasable programmable read only memory (electrically erasable programmable read only memory, EEPROM), a compact disc read-only memory (compact disc read-only memory, CD-ROM) or another compact disc memory, a magnetic disk storage medium or another magnetic storage device, or any other medium that can be used to carry or store expected program code having an instruction or data structure form and that can be accessed by a computer. In addition, any connection may be appropriately defined as a computer-readable medium. For example, if software is transmitted from a website, a server or another remote source by using a coaxial cable, an optical fiber/cable, a twisted pair, a digital subscriber line (digital subscriber line, DSL) or wireless technologies such as infrared ray, radio and microwave, the coaxial cable, optical fiber/cable, twisted pair, DSL or wireless technologies such as infrared ray, radio and microwave are included in fixation of a medium to which they belong. A disk (disk) and disc (disc) used by the embodiments of this application includes a compact disc (compact disc, CD), a laser disc, an optical disc, a digital video disc (digital video disc, DVD), a floppy disk and a Blu-ray disc, where the disk generally copies data by a magnetic means, and the disc copies data optically by a laser means. The foregoing combination should also be included in the protection scope of the computer-readable medium.


    Claims

    1. A computer implemented skin status detection method, comprising:

    obtaining (S301) a region of interest in a face image; characterized by

    dividing (S302) the region of interest into a highlighted region and a non-highlighted region based on a light reflection status on the face;

    separately determining (S303) a first segmentation threshold of the highlighted region and a second segmentation threshold of the non-highlighted region;

    obtaining (S304) a binary image of the highlighted region based on the first segmentation threshold, and obtaining a binary image of the non-highlighted region based on the second segmentation threshold;

    fusing (S305) the binary image of the highlighted region and the binary image of the non-highlighted region to obtain a fused image; and

    identifying,(S306) based on the fused image, pores and/or blackheads comprised in the region of interest.


     
    2. The method according to claim 1, wherein the dividing (S302) the region of interest into a highlighted region and a non-highlighted region comprises:

    performing (S501) first graying processing on the region of interest to obtain a first grayscale image;

    performing (S502) binarization processing on the first grayscale image to obtain a binary image of the first grayscale image;

    performing (S503) connected component analysis on the binary image of the first grayscale image to obtain at least one first connected component; and

    filtering (S504) out a connected component, of the at least one first connected component, whose area is less than a first preset threshold, to obtain the highlighted region, wherein

    a region other than the highlighted region in the region of interest is the non-highlighted region.


     
    3. The method according to claim 2, wherein the performing (S501) first graying processing on the region of interest to obtain a first grayscale image comprises:

    multiplying a pixel value of a kth pixel comprised in the region of interest by a weight value corresponding to the kth pixel, wherein the weight value corresponding to the kth pixel is determined based on a corresponding grayscale value of the kth pixel in a second grayscale image of the region of interest, the second grayscale image of the region of interest is obtained by performing grayscale transformation on the region of interest, k takes all positive integers less than L, and L is a quantity of pixels comprised in the region of interest;

    performing grayscale transformation on an image that is obtained by multiplying each pixel comprised in the region of interest by a corresponding weight value, to obtain a third grayscale image;

    performing min-max normalization on the third grayscale image that is obtained through the transformation; and

    performing grayscale inversion processing on the third grayscale image that is obtained through the min-max normalization, to obtain the first grayscale image.


     
    4. The method according to claim 2 or 3, wherein the performing (S503) connected component analysis on the binary image of the first grayscale image to obtain at least one first connected component comprises:

    performing expansion and/or corrosion processing on the binary image of the first grayscale image; and

    obtaining at least one first connected component in the binary image that has undergone the expansion and/or corrosion processing.


     
    5. The method according to any one of claims 1 to 4, wherein the determining (S303) a first segmentation threshold of the highlighted region comprises:
    performing (S601a) fourth graying processing on the region of interest to obtain a fourth grayscale image, and obtaining (S602a) a minimum grayscale value of an ith pixel comprised in the highlighted region in the fourth grayscale image and N neighboring pixels of the ith pixel, wherein i takes all positive integers less than or equal to M1, M1 is a quantity of pixels comprised in the highlighted region, and N is equal to a multiple of 4; and using (S603a) an average value of M1 obtained minimum grayscale values as the first segmentation threshold.
     
    6. The method according to any one of claims 1 to 4, wherein the determining (S303) a second segmentation threshold of the non-highlighted region comprises:
    performing fourth graying processing (S601b) on the region of interest to obtain a fourth grayscale image, and obtaining (S602b) a minimum grayscale value of a jth pixel comprised in the non-highlighted region in the fourth grayscale image and N neighboring pixels of the jth pixel, wherein j takes all positive integers less than or equal to M2, and M2 is a quantity of pixels comprised in the non-highlighted region; and using (S603b) an average value of M2 obtained minimum grayscale values as the second segmentation threshold.
     
    7. The method according to any one of claims 1 to 6, wherein the identifying (S306), based on the fused image, pores and/or blackheads comprised in the region of interest comprises:

    performing corrosion and/or expansion processing on the fused image; and

    identifying, based on the fused image that has undergone the corrosion and/or expansion processing, the pores and/or the blackheads comprised in the region of interest.


     
    8. The method according to any one of claims 1 to 7, wherein the identifying (S306), based on the fused image, pores and/or blackheads comprised in the region of interest comprises:
    removing a nose shadow region from the fused image; and determining, based on the fused image from which the nose shadow region is removed, the pores and/or the blackheads comprised in the region of interest.
     
    9. The method according to claim 8, wherein the nose shadow region is located in the following manner:

    performing (S901) fourth graying processing on the region of interest to obtain a fourth grayscale image, and performing binarization processing on the fourth grayscale image to obtain a binary image of the fourth grayscale image;

    performing (S902) connected component analysis on the binary image of the fourth grayscale image to obtain at least one second connected component; and

    filtering out (S903) a connected component, of the at least one second connected component, whose area is less than a second preset threshold, to obtain the nose shadow region.


     
    10. The method according to claim 9, wherein the performing (S902) connected component analysis on the binary image of the fourth grayscale image to obtain at least one second connected component comprises:

    performing expansion and/or corrosion processing on the binary image of the fourth grayscale image; and

    obtaining at least one second connected component in the binary image, of the fourth grayscale image, that has undergone the expansion and/or corrosion processing.


     
    11. The method according to any one of claims 5, 6, and 9, wherein the performing fourth (S601a, S601b, S901) graying processing on the region of interest to obtain a fourth grayscale image comprises:

    performing (S801) grayscale transformation on the region of interest to obtain the second grayscale image;

    performing (S802) min-max normalization on the second grayscale image;

    performing (S803) Gaussian differential filtering on the second grayscale image that has undergone the min-max normalization to obtain a filtered image;

    performing (S804) min-max normalization on the filtered image; and

    obtaining (S805) a histogram of the filtered image that has undergone the min-max normalization, and based on the histogram of the filtered image, setting a grayscale value of a first type of pixels in the filtered image to 0, and setting a grayscale value of a second type of pixels in the filtered image to 255, wherein

    the grayscale value of the first type of pixels is less than or equal to a minimum grayscale value of other pixels in the filtered image, a percentage of a quantity of the first type of pixels in a total quantity of pixels in the filtered image is a%, a grayscale value of the second type of pixels is greater than or equal to a maximum grayscale value of other pixels in the filtered image, a percentage of a quantity of the second type of pixels in the total quantity of pixels in the filtered image is b%, and a and b are both positive integers.


     
    12. The method according to any one of claims 1 to 11, wherein the identifying (S306), based on the fused image, pores and/or blackheads comprised in the region of interest comprises:

    obtaining at least one third connected component comprised in the fused image, and obtaining a parameter corresponding to each third connected component, wherein the parameter comprises at least one of the following: a radius, a degree of circularity, and an internal-external color variation value; and

    identifying, based on the parameter corresponding to each third connected component, whether a location corresponding to the third connected component is a pore or a blackhead, wherein

    the degree of circularity is used to represent a degree of similarity between a shape of the third connected component and a circle,

    and the internal-external color variation value is a difference or a ratio between an internal pixel value and an external pixel value that correspond to the third connected component at a location of the region of interest.


     
    13. The method according to any one of claims 1 to 12, wherein the method further comprises:

    processing an image corresponding to identified pores to obtain a quantized pore indicator; calculating a quantized pore score of the region of interest based on the quantized pore indicator; and displaying the quantized pore score, wherein

    the quantized pore indicator comprises at least one of the following: a pore area ratio, a pore density, an average pore internal-external color variation value, and a ratio of a pore internal-external color variation value-weighted area, wherein

    the pore area ratio is a ratio of a total area of pores comprised in the region of interest to an area of the region of interest, the pore density is a ratio of a quantity of pores comprised in the region of interest to the area of the region of interest, the average pore internal-external color variation value is an average value of internal-external color variation values of the pores comprised in the region of interest, and the ratio of the pore internal-external color variation value-weighted area is a ratio, to the area of the region of interest, of a sum that is obtained by adding all values obtained by multiplying, by a corresponding area, an internal-external color variation value of each pore comprised in the region of interest.


     
    14. The method according to any one of claims 1 to 13, wherein the method further comprises:

    processing an image corresponding to identified blackheads to obtain a quantized blackhead indicator; calculating a quantized blackhead score of the region of interest based on the quantized blackhead indicator; and displaying the quantized blackhead score, wherein

    the quantized blackhead indicator comprises at least one of the following: a blackhead area ratio, a blackhead density, an average blackhead internal-external color variation value, and a ratio of a blackhead internal-external color variation value-weighted area, wherein

    the blackhead area ratio is a ratio of a total area of blackheads comprised in the region of interest to the area of the region of interest, the blackhead density is a ratio of a quantity of blackheads comprised in the region of interest to the area of the region of interest, the average blackhead internal-external color variation value is an average value of internal-external color variation values of the blackheads comprised in the region of interest, and the ratio of the blackhead internal-external color variation value-weighted area is a ratio, to the area of the region of interest, of a sum that is obtained by adding all values obtained by multiplying, by a corresponding area, an internal-external color variation value of each blackhead comprised in the region of interest.


     
    15. An electronic device (1600), comprising a processor (1610) and a memory (1620), wherein the processor (1610) is coupled to the memory (1620);

    the memory (1620) is configured to store a program instruction; and

    the processor (1610) is configured to read the program instruction stored in the memory (1610), to implement the method according to any one of claims 1 to 14.


     


    Ansprüche

    1. Computerimplementiertes Hautstatuserkennungsverfahren, das Folgendes umfasst:

    Erhalten (S301) einer Region von Interesse in einem Gesichtsbild; gekennzeichnet durch

    Unterteilen (S302) der Region von Interesse in eine hervorgehobene Region und eine nicht hervorgehobene Region basierend auf einem Lichtreflexionsstatus auf dem Gesicht;

    separates Bestimmen (S303) einer ersten Segmentierungsschwelle der hervorgehobenen Region und einer zweiten Segmentierungsschwelle der nicht hervorgehobenen Region;

    Erhalten (S304) eines Binärbilds der hervorgehobenen Region basierend auf der ersten Segmentierungsschwelle und Erhalten eines Binärbilds der nicht hervorgehobenen Region basierend auf der zweiten Segmentierungsschwelle;

    Verschmelzen (S305) des Binärbilds der hervorgehobenen Region und des Binärbilds der nicht hervorgehobenen Region, um ein verschmolzenes Bild zu erhalten; und

    Identifizieren (S306), basierend auf dem verschmolzenen Bild, von Poren und/oder Mitessern, die in der Region von Interesse enthalten sind.


     
    2. Verfahren nach Anspruch 1, wobei das Unterteilen (S302) der Region von Interesse in eine hervorgehobene Region und eine nicht hervorgehobene Region Folgendes umfasst:

    Durchführen (S501) einer ersten Vergrauungsverarbeitung an der Region von Interesse, um ein erstes Graustufenbild zu erhalten;

    Durchführen (S502) einer Binärisierungsverarbeitung an dem ersten Graustufenbild, um ein Binärbild des ersten Graustufenbilds zu erhalten;

    Durchführen (S503) einer Analyse verbundener Komponenten an dem Binärbild des ersten Graustufenbilds, um wenigstens eine erste verbundene Komponente zu erhalten; und

    Herausfiltern (S504) einer verbundenen Komponente der wenigstens einen ersten verbundenen Komponente, deren Bereich kleiner als eine erste voreingestellte Schwelle ist, um die hervorgehobene Region zu erhalten, wobei

    eine andere Region als die hervorgehobene Region in der Region von Interesse die nicht hervorgehobene Region ist.


     
    3. Verfahren nach Anspruch 2, wobei das Durchführen (S501) der ersten Vergrauungsverarbeitung an der Region von Interesse, um ein erstes Graustufenbild zu erhalten, Folgendes umfasst:

    Multiplizieren eines Pixelwerts eines k-ten Pixels, das in der Region von Interesse enthalten ist, mit einem Gewichtungswert, der dem k-ten Pixel entspricht, wobei der Gewichtungswert, der dem k-ten Pixel entspricht, basierend auf einem entsprechenden Graustufenwert des k-ten Pixels in einem zweiten Graustufenbild der Region von Interesse bestimmt wird, das zweite Graustufenbild der Region von Interesse mittels Durchführens einer Graustufentransformation an der Region von Interesse erhalten wird, k alle positiven ganzen Zahlen einnimmt, die kleiner als L sind und L eine Menge von Pixeln ist, die in der Region von Interesse enthalten sind;

    Durchführen der Graustufentransformation an einem Bild, das mittels Multiplizierens jedes Pixels, das in der Region von Interesse enthalten ist, mit einem entsprechenden Gewichtungswert erhalten wird, um ein drittes Graustufenbild zu erhalten;

    Durchführen einer Min-Max-Normalisierung an dem dritten Graustufenbild, das durch die Transformation erhalten wird; und

    Durchführen einer Graustufeninversionsverarbeitung an dem dritten Graustufenbild, das durch die Min-Max-Normalisierung erhalten wird, um das erste Graustufenbild zu erhalten.


     
    4. Verfahren nach Anspruch 2 oder 3, wobei das Durchführen (S503) der Analyse verbundener Komponenten an dem Binärbild des ersten Graustufenbilds, um wenigstens eine erste verbundene Komponente zu erhalten, Folgendes umfasst:

    Durchführen einer Expansions- und/oder Korrosionsverarbeitung an dem Binärbild des ersten Graustufenbilds; und

    Erhalten wenigstens einer ersten verbundenen Komponente in dem Binärbild, das der Expansions- und/oder Korrosionsverarbeitung unterzogen wurde.


     
    5. Verfahren nach einem der Ansprüche 1 bis 4, wobei das Bestimmen (S303) einer ersten Segmentierungsschwelle der hervorgehobenen Region Folgendes umfasst:
    Durchführen (S601a) einer vierten Vergrauungsverarbeitung an der Region von Interesse, um ein viertes Graustufenbild zu erhalten, und Erhalten (S602a) eines Minimumgraustufenwerts eines i-ten Pixels, das in der hervorgehobenen Region in dem vierten Graustufenbild enthalten ist und N benachbarter Pixel des i-ten Pixels, wobei i alle positiven ganzen Zahlen einnimmt, die kleiner als oder gleich M1 sind, M1 eine Menge von Pixeln ist, die in der hervorgehobenen Region enthalten sind und N gleich einem Vielfachen von 4 ist; und Verwenden (S603a) eines Durchschnittswerts von M1 erhaltenen Minimumgraustufenwerten als die erste Segmentierungsschwelle.
     
    6. Verfahren nach einem der Ansprüche 1 bis 4, wobei das Bestimmen (S303) einer zweiten Segmentierungsschwelle der nicht hervorgehobenen Region Folgendes umfasst:
    Durchführen einer vierten Vergrauungsverarbeitung (S601b) an der Region von Interesse, um ein viertes Graustufenbild zu erhalten, und Erhalten (S602b) eines Minimumgraustufenwerts eines j-ten Pixels, das in der nicht hervorgehobenen Region in dem vierten Graustufenbild enthalten ist und N benachbarter Pixel des j-ten Pixels, wobei j alle positiven ganzen Zahlen einnimmt, die kleiner als oder gleich M2 sind und M2 eine Menge von Pixeln ist, die in der nicht hervorgehobenen Region enthalten sind; und Verwenden (S603b) eines Durchschnittswerts von M2 erhaltenen Minimumgraustufenwerten als die zweite Segmentierungsschwelle.
     
    7. Verfahren nach einem der Ansprüche 1 bis 6, wobei das Identifizieren (S306), basierend auf dem verschmolzenen Bild, von Poren und/oder Mitessern, die in der Region von Interesse enthalten sind, Folgendes umfasst:

    Durchführen der Korrosions- und/oder Expansionsverarbeitung an dem verschmolzenen Bild; und

    Identifizieren, basierend auf dem verschmolzenen Bild, das der Korrosions- und/oder Expansionsverarbeitung unterzogen wurde, der Poren und/oder der Mitesser, die in der Region von Interesse enthalten sind.


     
    8. Verfahren nach einem der Ansprüche 1 bis 7, wobei das Identifizieren (S306), basierend auf dem verschmolzenen Bild, von Poren und/oder Mitessern, die in der Region von Interesse enthalten sind, Folgendes umfasst:
    Entfernen einer Nasenschattenregion von dem verschmolzenen Bild; und Bestimmen, basierend auf dem verschmolzenen Bild, von dem die Nasenschattenregion entfernt wird, der Poren und/oder der Mitesser, die in der Region von Interesse enthalten sind.
     
    9. Verfahren nach Anspruch 8, wobei die Nasenschattenregion auf folgende Weise gefunden wird:

    Durchführen (S901) der vierten Vergrauungsverarbeitung an der Region von Interesse, um ein viertes Graustufenbild zu erhalten, und Durchführen einer Binärisierungsverarbeitung an dem vierten Graustufenbild, um ein Binärbild des vierten Graustufenbilds zu erhalten;

    Durchführen (S902) der Analyse verbundener Komponenten an dem Binärbild des vierten Graustufenbilds, um wenigstens eine zweite verbundene Komponente zu erhalten; und

    Herausfiltern (S903) einer verbundenen Komponente der wenigstens einen zweiten verbundenen Komponente, deren Bereich kleiner als eine zweite voreingestellte Schwelle ist, um die Nasenschattenregion zu erhalten.


     
    10. Verfahren nach Anspruch 9, wobei das Durchführen (S902) der Analyse verbundener Komponenten an dem Binärbild des vierten Graustufenbilds, um wenigstens eine zweite verbundene Komponente zu erhalten, Folgendes umfasst:

    Durchführen der Expansions- und/oder Korrosionsverarbeitung an dem Binärbild des vierten Graustufenbilds; und

    Erhalten wenigstens einer zweiten verbundenen Komponente in dem Binärbild des vierten Graustufenbilds, das der Expansions- und/oder Korrosionsverarbeitung unterzogen wurde.


     
    11. Verfahren nach einem der Ansprüche 5, 6 und 9, wobei das Durchführen einer vierten (S601a, S601b, S901) Vergrauungsverarbeitung an der Region von Interesse, um ein viertes Graustufenbild zu erhalten, Folgendes umfasst:

    Durchführen (S801) der Graustufentransformation an der Region von Interesse, um das zweite Graustufenbild zu erhalten;

    Durchführen (S802) der Min-Max-Normalisierung an dem zweiten Graustufenbild;

    Durchführen (S803) einer Gaußschen Differentialfilterung an dem zweiten Graustufenbild, das der Min-Max-Normalisierung unterzogen wurde, um ein gefiltertes Bild zu erhalten;

    Durchführen (S804) der Min-Max-Normalisierung an dem gefilterten Bild; und

    Erhalten (S805) eines Histogramms des gefilterten Bilds, das der Min-Max-Normalisierung unterzogen wurde, und basierend auf dem Histogramm des gefilterten Bilds, Einstellen eines Graustufenwerts einer ersten Pixelart in dem gefilterten Bild auf 0 und Einstellen eines Graustufenwerts einer zweiten Pixelart in dem gefilterten Bild auf 255, wobei

    der Graustufenwert der ersten Pixelart kleiner als oder gleich einem Minimumgraustufenwert anderer Pixel in dem gefilterten Bild ist, ein Prozentsatz einer Menge der ersten Pixelart in einer Gesamtmenge von Pixeln in dem gefilterten Bild a % ist, ein Graustufenwert der zweiten Pixelart größer als oder gleich einem Maximumgraustufenwert anderer Pixel in dem gefilterten Bild ist, ein Prozentsatz einer Menge der zweiten Pixeltart in der Gesamtmenge von Pixeln in dem gefilterten Bild b % ist, und a und b beide positive ganze Zahlen sind.


     
    12. Verfahren nach einem der Ansprüche 1 bis 11, wobei das Identifizieren (S306), basierend auf dem verschmolzenen Bild, von Poren und/oder Mitessern, die in der Region von Interesse enthalten sind, Folgendes umfasst:

    Erhalten wenigstens einer dritten verbundenen Komponente, die in dem verschmolzenen Bild enthalten ist, und Erhalten eines Parameters, der jeder dritten verbundenen Komponente entspricht, wobei der Parameter Folgendes umfasst: einen Radius, einen Grad der Zirkularität und/oder einen internen-externen Farbvariationswert; und

    Identifizieren, basierend auf dem Parameter, der jeder dritten verbundenen Komponente entspricht, ob eine Stelle, die der dritten verbundenen Komponente entspricht, eine Pore oder ein Mitesser ist, wobei

    der Grad der Zirkularität verwendet wird, um einen Grad der Ähnlichkeit zwischen einer Form der dritten verbundenen Komponente und einem Kreis darzustellen,

    und der interne-externe Farbvariationswert eine Differenz oder ein Verhältnis zwischen einem internen Pixelwert und einem externen Pixelwert ist, die der dritten verbundenen Komponente an einer Stelle der Region von Interesse entsprechen.


     
    13. Verfahren nach einem der Ansprüche 1 bis 12, wobei das Verfahren ferner Folgendes umfasst:

    Verarbeiten eines Bilds, das identifizierten Poren entspricht, um einen quantisierten Porenkennzeichner zu erhalten; Berechnen einer quantisierten Porenbewertung der Region von Interesse basierend auf dem quantisierten Porenkennzeichner; und Anzeigen der quantisierten Porenbewertung, wobei

    der quantisierte Porenkennzeichner Folgendes umfasst: ein Porenbereichsverhältnis, eine Porendichte, einen durchschnittlichen internen-externen Farbvariationswert der Pore und/oder ein Verhältnis eines wertgewichteten Bereichs des internen-externen Farbvariationswert einer Pore, wobei

    das Porenbereichsverhältnis ein Verhältnis eines Gesamtbereichs von Poren ist, die in der Region von Interesse enthalten sind, die Porendichte ein Verhältnis einer Menge von Poren ist, die in der Region von Interesse zu dem Bereich der Region von Interesse enthalten sind, der durchschnittliche interne-externe Farbvariationswert der Pore ein Durchschnittswert von internen-externen Farbvariationswerten der Poren ist, die in der Region von Interesse enthalten sind, und das Verhältnis eines wertgewichteten Bereichs des internen-externen Farbvariationswerts der Pore ein Verhältnis, zu dem Bereich der Region von Interesse, einer Summe ist, die mittels Addierens aller Werte erhalten wird, die mittels Multiplizierens mit einem entsprechenden Bereich, eines internen-externen Farbvariationswerts jeder Pore, die in der Region von Interesse enthalten ist, erhalten werden.


     
    14. Verfahren nach einem der Ansprüche 1 bis 13, wobei das Verfahren ferner Folgendes umfasst:

    Verarbeiten eines Bilds, das identifizierten Mitessern entspricht, um einen quantisierten Mitesserkennzeichner zu erhalten; Berechnen einer quantisierten Mitesserbewertung der Region von Interesse basierend auf dem quantisierten Mitesserkennzeichner; und Anzeigen der quantisierten Mitesserbewertung, wobei

    der quantisierte Mitesserkennzeichner Folgendes umfasst: ein Mitesserbereichsverhältnis, eine Mitesserdichte, einen durchschnittlichen internern-externern Farbvariationswert des Mitessers und/oder ein Verhältnis eines wertgewichteten Bereichs des internen-externen Farbvariationswerts eines Mitessers; wobei

    das Mitesserbereichsverhältnis ein Verhältnis eines Gesamtbereichs von Mitessern ist, die in der Region von Interesse enthalten sind, die Mitesserdichte ein Verhältnis einer Menge von Mitessern ist, die in der Region von Interesse zu dem Bereich der Region von Interesse enthalten sind, der durchschnittliche interne-externe Farbvariationswert des Mitessers ein Durchschnittswert von internen-externen Farbvariationswerten der Mitesser ist, die in der Region von Interesse enthalten sind, und das Verhältnis eines wertgewichteten Bereichs des internen-externen Farbvariationswerts des Mitessers ein Verhältnis, zu dem Bereich der Region von Interesse, einer Summe ist, die mittels Addierens aller Werte erhalten wird, die mittels Multiplizierens mit einem entsprechenden Bereich, eines internen-externen Farbvariationswerts jedes Mitessers, der in der Region von Interesse enthalten ist, erhalten werden.


     
    15. Elektronische Vorrichtung (1600), die einen Prozessor (1610) und einen Speicher (1620) umfasst, wobei der Prozessor (1610) mit dem Speicher (1620) gekoppelt ist;

    der Speicher (1620) konfiguriert ist, um eine Programmanweisung zu speichern; und

    der Prozessor (1610) konfiguriert ist, um die in dem Speicher (1610) gespeicherte Programmanweisung zu lesen, um das Verfahren nach einem der Ansprüche 1 bis 14 zu implementieren.


     


    Revendications

    1. Procédé de détection de l'état de la peau mis en Ĺ“uvre par ordinateur, comprenant :

    l'obtention (S301) d'une région d'intérêt dans une image de visage ; caractérisé par

    la division (S302) de la région d'intérêt en une région mise en évidence et une région non mise en évidence sur la base d'un état de réflexion de la lumière sur le visage ;

    la détermination séparément (S303) d'un premier seuil de segmentation de la région mise en évidence et un second seuil de segmentation de la région non mise en évidence ;

    l'obtention (S304) d'une image binaire de la région mise en évidence sur la base du premier seuil de segmentation, et l'obtention d'une image binaire de la région non mise en évidence sur la base du second seuil de segmentation ;

    la fusion (S305) de l'image binaire de la région mise en évidence et l'image binaire de la région non mise en évidence pour obtenir une image fusionnée ; et

    l'identification, (S306) sur la base de l'image fusionnée, des pores et/ou des points noirs compris dans la région d'intérêt.


     
    2. Procédé selon la revendication 1, la division (S302) de la région d'intérêt en une région mise en évidence et une région non mise en évidence comprenant :

    la réalisation (S501) d'un premier traitement de grisonnement sur la région d'intérêt pour obtenir une première image en échelle de gris ;

    la réalisation (S502) d'un traitement de binarisation sur la première image en échelle de gris pour obtenir une image binaire de la première image en échelle de gris ;

    la réalisation (S503) d'une analyse de composant connecté sur l'image binaire de la première image en échelle de gris pour obtenir au moins un premier composant connecté ; et

    le filtrage (S504) d'un composant connecté, de l'au moins un premier composant connecté, dont la zone est inférieure à un premier seuil prédéfini, pour obtenir la région mise en évidence,

    une région autre que la région mise en évidence dans la région d'intérêt est la région non mise en évidence.


     
    3. Procédé selon la revendication 2, l'exécution (S501) du premier traitement de grisonnement sur la région d'intérêt pour obtenir une première image en échelle de gris comprenant :

    la multiplication d'une valeur de pixel d'un kème pixel compris dans la région d'intérêt par une valeur de poids correspondant au kème pixel, la valeur de poids correspondant au kème pixel étant déterminée sur la base d'une valeur d'échelle de gris correspondante du kème pixel dans une deuxième image en échelle de gris de la région d'intérêt, la deuxième image en échelle de gris de la région d'intérêt est obtenue en effectuant une transformation en échelle de gris sur la région d'intérêt, k prend tous les nombres entiers positifs inférieurs à L, et L est une quantité de pixels comprise dans la région d'intérêt ;

    la réalisation d'une transformation en échelle de gris sur une image qui est obtenue en multipliant chaque pixel compris dans la région d'intérêt par une valeur de poids correspondante, pour obtenir une troisième image en échelle de gris ;

    la réalisation d'une normalisation min-max sur la troisième image en échelle de gris obtenue par la transformation ; et

    l'exécution d'un traitement d'inversion en niveaux de gris sur la troisième image en niveaux de gris qui est obtenue par la normalisation min-max, pour obtenir la première image en niveaux de gris.


     
    4. Procédé selon la revendication 2 ou 3, l'exécution (S503) de l'analyse de composant connecté sur l'image binaire de la première image en échelle de gris pour obtenir au moins un premier composant connecté comprenant :

    la réalisation d'un traitement d'expansion et/ou de corrosion sur l'image binaire de la première image en échelle de gris ; et

    l'obtention d'au moins un premier composant connecté dans l'image binaire qui a subi le traitement d'expansion et/ou de corrosion.


     
    5. Procédé selon l'une quelconque des revendications 1 à 4, la détermination (S303) d'un premier seuil de segmentation de la région mise en évidence comprenant :
    la réalisation (S601a) d'un quatrième traitement de grisonnement sur la région d'intérêt pour obtenir une quatrième image en échelle de gris, et l'obtention (S602a) d'une valeur d'échelle de gris minimale d'un ième pixel compris dans la région mise en évidence dans la quatrième image en échelle de gris et N pixels voisins du ième pixel, i prenant tous les nombres entiers positifs inférieurs ou égaux à M1, M1 étant une quantité de pixels comprise dans la région mise en évidence, et N étant égal à un multiple de 4 ; et l'utilisation (S603a) d'une valeur moyenne de M1 ayant obtenu des valeurs d'échelle de gris minimales comme premier seuil de segmentation.
     
    6. Procédé selon l'une quelconque des revendications 1 à 4, la détermination (S303) d'un second seuil de segmentation de la région non mise en évidence comprenant :
    l'exécution d'un quatrième traitement de grisonnement (S601b) sur la région d'intérêt pour obtenir une quatrième image en échelle de gris, et l'obtention (S602b) d'une valeur d'échelle de gris minimale d'un jème pixel compris dans la région non mise en évidence dans la quatrième image en échelle de gris et N pixels voisins du jème pixel, j prenant tous les nombres entiers positifs inférieurs ou égaux à M2, et M2 étant une quantité de pixels comprise dans la région non mise en évidence ; et l'utilisation (S603b) d'une valeur moyenne de M2 a obtenu des valeurs d'échelle de gris minimales comme second seuil de segmentation.
     
    7. Procédé selon l'une quelconque des revendications 1 à 6, l'identification (S306), sur la base de l'image fusionnée, des pores et/ou des points noirs compris dans la région d'intérêt comprenant :

    la réalisation d'un traitement de corrosion et/ou d'expansion sur l'image fusionnée ; et

    l'identification, sur la base de l'image fusionnée qui a subi le traitement de corrosion et/ou d'expansion, les pores et/ou les points noirs compris dans la région d'intérêt.


     
    8. Procédé selon l'une quelconque des revendications 1 à 7, l'identification (S306), sur la base de l'image fusionnée, des pores et/ou des points noirs compris dans la région d'intérêt comprenant :
    l'élimination d'une région d'ombre de nez de l'image fusionnée ; et la détermination, sur la base de l'image fusionnée à partir de laquelle la région d'ombre du nez est retirée, des pores et/ou des points noirs compris dans la région d'intérêt.
     
    9. Procédé selon la revendication 8, la région d'ombre de nez étant située de la manière suivante :

    la réalisation (S901) d'un quatrième traitement de grisonnement sur la région d'intérêt pour obtenir une quatrième image en échelle de gris, et la réalisation d'un traitement de binarisation sur la quatrième image en échelle de gris pour obtenir une image binaire de la quatrième image en échelle de gris ;

    la réalisation (S902) d'une analyse de composant connecté sur l'image binaire de la quatrième image en échelle de gris pour obtenir au moins un second composant connecté ; et

    le filtrage (S903) d'un composant connecté de l'au moins un second composant connecté, dont la zone est inférieure à un second seuil prédéfini, pour obtenir la région d'ombre de nez.


     
    10. Procédé selon la revendication 9, l'exécution (S902) de l'analyse de composant connecté sur l'image binaire de la quatrième image en échelle de gris pour obtenir au moins un second composant connecté comprend :

    la réalisation d'un traitement d'expansion et/ou de corrosion sur l'image binaire de la quatrième image en échelle de gris ; et

    l'obtention d'au moins un second composant connecté dans l'image binaire, de la quatrième image en échelle de gris, qui a subi le traitement d'expansion et/ou de corrosion.


     
    11. Procédé selon l'une quelconque des revendications 5, 6 et 9, le quatrième traitement (S601a, S601b, S901) de grisonnement sur la région d'intérêt pour obtenir une quatrième image en échelle de gris comprenant :

    la réalisation (S801) d'une transformation en échelle de gris sur la région d'intérêt pour obtenir la deuxième image en échelle de gris ;

    la réalisation (S802) d'une normalisation min-max sur la deuxième image en échelle de gris ;

    la réalisation (S803) d'un filtrage différentiel gaussien sur la deuxième image en échelle de gris qui a subi la normalisation min-max pour obtenir une image filtrée ;

    la réalisation (S804) d'une normalisation min-max sur l'image filtrée ; et

    l'obtention (S805) d'un histogramme de l'image filtrée qui a subi la normalisation min-max, et en fonction de l'histogramme de l'image filtrée, la définition d'une valeur d'échelle de gris d'un premier type de pixels dans l'image filtrée sur 0, et la définition d'une valeur d'échelle de gris d'un second type de pixels dans l'image filtrée sur 255,

    la valeur d'échelle de gris du premier type de pixels étant inférieure ou égale à une valeur d'échelle de gris minimale d'autres pixels dans l'image filtrée, un pourcentage d'une quantité du premier type de pixels dans une quantité totale de pixels dans l'image filtrée est un %, une valeur d'échelle de gris du second type de pixels étant supérieure ou égale à une valeur d'échelle de gris maximale d'autres pixels dans l'image filtrée, un pourcentage d'une quantité du second type de pixels dans la quantité totale de pixels dans l'image filtrée étant b%, et a et b étant tous deux des entiers positifs.


     
    12. Procédé selon l'une quelconque des revendications 1 à 11, l'identification (S306), sur la base de l'image fusionnée, des pores et/ou des points noirs compris dans la région d'intérêt comprenant :

    l'obtention d'au moins un troisième composant connecté compris dans l'image fusionnée et l'obtention d'un paramètre correspondant à chaque troisième composant connecté, le paramètre comprenant au moins l'un des éléments suivants : un rayon, un degré de circularité et une valeur de variation de couleur interne-externe ; et

    l'identification, en fonction du paramètre correspondant à chaque troisième composant connecté, si un emplacement correspondant au troisième composant connecté est un pore ou un point noir,

    le degré de circularité étant utilisé pour représenter un degré de similitude entre une forme du troisième composant connecté et un cercle,

    et la valeur de variation de couleur interne-externe étant une différence ou un rapport entre une valeur de pixel interne et une valeur de pixel externe qui correspondent au troisième composant connecté à un emplacement de la région d'intérêt.


     
    13. Procédé selon l'une quelconque des revendications 1 à 12, le procédé comprenant en outre :

    le traitement d'une image correspondant à des pores identifiés pour obtenir un indicateur de pore quantifié ; le calcul d'un score de pore quantifié de la région d'intérêt sur la base de l'indicateur de pore quantifié ; et l'affichage du score de pore quantifié,

    l'indicateur de pore quantifié comprenant au moins l'un des éléments suivants : un rapport de surface de pore, une densité de pore, une valeur moyenne de variation de couleur interne-externe de pore et un rapport d'une zone pondérée de valeur de variation de couleur interne-externe de pore,

    le rapport de surface de pores étant un rapport d'une surface totale de pores comprise dans la région d'intérêt à une aire de la région d'intérêt, la densité de pores étant un rapport d'une quantité de pores comprise dans la région d'intérêt à la zone de la région d'intérêt, la valeur moyenne de variation de couleur interne-externe des pores étant une valeur moyenne des valeurs de variation de couleur interne-externe des pores compris dans la région d'intérêt, et le rapport de la zone pondérée de la valeur de variation de couleur interne-externe des pores étant un rapport, à la zone de la région d'intérêt, d'une somme qui est obtenue en ajoutant toutes les valeurs obtenues en multipliant, par une zone correspondante, une valeur de variation de couleur interne-externe de chaque pore compris dans la région d'intérêt.


     
    14. Procédé selon l'une quelconque des revendications 1 à 13, le procédé comprenant en outre :

    le traitement d'une image correspondant à des points noirs identifiés pour obtenir un indicateur de points noirs quantifiés ; le calcul d'un score de points noirs quantifié de la région d'intérêt sur la base de l'indicateur de points noirs quantifiés ; et l'affichage du score de points noirs quantifié,

    l'indicateur de points noirs quantifiés comprenant au moins l'un des éléments suivants : un rapport de zone de points noirs, une densité de points noirs, une valeur moyenne de variation de couleur interne-externe de points noirs et un rapport d'une zone pondérée par la valeur de variation de couleur interne-externe de points noirs,

    le rapport de la zone de points noirs étant un rapport d'une zone totale de points noirs comprise dans la région d'intérêt à la zone de la région d'intérêt, la densité de points noirs étant un rapport d'une quantité de points noirs compris dans la région d'intérêt à la zone de la région d'intérêt, la valeur moyenne de variation de couleur interne-externe des points noirs est une valeur moyenne des valeurs de variation de couleur interne-externe des points noirs compris dans la région d'intérêt, et le rapport de la zone pondérée de la valeur de variation de couleur interne-externe des points noirs est un rapport, à la zone de la région d'intérêt, d'une somme qui est obtenue en ajoutant toutes les valeurs obtenues en multipliant, par une zone correspondante, une valeur de variation de couleur interne-externe de chaque point noir compris dans la région d'intérêt.


     
    15. Dispositif électronique (1600), comprenant un processeur (1610) et une mémoire (1620), le processeur (1610) étant couplé à la mémoire (1620) ;

    la mémoire (1620) étant configurée pour stocker une instruction de programme ; et

    le processeur (1610) étant configuré pour lire l'instruction de programme stockée dans la mémoire (1610), pour mettre en oeuvre le procédé selon l'une quelconque des revendications 1 à 14.


     




    Drawing



























































    Cited references

    REFERENCES CITED IN THE DESCRIPTION



    This list of references cited by the applicant is for the reader's convenience only. It does not form part of the European patent document. Even though great care has been taken in compiling the references, errors or omissions cannot be excluded and the EPO disclaims all liability in this regard.

    Patent documents cited in the description