Pigment detection method and electronic device

A pigment detection method includes: extracting a first image from a to-be-detected RGB skin image, where the first image is used to represent a body reflection component in the RGB skin image, and the RGB skin image is photographed by a device having an RGB image photographing function; extracting a pigment from an R channel, a B channel, and a G channel of the first image based on a correspondence between a first spectral response curve of the pigment and a second spectral response curve of the device having the RGB image photographing function; and generating a pseudo-color image based on the extracted pigment, and displaying the pseudo-color image.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a National Stage of International Application No. PCT/CN2018/106216, filed on Sep. 18, 2018, which claims priority to Chinese Patent Application No. 201810776213.1, filed on Jul. 16, 2018, both of which are hereby incorporated by reference in their entireties.

TECHNICAL FIELD

This application relates to the field of terminal technologies, and in particular, to a pigment detection method and an electronic device.

BACKGROUND

Skin pigment distribution is directly related to skin appearance and many skin problems. For example, uneven distribution of melanin leads to skin problems such as chloasma, freckles, and sunburn. For another example, a change in hemoglobin content is directly related to acne, sensitive skin, inflammation, and angiotelectasis. Therefore, accurate detection of skin pigment not only plays an important role in research and test of effectiveness of skin care products and skin care instruments, but also provides important guidance for consumers' daily beauty treatment and skin care.

Currently, skin pigment can be detected using an application on a mobile terminal. A common skin pigment detection manner includes: performing offline training by using skin images that feature different skin colors and that are acquired in different scenarios, to obtain a detection model used to separate a skin pigment; and performing detection on a test image using the detection model to separate a skin pigment. Because mobile detection scenarios vary greatly, it is impossible to acquire skin images in all scenarios for training. Therefore, the detection model is ill-suited to skin pigment detection performed in a scenario of complex variables. As a result, the prior art detection model has poor applicability.

SUMMARY

This application provides a pigment detection method and an electronic device, to resolve a problem of poor applicability of an existing skin pigment detection technology.

According to a first aspect, an embodiment of this application provides a pigment detection method. The method includes: extracting a first image from a to-be-detected RGB skin image, where the first image is used to represent a body reflection component in the RGB skin image, and the RGB skin image is photographed by a device having an RGB image photographing function; extracting a pigment from an R channel, a B channel, and a G channel of the first image based on a correspondence between a first spectral response curve of the pigment and a second spectral response curve of the device having the RGB image photographing function; and generating a pseudo-color image based on the extracted pigment, and displaying the pseudo-color image.

Based on this solution, the first image is extracted from the to-be-detected RGB skin image, where the first image is used to represent the body reflection component in the RGB skin image, and the RGB skin image is photographed by the device having the RGB image photographing function. Further, the pigment is extracted from the first image based on the relationship between the first spectral response curve of the pigment and the second spectral response curve of the device having the RGB image photographing function. In this way, pigment extraction is performed based on the spectral response relationship, so that pigments in RGB skin images photographed in different scenarios can be detected, avoiding a case in the prior art in which pigment detection can be performed only after training is performed in advance by using skin images acquired in different scenarios. Therefore, pigment detection based on this solution has relatively good applicability.

Further, to improve fidelity of the first image extracted from the RGB skin image, in a possible implementation, the to-be-detected RGB skin image is converted into a first Lab image; a body reflection component is extracted from each of an L channel, an a channel, and a b channel of the first Lab image; the body reflection components extracted from the L channel, the a channel, and the b channel of the first Lab image are combined to obtain a second Lab image; and the second Lab image is converted into an RGB image to obtain the first image.

In this manner, the body reflection components are extracted, so that color-related information (the a channel and the b channel) and color-unrelated information (the L channel) can be separated, to separately process the color-related information, thereby helping improve the fidelity of the first image.

In a possible design, the body reflection component of the L channel of the first Lab image is a difference between an initial value of the L channel of the first Lab image and a surface reflection component of the L channel of the first Lab image; the body reflection component of the a channel of the first Lab image is a difference between an initial value of the a channel of the first Lab image and a surface reflection component of the a channel of the first Lab image; the body reflection component of the b channel of the first Lab image is a difference between an initial value of the b channel of the first Lab image and a surface reflection component of the b channel of the first Lab image; and the surface reflection components of the L channel, the a channel, and the b channel of the first Lab image are obtained by separately performing filtering processing on the initial values of the L channel, the a channel, and the b channel of the first Lab image. According to this design, the surface reflection components of the L channel, the a channel, and the b channel can be filtered out, to accurately extract the body reflection components of the L channel, the a channel, and the b channel.

In a possible design, to improve pigment detection accuracy, the surface reflection components of the L channel, the a channel, and the b channel of the first Lab image may be obtained by separately performing bilateral filtering processing on the initial values of the L channel, the a channel, and the b channel of the first Lab image. This design can help further retain edge information of the first image, thereby improving the pigment detection accuracy.

In a possible design, the pigment includes but is not limited to any one of the following: hemoglobin, melanin, carotene, lipochrome, and bile pigment.

According to a second aspect, an embodiment of this application provides an electronic device, where the electronic device includes a memory, a processor, and a display screen. The memory is configured to store a program instruction. The processor is configured to read the program instruction stored in the memory, and perform the following operations: extracting a first image from a to-be-detected RGB skin image, where the first image is used to represent a body reflection component in the RGB skin image, and the RGB skin image is photographed by a device having an RGB image photographing function; extracting a pigment from an R channel, a B channel, and a G channel of the first image based on a correspondence between a first spectral response curve of the pigment and a second spectral response curve of the device having the RGB image photographing function; and generating a pseudo-color image based on the extracted pigment, and displaying the pseudo-color image. The display screen is configured to display the pseudo-color image.

In a possible design, the processor is specifically configured to perform the following operations: converting the to-be-detected RGB skin image into a first Lab image; extracting a body reflection component from each of an L channel, an a channel, and a b channel of the first Lab image; combining the body reflection components extracted from the L channel, the a channel, and the b channel of the first Lab image to obtain a second Lab image; and converting the second Lab image into an RGB image to obtain the first image.

In a possible design, the body reflection component of the L channel of the first Lab image is a difference between an initial value of the L channel of the first Lab image and a surface reflection component of the L channel of the first Lab image; the body reflection component of the a channel of the first Lab image is a difference between an initial value of the a channel of the first Lab image and a surface reflection component of the a channel of the first Lab image; the body reflection component of the b channel of the first Lab image is a difference between an initial value of the b channel of the first Lab image and a surface reflection component of the b channel of the first Lab image; and the surface reflection components of the L channel, the a channel, and the b channel of the first Lab image are obtained by separately performing filtering processing on the initial values of the L channel, the a channel, and the b channel of the first Lab image.

In a possible design, that the surface reflection components of the L channel, the a channel, and the b channel of the first Lab image are obtained by separately performing filtering processing on the initial values of the L channel, the a channel, and the b channel of the first Lab image includes: the surface reflection components of the L channel, the a channel, and the b channel of the first Lab image are obtained by separately performing bilateral filtering processing on the initial values of the L channel, the a channel, and the b channel of the first Lab image.

In a possible design, the pigment includes but is not limited to any one of the following: hemoglobin, melanin, carotene, lipochrome, and bile pigment.

According to a third aspect, an embodiment of this application provides a computer storage medium, where the computer storage medium stores a program instruction, and when the program instruction is run on an electronic device, the electronic device is enabled to perform the method according to any one of the first aspect in the embodiments of this application or the possible designs of the first aspect.

According to a fourth aspect, an embodiment of this application provides a computer program product. When the computer program product is run on an electronic device, the electronic device is enabled to perform the method according to any one of the first aspect in the embodiments of this application or the possible designs of the first aspect.

According to a fifth aspect, an embodiment of this application provides a chip, where the chip is coupled to a memory in an electronic device, and controls the electronic device to perform the method according to any one of the first aspect in the embodiments of this application or the possible designs of the first aspect.

In addition, for technical effects brought by the second aspect to the fifth aspect, refer to the description in the first aspect. Details are not described herein again.

It should be noted that the “coupling” in the embodiments of this application means that two components are directly or indirectly combined with each other.

DESCRIPTION OF EMBODIMENTS

The following further describes in detail the embodiments of this application with reference to accompanying drawings.

It should be understood that, in the embodiments of this application, “at least one” means one or more, and “a plurality of” means two or more. “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. A and B 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, b, and c, where a, b, and c each may be in a singular or plural form.

The embodiments disclosed in this application may 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 function and/or a music player function, 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 foregoing electronic device may alternatively be a desktop computer having a touch-sensitive surface (for example, a touch panel).

FIG.1is an example of a schematic diagram of a structure of an electronic device.

The electronic device100may include a processor110, an external memory interface120, an internal memory121, and a universal serial bus (universal serial bus, USB) interface130, a charging management module140, a power management module141, a battery142, an antenna2, a wireless communications module160, an audio module170, a loudspeaker170A, a telephone receiver170B, a microphone170C, a headset jack170D, a sensor module180, a key190, a motor191, an indicator192, a camera193, a display screen194, and the like. The sensor module180includes an ambient light sensor180L. In addition, the sensor module180may further include a pressure sensor180A, a gyroscope sensor180B, a barometric pressure sensor180C, a magnetic sensor180D, an acceleration sensor180E, a distance sensor180F, an optical proximity sensor180G, a fingerprint sensor180H, a temperature sensor180J, a touch sensor180K, a bone conduction sensor180M, and the like.

In some other embodiments, the electronic device100in this embodiment of this application may further include an antenna1, a mobile communications module150, a subscriber identity module (subscriber identification module, SIM) card interface195, and the like.

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

In some embodiments, a memory may further be disposed in the processor110, and is configured to store an instruction and data. For example, the memory in the processor110may be a cache memory. The memory may store an instruction or data that is recently used or cyclically used by the processor110. If the processor110needs to use the instruction or the data again, the processor110may directly invoke the instruction or the data from the memory. This avoids repeated access and reduces a waiting time of the processor110, thereby improving system efficiency.

In some other embodiments, the processor110may further include one or more interfaces. For example, the interface may be the USB interface130. For another example, the interface may alternatively be an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a mobile industry processor interface (MIPI), a general purpose input/output (GPIO) interface, a SIM interface, or the like. It can be understood that in this embodiment of this application, different modules of the electronic device100may be connected through an interface, so that the electronic device100can implement different functions, for example, photographing and processing. It should be noted that a connection manner of the interface in the electronic device100is not limited in this embodiment of this application.

The USB interface130is an interface that complies with a USB standard specification. For example, the USB interface130may include a mini USB interface, a micro USB interface, a USB type C interface, and the like. The USB interface130may be configured to connect to a charger to charge the electronic device100, may be configured to transmit data between the electronic device100and a peripheral device, or may be configured to connect to a headset and play audio by using the headset. The interface may further be configured to connect to another electronic device, for example, an augmented reality (AR) device.

A wireless communication function of the electronic device100may be implemented by using the antenna1, the antenna2, the mobile communications module150, the wireless communications module160, the modem processor, the baseband processor, and the like.

The mobile communications module150may provide a wireless communication solution applied to the electronic device100, including 2G, 3G, 4G, 5G, or the like. The mobile communications module150may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), and the like. The mobile communications module150may receive an electromagnetic wave by using the antenna1, perform processing such as filtering and amplification on the received electromagnetic wave, and transmit a processed electromagnetic wave to the modem processor for demodulation. The mobile communications module150may further amplify a signal modulated by the modem processor, convert the amplified signal into an electromagnetic wave by using the antenna1, and radiate the electromagnetic wave through the antenna1. In some embodiments, at least some function modules in the mobile communications module150may be disposed in the processor110. In some embodiments, at least some function modules in the mobile communications module150and at least some modules in the processor110may be disposed in a same device.

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 a medium-high-frequency signal. The demodulator is configured to demodulate a received electromagnetic wave signal into a low-frequency baseband signal. Then, the demodulator transmits the low-frequency baseband signal obtained through demodulation to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, a processed low-frequency baseband signal is transmitted to the application processor. The application processor outputs a sound signal by using an audio device (which is not limited to the loudspeaker170A and the telephone receiver170B), or displays an image or a video by using the display screen194. In some embodiments, the modem processor may be an independent device. In some other embodiments, the modem processor may be independent of the processor110, and disposed in a same device as the mobile communications module150or another function module.

The wireless communications module160may provide wireless communication solutions that are applied to the electronic device100, for example, wireless local area network (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communications module160may be one or more devices integrated into at least one communications processing module. The wireless communications module160receives an electromagnetic wave signal by using the antenna2, performs frequency modulation and filtering processing on the electromagnetic wave signal, and sends a processed signal to the processor110. The wireless communications module160may further receive a to-be-sent signal from the processor110, perform frequency modulation and amplification on the signal, convert a processed signal into an electromagnetic wave by using the antenna2, and radiate the electromagnetic wave through the antenna2.

The electronic device100implements a display function by using the GPU, the display screen194, the application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display screen194and the application processor. The GPU is configured to perform mathematical and geometric calculation, and is configured to perform graphics rendering. The processor110may include one or more GPUs, and executes a program instruction to generate or change display information.

The display screen194is configured to display an image, a video, and the like. The display screen194includes a display panel. The display panel may use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini LED, a micro LED, a quantum dot light-emitting diode (QLED), and the like. In some embodiments, the electronic device100may include one or N display screens194, where N is a positive integer greater than 1.

The electronic device100may implement a photographing function by using the ISP, the camera193, the video codec, the GPU, the display screen194, the application processor, and the like.

The ISP is configured to process data fed back by the camera193. For example, during photographing, after a shutter is opened, light is transmitted to a photosensitive element of the camera through a lens, an optical signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing, and converts the electrical signal into a visual image. The ISP may further perform algorithm-based optimization on noise, luminance, and a skin color of the image. The ISP may further optimize parameters such as exposure and color temperature of a photographing scenario. In some embodiments, the ISP may be disposed in the camera193.

The DSP is configured to process a digital signal. In addition to the digital image signal, the DSP may further process another digital signal. For example, when the electronic device100selects a frequency, the DSP is configured to perform Fourier transform on frequency energy, or the like.

The video codec is configured to compress or decompress a digital video. The electronic device100can support one or more types of video codecs. In this case, the electronic device100can play or record videos in a plurality of encoding formats, for example, a moving picture experts group (MPEG)-1 format, an MPEG-2 format, an MPEG-3 format, and an MPEG-4 format.

The NPU is a neural-network (neural-network, NN) computing processor. By using a biological neural network structure, for example, by using a mode of transmission between human brain neurons, the NPU can rapidly process input information, and can further perform continuous self-learning. Applications such as intelligent cognition of the electronic device100, for example, image recognition, facial recognition, speech recognition, and text understanding, can be implemented by using the NPU.

The external memory interface120may be configured to connect to an external memory card (for example, a micro SD card), to extend a storage capability of the electronic device100. The external memory card communicates with the processor110by using the external memory interface120, to implement a data storage function, for example, storing a music file, a video file, or the like in the external memory card.

The internal memory121may be configured to store computer executable program code, where the executable program code includes an instruction. The processor110runs the instruction stored in the internal memory121, to perform various function applications of the electronic device100and data processing. The internal memory121may include a program storage area and a data storage area. The program storage area may store an operating system, an application required by at least one function (for example, an audio playback function or an image playback function), and the like. The data storage area may store data (for example, audio data and a phone book) created during use of the electronic device100, and the like. In addition, the internal memory121may include a high-speed random access memory, and may further include a nonvolatile memory, for example, at least one magnetic disk storage device, a flash memory device, and a universal flash storage (universal flash storage, UFS).

The electronic device100can implement an audio function, for example, music playback or recording, by using the audio module170, the loudspeaker170A, the telephone receiver170B, the microphone170C, the headset jack170D, the application processor, and the like.

The audio module170is configured to convert digital audio information into an analog audio signal for output, and is also configured to convert an analog audio input into a digital audio signal. The audio module170may further be configured to encode and decode an audio signal. In some embodiments, the audio module170may be disposed in the processor110, or some function modules of the audio module170are disposed in the processor110.

The loudspeaker170A, also referred to as a “speaker”, is configured to convert an audio electrical signal into a sound signal. The electronic device100can be used for listening to music or answering a hands-free call by using the loudspeaker170A.

The telephone receiver170B, also referred to as an “earpiece”, is configured to convert an audio electrical signal into a sound signal. When a call or voice information is received on the electronic device100, voice can be heard by putting the telephone receiver170B near a human ear.

The microphone170C, also referred to as a “voice tube” or a “mike”, is configured to convert a sound signal into an electrical signal. When making a call or sending voice information, a user can make a sound near the microphone170C with the user's mouth to input a sound signal to the microphone170C. At least one microphone170C may be disposed in the electronic device100. In some other embodiments, two microphones170C may be disposed in the electronic device100, and can further implement a noise reduction function in addition to sound signal acquisition. In some other embodiments, three, four, or more microphones170C may alternatively be disposed in the electronic device100, to implement sound signal acquisition and noise reduction, further identify a sound source, and implement a directional recording function and the like.

The headset jack170D is configured to connect to a wired headset. The headset jack170D may be a USB interface130, or may be a 3.5-mm open mobile electronic device platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface, or the like.

The pressure sensor180A is configured to sense a pressure signal, and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor180A may be disposed on the display screen194. There are many types of pressure sensors180A, for example, a resistive pressure sensor, an inductive pressure sensor, and a capacitive pressure sensor. The capacitive pressure sensor may include at least two parallel plates including a conducting material. When force is applied to the pressure sensor180A, capacitance between electrodes changes. The electronic device100determines pressure intensity based on the capacitance change. When a touch operation is performed on the display screen194, the electronic device100detects a strength of the touch operation by using the pressure sensor180A. The electronic device100may alternatively obtain a touch position through calculation based on a signal detected by the pressure sensor180A. In some embodiments, touch operations that are performed in a same touch position but have different touch operation strengths may be corresponding to different operation instructions. For example, when a touch operation with a touch operation strength less than a first pressure threshold is performed on an icon of an SMS message application, an instruction for viewing a short message is executed. When a touch operation with a touch operation strength greater than or equal to the first pressure threshold is performed on the icon of the SMS message application, an instruction for creating a new short message is executed.

The gyroscope sensor180B may be configured to determine a moving posture of the electronic device100. In some embodiments, angular velocities of the electronic device100relative to three axes (that is, x, y, and z axes) may be determined by using the gyroscope sensor180B. The gyroscope sensor180B may be used for image stabilization during photographing. For example, when a shutter is pressed, the gyroscope sensor180B detects an angle at which the electronic device100shakes, calculates, based on the angle, a distance for which a lens module needs to compensate, and allows a lens to offset the shake of the electronic device100through reverse movement, to implement image stabilization. The gyroscope sensor180B may also be used for navigation and a motion sensing game scenario.

The barometric pressure sensor180C is configured to measure atmospheric pressure. In some embodiments, the electronic device100calculates an altitude by using the atmospheric pressure measured by the barometric pressure sensor180C, to assist positioning and navigation.

The magnetic sensor180D includes a Hall effect sensor. The electronic device100may detect, by using the magnetic sensor180D, whether a flip leather case is open or closed. In some embodiments, when the electronic device100is a flip phone, the electronic device100may detect, by using the magnetic sensor180D, whether a flip cover is open or closed, and further set, based on a detected open/closed state of a leather case or a detected open/closed state of the flip cover, attributes such as auto-unlocking is implemented when the flip phone is flipped open.

The acceleration sensor180E may detect magnitude of accelerations of the electronic device100in various directions (generally three axes); may detect magnitude and a direction of gravity when the electronic device100is still; and may further be configured to recognize a posture of the electronic device, and applied to screen switching between a landscape mode and a portrait mode, a pedometer, or another application.

The distance sensor180F is configured to measure a distance. The electronic device100may measure a distance by using infrared or laser. In some embodiments, in a photographing scenario, the electronic device100may measure a distance by using the distance sensor180F, to implement fast focusing.

The optical proximity sensor180G may include, for example, a light emitting diode (LED) and an optical detector, for example, a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device100emits infrared light by using the light emitting diode. The electronic device100detects infrared reflected light from an object nearby by using a photodiode. When sufficient reflected light is detected, the electronic device100can determine that there is an object near the electronic device100. When insufficient reflected light is detected, the electronic device100can determine that there is no object near the electronic device100. By using the optical proximity sensor180G, the electronic device100may detect that a user holds the electronic device100close to an ear during a call, to automatically turn off a screen for power saving. The optical proximity sensor180G may also be used for automatic screen unlocking or locking in a leather case mode or a pocket mode.

The fingerprint sensor180H is configured to acquire a fingerprint. By using a feature of the acquired fingerprint, the electronic device100can implement unlocking via the fingerprint, access an application lock, perform photographing via the fingerprint, answer a call via the fingerprint, and the like.

The temperature sensor180J is configured to detect temperature. In some embodiments, the electronic device100executes a temperature processing policy by using the temperature detected by the temperature sensor180J. For example, when the temperature reported by the temperature sensor1807exceeds a threshold, the electronic device100reduces performance of a processor located nearby the temperature sensor1807, to reduce power consumption to implement thermal protection. In some other embodiments, when the temperature is less than another threshold, the electronic device100heats the battery142to prevent abnormal power-off of the electronic device100resulted from low temperature. In some other embodiments, when the temperature is less than still another threshold, the electronic device100increases an output voltage of the battery142to prevent abnormal power-off resulted from low temperature.

The touch sensor180K is also referred to as a “touch panel”. The touch sensor180K may be disposed in the display screen194, and the touch sensor180K and the display screen194constitute a touchscreen, which is also referred to as a “touch control screen”. The touch sensor180K is configured to detect a touch operation performed on or near the touch sensor180K. The touch sensor may transmit the detected touch operation to the application processor to determine a type of a touch event. A visual output related to the touch operation may be provided by using the display screen194. In some other embodiments, the touch sensor180K may alternatively be disposed in a position, different from a position of the display screen194, on a surface of the electronic device100.

The bone conduction sensor180M may obtain a vibration signal. In some embodiments, the bone conduction sensor180M may obtain a vibration signal of a vibrating bone block of a vocal-cord part of a human body. The bone conduction sensor180M may also be in contact with pulses of a human body to receive blood pressure fluctuating signals. In some embodiments, the bone conduction sensor180M may also be disposed in a headset, to combine with the headset into a bone conduction headset. The audio module170may obtain a voice signal by parsing the vibration signal of the vibrating bone block of the vocal-cord part obtained by the bone conduction sensor180M, to implement a voice function. The application processor may obtain heart rate information by parsing the blood pressure fluctuating signals obtained by the bone conduction sensor180M, to implement a heart rate detection function.

The key190may include a power key, a volume key, and the like. The key190may be a mechanical key, or may be a touch key. The electronic device100may receive a key input, and generate a key signal input related to a user setting and function control of the electronic device100.

The motor191may generate a vibration alert. The motor191may be configured to provide an incoming-call vibration alert and a touch vibration feedback. For example, touch operations performed on different applications (for example, photographing and audio playback) may be corresponding to different vibration feedback effects. The motor191may also be corresponding to different vibration feedback effects for touch operations performed in different areas of the display screen194. Different application scenarios (for example, time reminding, information receiving, an alarm clock application, and a game application) may also be corresponding to different vibration feedback effects. The touch vibration feedback effect may also be user-defined.

The indicator192may be an indicator light, and may be configured to indicate a charging status and a battery level change, or may be configured to indicate a message, a missed call, a notification, or the like.

The SIM card interface195is configured to connect to a SIM card. The SIM card may be inserted into the SIM card interface195or removed from the SIM card interface195, to be in contact with or be separated from the electronic device100. The electronic device100can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface195can support a nano-SIM card, a micro-SIM card, a SIM card, and the like. A plurality of cards may be inserted into a same SIM card interface195at the same time. The plurality of cards may be of a same type or different types. The SIM card interface195may also be compatible with different types of SIM cards. The SIM card interface195may also be compatible with an external memory card. The electronic device100interacts with a network by using a SIM card, to implement a call function, a data communication function, and the like. In some embodiments, the electronic device100uses an eSIM, that is, an embedded SIM card. The eSIM card may be embedded in the electronic device100and cannot be separated from the electronic device100.

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

The following describes this embodiment of this application in detail by using the electronic device100as an example.

In addition, it should be understood that applications supported by the electronic device in this embodiment of this application may include a photographing application, for example, a camera. In addition, the applications supported by the electronic device may further include a plurality of other applications, for example, drawing, gaming, phone, video player, music player, photo management, browser, calendar, and clock.

The applications supported by the electronic device in this embodiment of this application may further include an application for skin test. The application for skin test is to detect a facial skin features (for example, wrinkles, pores, blackheads, color spots, or a red area of facial skin) of a user by using a photographed facial image, and may provide a detection result report for the user. For example, the detection result report may include, but is not limited to, a score for each feature of the facial skin and comprehensive analysis on the facial skin, and may further display the facial image of the user, and mark a corresponding problem on the facial image based on a detection result of each feature. For example, blackheads are marked in a nose area, wrinkles are marked in a forehead area, and color spots are marked in a cheek area. 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 the user interface200shown inFIG.2, and includes a comprehensive score, a skin age, and scores for pores, blackheads, fine lines, color spots, and a red area. In some other embodiments, the user interface200may further include a virtual button201, a virtual button202, a virtual button203, a virtual button204, and a virtual button205. Using the virtual button201as an example, in response to an operation performed on the virtual button201, the electronic device100displays a specific care advice for the pores on the display screen194. For functions of the virtual button202, the virtual button203, the virtual button204, and the virtual button205, refer to a function of the virtual button201. Details are not described herein again.

To make the electronic device more accurately detect the facial skin of the user, for example, in the user skin test solution in this embodiment of this application, a photographing condition detection module, an image quality detection module, and a region of interest (ROI) detection module, a skin feature detection module, a result analysis module, and the like may be integrated into the processor110. In some embodiments, the photographing condition detection module, the image quality detection module, and the region of interest (ROI) detection module, the skin feature detection module, the result analysis module, and the like may be integrated into the application processor in the processor110. In some other embodiments, an artificial intelligence (AI) chip is integrated into the processor110, and the photographing condition detection module, the image quality detection module, and the region of interest (ROI) detection module, the skin feature detection module, the result analysis module, and the like are integrated into the AI chip, to implement user skin test.

The photographing condition detection module may detect a current photographing condition, to guide a user to perform photographing in a required photographing condition, to ensure that a photographed image meets a requirement, thereby ensuring accuracy of skin test performed based on the image. For example, the required photographing condition includes: ambient light is sufficient; there is an appropriate distance (for example, approximately 25 cm) between a human face and the electronic device; a face is straight; eyes are closed; no glasses are worn; a forehead is not covered by bangs as far as possible; focusing is accurate; there is no obvious shake; and the like.

After the photographing condition detection module performs detection successfully, the processor110enables intelligent light compensation. For example, when a current photographing condition meets a requirement, the photographing condition detection module determines that the detection succeeds. Specifically, in this embodiment of this application, the electronic device may use different light compensation modes (for example, a flash lamp mode or a flashlight mode) to perform light compensation for a face of a user, to meet requirements of detecting different facial skin features. After performing light compensation for the face of the user, the processor110may control the camera193to photograph the face of the user to obtain a facial image of the face of the user.

The image quality detection module may detect quality of the facial image, to ensure that the photographed image meets the requirements of detecting different facial skin features.

After the image quality detection module finds that the image quality meets the requirements, the ROI detection module may determine a to-be-detected ROI from the facial image. For example, an ROI of blackheads is a small area on a nose.

The skin feature detection module may detect each of facial skin features in the determined ROI, for example, detect wrinkles, pores, blackheads, color spots, a red area, and a degree of oiliness on the skin.

The result analysis module may analyze a detection result of the facial skin features detected by the skin feature detection module, and provide a score, a score ranking, and the like of each detection item for each skin feature.

In addition, in some embodiments, an image preprocessing module may further be integrated into the processor110. The image preprocessing module may perform compression, cropping, and the like on the photographed facial image, so that the ROI detection module, the skin feature detection module, and the like perform subsequent processing.

To output a facial image analysis result, output a score of each detection item, or the like, the processor110may further display a detection report (including areas with a detection result of each feature in the facial image, for example, a nose area marked with blackheads, a forehead area marked with wrinkles, a cheek area marked with color spots; scores of all detection items; and the like) obtained through detection on the display screen194for the user to view, thereby improving user experience.

The following describes the embodiments of this application in detail with reference to the structure of the electronic device shown inFIG.1.

To adapt to changes of a plurality of detection scenarios and resolve a problem of poor applicability of an existing skin pigment detection technology, an embodiment of this application provides a pigment detection method. In this method, the electronic device100can extract a pigment from an RGB skin image. Because a skin pigment (for example, melanin or hemoglobin) has a specific absorption spectrum, after a body reflection component is extracted from the skin image, the pigment can be separated from the body reflection component by using a spectrum analysis technology. Therefore, relatively good applicability can be achieved by using the pigment detection method for pigment detection.

The pigment detection method provided in this embodiment of this application may be applied to an application that is used for skin test and that is supported by the electronic device100. For example, as shown inFIG.5AtoFIG.5D, the display screen194of the electronic device100displays an icon500of an application for skin test. If finding an operation performed on the icon500(for example, the electronic device finds that a user taps the icon500), in response to the operation performed on the icon500, the electronic device100displays a user interface510of the application for skin test on the display screen194. The user interface510of the application for skin test includes a virtual button511(during implementation, the virtual button may be named as “test”, “take a photo”, or the like). If finding an operation performed on the virtual button511(for example, the electronic device finds that the user taps the virtual button511), in response to the operation performed on the virtual button511, the electronic device100performs, according to the pigment detection method provided in this embodiment of this application, pigment detection on an area that is in an RGB skin image and in which a pigment needs to be detected.

The RGB skin image may be obtained by the electronic device100in response to the operation on the virtual button511by photographing a face of the user by using the camera193. The camera193herein may be a front-facing camera or a rear-facing camera of the electronic device100. Alternatively, the RGB skin image may be an image that is read, by the electronic device100in response to the operation on the virtual button511, from the internal memory121or from an external memory by using the external memory interface120. In this case, the RGB skin image may be an RGB skin image that is photographed in advance and that is stored in the internal memory121or the external memory.

For example, the RGB skin image may be an image obtained by the electronic device by photographing the face of the user by using the camera193(the camera193herein may be a front-facing camera or a rear-facing camera). After photographing, the electronic device100stores the obtained RGB skin image in the internal memory121, and after finding the operation performed on the virtual button511, the electronic device100may read the RGB skin image from the internal memory121. In addition, during implementation, an RGB skin image stored in the internal memory121may alternatively be an image received by the electronic device100by using the mobile communications module150and/or the wireless communications module160.

Further, after the electronic device100finds the operation performed on the virtual button511, the user may alternatively choose whether the electronic device100performs photographing by using the camera193to obtain an RGB skin image or the electronic device100reads an RGB skin image from the internal memory121or the external memory. For example, after the electronic device100finds the operation performed on the virtual button511, the display screen194displays a photo selection area512. The photo selection area512may include prompt information such as “provide a photo” and “obtain a photo from”, to remind the user to select a source of the RGB skin image, and the photo selection area512may further include a plurality of virtual buttons. Operations corresponding to the virtual buttons are performed based on operations performed on the virtual buttons by the user, to obtain RGB skin images in different ways. For example, the virtual button may be a first button513(a name of the first button513may be “camera”, “take a photo”, or the like) that represents obtaining an RGB skin image in a photographing manner; or the virtual button may be a second button514(a name of the second button514may be “storage”, “album”, or the like) that represents obtaining an RGB skin image by reading from a memory. After finding an operation performed by the user on the first button513, in response to the operation performed by the user on the first button513, the electronic device100may photograph a facial image of the user by using the camera193, and use the facial image as an RGB skin image. After finding an operation performed by the user on the second button514, the electronic device100may continue to remind the user to select an RGB skin image storage path, and read, from the storage path selected by the user, an image selected by the user as an RGB skin image. The storage path may be a default storage path of an “album” of the electronic device100. The storage path may include a storage path of the internal memory121, or may include a storage path of the external memory. In addition, it should be understood that the display of the photo selection area512may alternatively be triggered in a manner other than finding, by the electronic device100, the operation performed on the virtual button511. For example, a new virtual function button may be disposed on the user interface510, to display the photo selection area512after the electronic device100finds an operation performed on the new virtual function button.

After the RGB skin image of the user is obtained by using the foregoing method, the display screen194may display an RGB skin image preview interface520, and display the RGB skin image in a preview area521of the RGB skin image preview interface520. The electronic device100may determine an ROI for pigment detection based on the RGB skin image in the preview area521. For example, the electronic device100may automatically select an ROI through positioning analysis based on a facial feature point in the RGB skin image; the user may manually draw an ROI; or the electronic device100may provide an area, and the user may manually adjust the area provided by the electronic device100to obtain an ROI. Then, the ROI is used as an area that is in the RGB skin image and in which a pigment needs to be detected, and is used to perform pigment detection by using the pigment detection method provided in this embodiment of this application.

The following describes in detail how the processor110in the electronic device100specifically implements pigment detection on RGB skin images based on the RGB skin images obtained in the foregoing different manners. For a specific method, refer to a schematic flowchart shown inFIG.3. The method includes the following steps.

Step301. The processor110extracts a first image from a to-be-detected RGB skin image.

The first image is used to represent a body reflection component in the RGB skin image, and the RGB skin image is photographed by a device having an RGB image photographing function.

Herein, the RGB skin image may be a skin image of a to-be-detected part, for example, a facial image or a nose area image.

The RGB skin image is obtained by imaging after incident light is reflected through epidermis and absorbed and scattered by the epidermis, dermis, and subcutaneous tissues. The RGB skin image mainly includes two components: a surface reflection component and a body reflection component.

The surface reflection component is obtained by using energy that bounces back in a manner similar to mirror reflection when the incident light is incident on a skin surface, and may be used to analyze a topology feature of the skin surface, for example, wrinkles, pores, blackheads, and a skin texture.

The body reflection component is obtained by using energy that is returned after energy of the incident light enters skin and is absorbed and scattered by pigments, collagen, and the like in the epidermis and the dermis, and may be used to analyze optical properties of the subcutaneous tissues, for example, distribution of pigments such as melanin and hemoglobin. For example, the body reflection component may be extracted from the to-be-detected RGB skin image, to obtain the first image.

The device having the RGB image photographing function may be the electronic device100, or may be a device connected to the electronic device100, or may be a device not directly connected to the electronic device100. In an example, the indirect connection may be a wireless connection, or may be a connection implemented by using another device, to send or transmit, to the electronic device100, the RGB skin image photographed by the device having the RGB image photographing function. For example, the device having the RGB image photographing function is the electronic device100. The RGB image photographing function is implemented by a camera193on the electronic device100. For example, the camera193acquires the RGB skin image. For example, when an image needs to be acquired, an operation may be performed on a camera application installed in the electronic device100, to enable the camera193by using the electronic device100to photograph an image. The camera application may be an application pre-installed in the electronic device100at delivery, or may be an application downloaded by a user. It should be noted that the RGB skin image may be an image pre-stored in the electronic device100, or may be obtained through in real-time photographing by enabling the camera193by the electronic device100.

In a specific example, as shown inFIG.4AandFIG.4B, a display screen194of the electronic device100displays a home screen. The home screen includes an icon400of a camera application. In addition, the home screen may further include an email icon, an SMS message icon, a gallery icon, a WeChat icon, and the like. When an image needs to be photographed, the display screen194of the electronic device100may respond to an operation performed on the icon400, for example, a touch operation performed on the icon400. The display screen194displays a preview interface410, and the preview interface410includes a preview area411. The preview area411may be used to display the RGB skin image acquired by the camera193. Using photographing of a facial image as an example, when the to-be-photographed image is displayed in the preview area411, a touch operation may be performed on a virtual button412, to acquire an RGB skin image.

In another specific example, the electronic device100may further include an application for skin test. As shown inFIG.5AtoFIG.5D, the display screen194of the electronic device100displays the icon500of the application for skin test. In response to an operation performed on the icon500, the electronic device100displays the user interface510of the application for skin test on the display screen194. The user interface510includes the virtual button511. If the electronic device100finds an operation performed on the virtual button511, in response to the operation performed on the virtual button511, the display screen194displays a preview interface520of a camera application, where the preview interface520includes a preview area521. The preview area521is used to display the RGB skin image acquired by the camera193.

Step302. The processor110extracts a pigment from an R channel, a B channel, and a G channel of the first image based on a correspondence between a first spectral response curve of the pigment and a second spectral response curve of the device having the RGB image photographing function.

The pigment may include but is not limited to any one of the following: hemoglobin, melanin, carotene, lipochrome, and bile pigment.

Specifically, the processor110extracts the pigment from the R channel, the B channel, and the G channel of the first image based on the correspondence between the first spectral response curve of the pigment and the second spectral response curve of the device having the RGB image photographing function, and channel values of the three channels, namely the R channel, the G channel, and the B channel, of the first image.

For example, the first spectral response curve of the pigment reflects absorption values of the pigment in spectral segments of different wavelengths, for example, an absorption spectrum curve of melanin, an absorption spectrum curve of oxyhemoglobin, and an absorption spectrum curve of deoxyhemoglobin that are shown inFIG.6. The second spectral response curve of the device having the RGB image photographing function reflects absorption values, corresponding to different spectral segments, of different photosensitive units in the device having the RGB image photographing function, for example, an absorption spectrum curve of a red (R) photosensitive unit, an absorption spectrum curve of a green (G) photosensitive unit, and an absorption spectrum curve of a blue (B) photosensitive unit that are shown inFIG.6.

In a specific example, melanin and hemoglobin are extracted from the first image. Because the melanin and the hemoglobin have specific absorption spectra, the melanin and the hemoglobin can be separated from the body reflection component of the first image by using a spectrum analysis technology. The following provides a possible implementation of separating the melanin and the hemoglobin.

Based on the first spectral response curve of the melanin shown inFIG.6and the second spectral response curve of the device having the RGB image photographing function, a first function relationship between the first spectral response curve of the melanin and the second spectral response curve of the device having the RGB image photographing function may be determined. Then, based on channel values of an R channel, a G channel, and a B channel of the device having the RGB image photographing function and the first function relationship, a correspondence between the melanin and the channel values of the three channels, namely the R channel, the G channel, and the B channel, may be determined. For example, the correspondence is represented by the following formula (1):
M=g(R,G,B)  (1)

In the foregoing formula (1), R, G, and B respectively represent channel values of three channels, namely an R channel, a G channel, and a B channel, of an RGB image, and M is a melanin value of the melanin, g is a mapping function from the channel values of the three channels, namely the R channel, the G channel, and the B channel, to the melanin value M.

Based on the foregoing formula (1) and a first image extracted from an RGB skin image displayed in the preview area521shown inFIG.5C, the melanin may be extracted from the first image based on channel values of three channels, namely an R channel, a G channel, and a B channel, of the first image. In this way, a grayscale image corresponding to the melanin shown inFIG.7can be obtained.

Similarly, based on the first spectral response curve of the hemoglobin shown inFIG.6and the second spectral response curve of the device having the RGB image photographing function, a second function relationship between the first spectral response curve of the hemoglobin and the second spectral response curve of the device having the RGB image photographing function may be determined. Then, based on the channel values of the R channel, the G channel, and the B channel of the device having the RGB image photographing function and the second function relationship, a correspondence between the hemoglobin and the channel values of the three channels, namely the R channel, the G channel, and the B channel, may be determined. For example, the correspondence is represented by the following formula (2):
H=f(R,G,B)  (2)

In the foregoing formula (2), R, G, and B respectively represent channel values of three channels, namely an R channel, a G channel, and a B channel, of an RGB image, and H is a hemoglobin value of the hemoglobin, and f is a mapping function from the channel values of the three channels, namely the R channel, the G channel, and the B channel, to the hemoglobin value H.

Based on the foregoing formula (2) and the first image extracted from the RGB skin image displayed in the preview area521shown inFIG.5C, the hemoglobin may be extracted from the first image based on the channel values of the three channels, namely the R channel, the G channel, and the B channel, of the first image. In this way, a grayscale image corresponding to the hemoglobin shown inFIG.8can be obtained.

It should be noted that the foregoing formula (1) and formula (2) may be mathematical models provided in existing research, or may be models obtained through training by using a machine learning algorithm.

Step303. The processor110generates a pseudo-color image based on the extracted pigment, and displays the pseudo-color image.

In a specific example, the processor110generates a grayscale image (a melanin result image shown inFIG.7and a hemoglobin result image shown inFIG.8) based on the extracted pigment, and then converts the grayscale image into a pseudo-color image. In this way, an intuitive pigment detection result can be presented to the user, so that the user can obtain more information from the pseudo-color image.

Specifically, the pseudo-color image may be obtained through mapping by using a preset color lookup table. For example, the color lookup table may include a mapping relationship between different grayscale values and R values, G values, and B values. In this way, a pseudo-color image can be obtained by searching for an R value, a G value, and a B value that are corresponding to a grayscale value of each pixel in the grayscale image.

Further, to obtain a more accurate pigment detection result, the processor110may perform post-processing such as normalization processing and contrast enhancement processing on the generated grayscale image, and then convert the post-processed grayscale image into the pseudo-color image.

According to the foregoing solution, the processor110extracts the first image from the to-be-detected RGB skin image, where the first image is used to represent the body reflection component in the RGB skin image, and the RGB skin image is photographed by the device having the RGB image photographing function; and the processor110extracts the pigment from the first image based on the relationship between the first spectral response curve of the pigment and the second spectral response curve of the device having the RGB image photographing function. In this way, the processor110extracts the pigment based on the spectral response relationship, so that pigments in RGB skin images photographed in different scenarios can be detected, avoiding a case in the prior art in which pigment detection can be performed only after training is performed in advance by using skin images acquired in different scenarios. Therefore, pigment detection based on this solution has relatively good applicability.

Based on the foregoing embodiment, to improve fidelity of the first image extracted from the RGB skin image, the following provides an optional implementation, and step301is implemented by using steps S1to S3below.

S1. The processor110converts the to-be-detected RGB skin image into a first Lab image.

Specifically, the processor110converts the to-be-detected RGB skin image from RGB color space into Lab color space, to obtain the first Lab image. The conversion from the RGB color space to the Lab color space can be performed by using an algorithm disclosed in the industry.

The RGB color space includes three channels, namely an R channel, a G channel, and a B channel. A color of each pixel in the to-be-detected RGB skin image includes an R value, a G value, and a B value, R values of all the pixels form the R channel, G values of all the pixels form the G channel, and B values of all the pixels form the B channel.

The lab color space includes three channels, namely an L channel, an a channel, and a b channel. L represents pixel luminance, and is unrelated to color information. a and b are related to a color of a pixel, and are unrelated to the pixel luminance. a represents a range from magenta to green, and b represents a range from yellow to blue. A color of each pixel in the first Lab image includes an L value, an a value, and a b value. L values of all the pixels in the first Lab image form the L channel, a values of all the pixels form the a channel, and b values of all the pixels form the b channel.

If filtering processing is performed on the R channel, the G channel, and the B channel of the RGB skin image, color overlapping may occur in a filtering result. As a result, fidelity of an obtained image is poor. The to-be-detected RGB skin image is converted into the first Lab image, so that color-related information and color-unrelated information can be separated, to separately process the color-related information in the first Lab image.

S2. The processor110extracts a body reflection component from each of the L channel, the a channel, and the b channel of the first Lab image.

For example, the processor110may separately perform filtering processing on the L channel, the a channel, and the b channel of the first Lab image, to obtain the body reflection components of the L channel, the a channel, and the b channel of the first Lab image.

An initial value of each of the L channel, the a channel, and the b channel of the first Lab image includes a body reflection component and a surface reflection component. In an implementation, filtering processing is separately performed on the initial values of the L channel, the a channel, and the b channel of the first Lab image to obtain surface reflection components of the L channel, the a channel, and the b channel of the first Lab image, and then body reflection components of the L channel, the a channel, and the b channel are determined. The body reflection component of the L channel of the first Lab image is a difference between an initial value of the L channel of the first Lab image and a surface reflection component of the L channel of the first Lab image; the body reflection component of the a channel of the first Lab image is a difference between an initial value of the a channel of the first Lab image and a surface reflection component of the a channel of the first Lab image; and the body reflection component of the b channel of the first Lab image is a difference between an initial value of the b channel of the first Lab image and a surface reflection component of the b channel of the first Lab image. In this way, the surface reflection components of the L channel, the a channel, and the b channel may be filtered out, to accurately extract the body reflection components from the L channel, the a channel, and the b channel.

Further, to improve pigment detection accuracy, the surface reflection components of all the L channel, the a channel, and the b channel of the first Lab image are obtained by separately performing bilateral filtering processing on the initial values of the L channel, the a channel, and the b channel of the first Lab image. This solution can help further retain edge information of the first image, thereby improving the pigment detection accuracy.

S3. The processor110combines the body reflection components extracted from the L channel, the a channel, and the b channel of the first Lab image to obtain a second Lab image.

S4. The processor110converts the second Lab image into an RGB image to obtain the first image.

Specifically, the processor110converts the second Lab image from the Lab color space into the RGB color space, to obtain the first image. The conversion from the Lab color space to the RGB color space can be performed by using an algorithm disclosed in the industry.

According to steps S1to S4, the color-related information and the color-unrelated information can be separately processed, thereby helping improve the fidelity of the first image.

It should be understood that the foregoing embodiments of this application may be used in combination, or may be separately used.

In the foregoing embodiments provided in this application, the method provided in the embodiments of this application is described from a perspective of the electronic device serving as an execution body. To implement the functions in the method provided in the embodiments of this application, the electronic device may include a hardware structure and/or a software module, and implement the functions in a form of the hardware structure, the software module, or a combination of the hardware structure and the software module. Whether a function in the foregoing functions is performed by the hardware structure, the software module, or the combination of the hardware structure and the software module depends on a particular application and a design constraint of the technical solution.

Based on a same concept,FIG.9shows an electronic device900according to this application. For example, the electronic device900includes at least one processor910, a memory920, and a display screen930, and may further include the display screen930and a camera940. The processor910is coupled to the memory920, the display screen930, and the camera940. The coupling in this embodiment of this application is an indirect coupling or a communication connection between apparatuses, units, or modules, may be in an electrical form, a mechanical form, or another form, and is used for information exchange between the apparatuses, units, or modules.

Specifically, the memory920is configured to store a program instruction.

The processor910is configured to invoke the program instruction stored in the memory920, so that the electronic device900performs the steps performed by the electronic device in the pigment detection method shown inFIG.3.

The display screen930is configured to display a pigment detection result obtained by the processor910, for example, display the pseudo-color image in step303. The display screen may further be configured to display a preview interface when the camera940starts photographing, where the preview interface includes an image acquired by the camera940, and is used to display the user interface designed in the foregoing embodiment.

It should be understood that the electronic device900may be configured to implement the pigment detection method shown inFIG.3in the embodiments of this application. For related features, refer to the foregoing descriptions. Details are not described herein again.

A person skilled in the art may clearly know that the embodiments of this application may be implemented by using 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, a computer-readable medium may include a RAM, a ROM, an electrically erasable programmable read only memory (EEPROM), a compact disc read-only memory (CD-ROM) or another optical disc storage, a magnetic disk storage medium or another magnetic storage device, or any other computer-accessible medium that can be used to carry or store expected program code in an instruction or data structure form. 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 (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 and disc used by the embodiments of this application includes a compact disc (CD), a laser disc, an optical disc, a 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.

In summary, what is described above is merely embodiments of this application, but is not intended to limit the protection scope of this application. Any modification, equivalent replacement, improvement, or the like made according to the disclosure of this application shall fall within the protection scope of this application.