WO2021169394A1 - Depth-based human body image beautification method and electronic device - Google Patents

Depth-based human body image beautification method and electronic device Download PDF

Info

Publication number
WO2021169394A1
WO2021169394A1 PCT/CN2020/126954 CN2020126954W WO2021169394A1 WO 2021169394 A1 WO2021169394 A1 WO 2021169394A1 CN 2020126954 W CN2020126954 W CN 2020126954W WO 2021169394 A1 WO2021169394 A1 WO 2021169394A1
Authority
WO
WIPO (PCT)
Prior art keywords
human body
image
electronic device
key point
camera
Prior art date
Application number
PCT/CN2020/126954
Other languages
French (fr)
Chinese (zh)
Inventor
刘梦莹
钟顺才
朱聪超
Original Assignee
荣耀终端有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 荣耀终端有限公司 filed Critical 荣耀终端有限公司
Publication of WO2021169394A1 publication Critical patent/WO2021169394A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/62Control of parameters via user interfaces
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/63Control of cameras or camera modules by using electronic viewfinders
    • H04N23/631Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
    • H04N23/632Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters for displaying or modifying preview images prior to image capturing, e.g. variety of image resolutions or capturing parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/64Computer-aided capture of images, e.g. transfer from script file into camera, check of taken image quality, advice or proposal for image composition or decision on when to take image
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof

Definitions

  • This application relates to the technical field of electronic equipment, and specifically relates to a depth-based method for beautifying human body images and electronic equipment.
  • the existing human body beautification methods are mainly concentrated on the computer side, such as the existing abode photoshop software.
  • the user needs to input portrait photos into the software, artificially mark various parts of the human body, and then manually adjust the proportion of fat to thin parts of the human body.
  • various parts of the body in the portrait photo cannot be detected automatically and accurately, and the body parts need to be manually marked, resulting in inaccurate shaping of the parts; and manual adjustment is required repeatedly until the adjustment is satisfactory.
  • the application software of some mobile terminals also realizes the function of body beauty.
  • the image is collected through the camera, and then the human body is detected, and various body parts are estimated.
  • each body part is beautified. shape.
  • the beautification process the user needs to select the various body parts that need to be beautiful, which may easily cause the overall proportion of the human body to be imbalanced, such as lengthening the head, which affects the beauty.
  • some software is difficult to achieve the expected effect in the adjustment process due to the preset limitations of the function itself.
  • the embodiments of the present application provide a depth-based human image beautification method and electronic device. Using key point detection technology, it can adaptively shape the human body image without manual and repeated adjustment, avoiding the overall proportion of the human body, and bringing updates to users. Experience.
  • the present application provides a depth-based method for beautifying human body images, which is applied to an electronic device with a display screen and a camera, and the method includes:
  • the first operation used by the user to turn on the camera is detected
  • a user interface is displayed on the display screen, the user interface includes a preview frame, the preview frame includes a first human body image of the person being photographed, the first human body image includes a depth image and Color image
  • the second operation used by the user to indicate the body shape template is detected
  • a second human body image of the photographed person is displayed in the preview frame, and the figure scale parameter of the photographed person in the second human body image is based on the figure proportion of the body shape template Parameter adaptation has been adjusted.
  • this application also provides an electronic device, including:
  • a display screen ; a camera; one or more processors; a memory; a plurality of application programs; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more
  • the computer program includes instructions that, when executed by the device, cause the device to perform the following steps:
  • the first operation used by the user to turn on the camera is detected
  • a user interface is displayed on the display screen, the user interface includes a preview frame, the preview frame includes a first human body image of the person being photographed, the first human body image includes a depth image and Color image
  • the second operation used by the user to indicate the body shape template is detected
  • a second human body image of the photographed person is displayed in the preview frame, and the figure scale parameter of the photographed person in the second human body image is based on the figure proportion of the body shape template Parameter adaptation has been adjusted.
  • the present application also provides a computer device, including a memory, a processor, and a computer program stored in the memory and capable of being run on the processor.
  • a computer device including a memory, a processor, and a computer program stored in the memory and capable of being run on the processor.
  • the computer device implements the depth-based image beautification method of the human body.
  • the present application also provides a computer program product containing instructions that, when the computer program product runs on an electronic device, causes the electronic device to execute the above-mentioned depth-based human body image beautification method.
  • the present application also provides a computer-readable storage medium, including instructions, which when run on an electronic device, cause the electronic device to execute the above-mentioned depth-based beautification method for human body images.
  • FIG. 1A is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the application.
  • FIG. 1B is a schematic diagram of the software structure of an electronic device provided by an embodiment of the application.
  • 2A is a front view of an electronic device provided by an embodiment of the application.
  • 2B is a rear view of the electronic device provided by the embodiment of the application.
  • 3A is a schematic diagram of a graphical user interface of an electronic device provided by an embodiment of this application.
  • 3B is a schematic diagram of another graphical user interface of an electronic device provided by an embodiment of the application.
  • 3C is a schematic diagram of another graphical user interface of an electronic device provided by an embodiment of the application.
  • 3D is a schematic diagram of another graphical user interface of an electronic device provided by an embodiment of the application.
  • Fig. 4 is a schematic diagram of a graphical user interface provided by the prior art
  • FIG. 5 is a schematic flowchart of a depth-based human body image beautification method provided by an embodiment of the application
  • 6A is a schematic diagram of pixels in a 2D coordinate space of a color image provided by an embodiment of the application.
  • 6B is a schematic diagram of pixels in a 2D coordinate space of a depth image provided by an embodiment of the application.
  • 6C is a schematic diagram of pixels in a 3D coordinate space of a color image provided by an embodiment of the application.
  • FIG. 7 is a schematic diagram of human bone points provided by an embodiment of the application.
  • FIG. 8 is a schematic diagram of calculating the length of the bone between the bone points according to the depth value and 2D coordinates of the bone points;
  • FIG. 9A is a schematic diagram of another graphical user interface of an electronic device provided by an embodiment of the application.
  • FIG. 9B is a schematic diagram of another graphical user interface of an electronic device provided by an embodiment of the application.
  • At least one refers to one or more, and “multiple” refers to two or more.
  • “And/or” describes the association relationship of the associated objects, indicating that there can be three relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone, where A, B can be singular or plural.
  • the character “/” generally indicates that the associated objects before and after are in an “or” relationship.
  • the following at least one item (a)” or similar expressions refers to any combination of these items, including any combination of a single item (a) or a plurality of items (a).
  • at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple .
  • the depth-based human image beautification method provided in the embodiments of the present application can be applied to an electronic device or a separate application program, which can realize the depth-based human image beautification method in the present application automatically after taking a picture.
  • the depth-based human body image beautification method provided by the present application can implement real-time adaptive body beautification and body shaping functions for users through key point detection technology and image processing technology, and bring users a brand-new experience.
  • the depth-based human body image beautification method provided in the embodiments of this application can be applied to electronic devices with camera functions such as mobile phones, tablet computers, and wearable devices.
  • the embodiments of this application do not impose any restrictions on the specific types of electronic devices.
  • the application “camera” of electronic devices can provide the “beauty” function.
  • the "Beauty” function can be used to adjust the body image of the person being photographed during the photo preview or video preview process, so that the body shape represented by the adjusted body image is beautified compared to the actual body shape of the person being photographed.
  • Body beautification can include: beautify the proportions of the body (such as lengthening the legs, widening the shoulders, etc.).
  • the adjustment of the body image involved in the "Beauty" function can include: determining the target position to which the key points need to be adjusted, and then using common image scaling algorithms such as bicubic, bilinear, and nearest neighbors to adjust the body image between the key points A scaling process is performed so that the key points can be located at their corresponding target positions after the human body image is scaled, so as to achieve the purpose of beautifying the body proportions.
  • the adjustment of the human body image involved in the "Beauty” function can also include: adopting common image scaling algorithms such as bicubic, bilinear, and neighboring to perform image scaling (scale) processing on the overall body image of the person being photographed to realize the adjustment.
  • image processing related to stovepipe may include compressing the image of the leg using an image scaling algorithm, and the leg image after the compression processing shows that the leg is slimmer than the actual leg of the person being photographed.
  • the image processing of the waist shaping design may include: using an image scaling algorithm to compress the middle part of the waist image, and stretch the upper and lower ends of the waist image.
  • the waist image after this image processing is shown
  • the waist is more curvilinear than the actual waist of the person being photographed, and the waist image represented by the waist image after such image processing can be an S-shaped waist (the waist is thin in the middle).
  • this processing performed on a body image may be referred to as body beauty processing.
  • the "beauty” function can be integrated into the "portrait” photographing function and video recording function included in the "camera” application.
  • the "Beauty” function can also be used as an independent camera function in the "Camera” application.
  • the "Portrait” camera function is a camera function set when the subject is a person, to highlight the person and enhance the beauty of the person in the captured picture.
  • the electronic device can use a larger aperture to keep the depth of field shallow, to highlight the character, and to improve the color effect to optimize the skin tone of the character.
  • the electronic device can also turn on the flashlight for illumination compensation.
  • Camera is an image capture application on smart phones, tablet computers and other electronic devices. This application does not restrict the name of the application.
  • the "portrait” camera function and video function may be the camera function included in the “camera” application.
  • the “camera” application can also include a variety of other camera functions.
  • the camera parameters such as aperture size, shutter speed, and sensitivity for different camera functions can be different, and different camera effects can be presented.
  • the camera function can also be called the camera mode, for example, the "portrait” camera function can also be called the “portrait” camera mode.
  • FIG. 1A shows a schematic structural diagram of an electronic device 100.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, and an antenna 2.
  • Mobile communication module 150 wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, 3D camera module 193, display screen 194, and subscriber identification module (subscriber identification module, SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light Sensor 180L, bone conduction sensor 180M, etc.
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100.
  • the electronic device 100 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or arrange different components.
  • the illustrated components can be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU), etc.
  • AP application processor
  • modem processor modem processor
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller video codec
  • digital signal processor digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the different processing units may be independent devices or integrated in one or more processors.
  • the controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching instructions and executing instructions.
  • a memory may also be provided in the processor 110 to store instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory can store instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.
  • the processor 110 may include one or more interfaces.
  • the interface can include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, and a universal asynchronous transmitter (universal asynchronous) interface.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART universal asynchronous transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB Universal Serial Bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL).
  • the processor 110 may include multiple sets of I2C buses.
  • the processor 110 may be coupled to the touch sensor 180K, charger, flash, 3D camera module 193, etc., respectively through different I2C bus interfaces.
  • the processor 110 may couple the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C bus interface to implement the touch function of the electronic device 100.
  • the I2S interface can be used for audio communication.
  • the processor 110 may include multiple sets of I2S buses.
  • the processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170.
  • the audio module 170 may transmit audio signals to the wireless communication module 160 through an I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communication to sample, quantize and encode analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 may also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus can be a two-way communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • the UART interface is generally used to connect the processor 110 and the wireless communication module 160.
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to realize the Bluetooth function.
  • the audio module 170 may transmit audio signals to the wireless communication module 160 through a UART interface, so as to realize the function of playing music through a Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with the display screen 194, the 3D camera module 193 and other peripheral devices.
  • the MIPI interface includes a camera serial interface (camera serial interface, CSI), a display serial interface (display serial interface, DSI), and so on.
  • the processor 110 and the 3D camera module 193 communicate through a CSI interface to implement the shooting function of the electronic device 100.
  • the processor 110 and the display screen 194 communicate through a DSI interface to realize the display function of the electronic device 100.
  • the GPIO interface can be configured through software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can be used to connect the processor 110 with the 3D camera module 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and so on.
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 130 is an interface that complies with the USB standard specification, and specifically may be a Mini USB interface, a Micro USB interface, a USB Type C interface, and so on.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect earphones and play audio through earphones. This interface can also be used to connect other electronic devices, such as AR devices.
  • the interface connection relationship between the modules illustrated in the embodiment of the present application is merely a schematic description, and does not constitute a structural limitation of the electronic device 100.
  • the electronic device 100 may also adopt different interface connection modes in the foregoing embodiments, or a combination of multiple interface connection modes.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 140 may receive the charging input of the wired charger through the USB interface 130.
  • the charging management module 140 may receive the wireless charging input through the wireless charging coil of the electronic device 100. While the charging management module 140 charges the battery 142, it can also supply power to the electronic device through the power management module 141.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charge management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the 3D camera module 193, and the wireless communication module 160.
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, and battery health status (leakage, impedance).
  • the power management module 141 may also be provided in the processor 110.
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
  • the antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna can be used in combination with a tuning switch.
  • the mobile communication module 150 can provide a wireless communication solution including 2G/3G/4G/5G and the like applied to the electronic device 100.
  • the mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), and the like.
  • the mobile communication module 150 can receive electromagnetic waves by the antenna 1, and perform processing such as filtering, amplifying and transmitting the received electromagnetic waves to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor, and convert it into electromagnetic waves for radiation via the antenna 1.
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110.
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays an image or video through the display screen 194.
  • the modem processor may be an independent device.
  • the modem processor may be independent of the processor 110 and be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), and global navigation satellites. System (global navigation satellite system, GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110.
  • the wireless communication module 160 may also receive a signal to be sent from the processor 110, perform frequency modulation, amplify, and convert it into electromagnetic waves to radiate through the antenna 2.
  • the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite-based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite-based augmentation systems
  • the electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is an image processing microprocessor, which is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations and is used for graphics rendering.
  • the processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos, and the like.
  • the display screen 194 includes a display panel.
  • the display panel can use liquid crystal display (LCD), organic light-emitting diode (OLED), active matrix organic light-emitting diode or active-matrix organic light-emitting diode (active-matrix organic light-emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • active-matrix organic light-emitting diode active-matrix organic light-emitting diode
  • AMOLED flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (QLED), etc.
  • the electronic device 100 may include one or N display screens 194, and N is a positive integer greater than one.
  • the electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
  • the camera 193 can be used to collect color image data and depth data of the subject.
  • the ISP can be used to process the color image data collected by the 3D camera module 193. For example, when taking a picture, the shutter is opened, the light is transmitted to the photosensitive element of the camera through the lens, the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing and is converted into an image visible to the naked eye.
  • ISP can also optimize the image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193.
  • the camera 193 may be composed of a color camera module and a 3D sensing module.
  • the photosensitive element of the camera of the color camera module may be a charge coupled device (CCD) or a complementary metal-oxide semiconductor (CMOS) phototransistor.
  • CCD charge coupled device
  • CMOS complementary metal-oxide semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transfers the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the 3D sensing module may be a (time of flight, TOF) 3D sensing module or a structured light (structured light) 3D sensing module.
  • structured light 3D sensing is an active depth sensing technology, and the basic components of the structured light 3D sensing module may include infrared (Infrared) emitters, IR camera modules, and so on.
  • the working principle of the structured light 3D sensing module is to first emit a specific pattern of light spots on the object to be photographed, and then receive the light coding on the surface of the object, and then compare the similarities and differences with the original projected light spots. And use the triangulation principle to calculate the three-dimensional coordinates of the object.
  • the three-dimensional coordinates include the distance between the electronic device 100 and the object to be photographed.
  • TOF 3D sensing is also an active depth sensing technology.
  • the basic components of a TOF 3D sensing module can include an infrared (Infrared) transmitter, an IR camera module, and so on.
  • the working principle of the TOF 3D sensing module is to calculate the distance (that is, depth) between the TOF 3D sensing module and the object to be photographed through the time of the infrared foldback, so as to obtain a 3D depth map.
  • the structured light 3D sensing module can also be used in fields such as face recognition, somatosensory game consoles, and industrial machine vision detection.
  • TOF 3D sensing modules can also be applied to game consoles, augmented reality (AR)/virtual reality (VR) and other fields.
  • AR augmented reality
  • VR virtual reality
  • the camera 193 may also be composed of two or more cameras.
  • the two or more cameras may include a color camera, and the color camera may be used to collect color image data of the photographed object.
  • the two or more cameras can use stereo vision technology to collect depth data of the object being photographed.
  • Stereo vision technology is based on the principle of human eye parallax. Under natural light sources, two or more cameras shoot images of the same object from different angles, and then perform triangulation and other calculations to obtain the electronic device 100 and the camera. The distance information between the photographs, that is, the depth information.
  • the electronic device 100 may include one or N cameras 193, and N is a positive integer greater than one.
  • the electronic device 100 may include a front camera 193 and a rear camera 193.
  • the front camera 193 can usually be used to collect the photographer's own color image data and depth data facing the display 194, and the rear 3D camera module 193 can be used to collect the photographic objects (such as people, landscapes, etc.) faced by the photographer. Etc.) color image data and depth data.
  • the CPU, GPU, or NPU in the processor 110 may process the color image data and depth data collected by the 3D camera module 193.
  • the NPU can recognize the color images collected by the 3D camera module 193 (specifically, the color camera module) through the neural network algorithm based on the key point recognition technology, such as the convolutional neural network algorithm (CNN). Data to determine the key points of the person being photographed.
  • the CPU or GPU can also run neural network algorithms to determine the key points of the person being photographed based on the color image data.
  • the CPU, GPU, or NPU can also be used to confirm the figure of the person being photographed (such as Body proportions, fatness and thinness of body parts between key points), and can further determine the body beautification parameters for the photographed person, and finally process the photographed image of the photographed person according to the body beautification parameters to make the shooting
  • the figure of the person being photographed in the image is beautified. Subsequent embodiments will introduce in detail how to perform body beautification processing on the image of the photographed person based on the color image data and depth data collected by the 3D camera module 193, which will not be repeated here.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects the frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, and so on.
  • MPEG moving picture experts group
  • MPEG2 MPEG2, MPEG3, MPEG4, and so on.
  • NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • applications such as intelligent cognition of the electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, and so on.
  • the external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example, save music, video and other files in an external memory card.
  • the internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions.
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area can store an operating system, an application program (such as a sound playback function, an image playback function, etc.) required by at least one function, and the like.
  • the data storage area can store data (such as audio data, phone book, etc.) created during the use of the electronic device 100.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
  • the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. For example, music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal.
  • the audio module 170 can also be used to encode and decode audio signals.
  • the audio module 170 may be provided in the processor 110, or part of the functional modules of the audio module 170 may be provided in the processor 110.
  • the speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the electronic device 100 answers a call or voice message, it can receive the voice by bringing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone”, “microphone”, is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through the human mouth, and input the sound signal into the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement noise reduction functions in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions.
  • the earphone interface 170D is used to connect wired earphones.
  • the earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, and a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA, CTIA
  • the pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal.
  • the pressure sensor 180A may be provided on the display screen 194.
  • the capacitive pressure sensor may include at least two parallel plates with conductive materials.
  • the electronic device 100 determines the intensity of the pressure according to the change in capacitance.
  • the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A.
  • touch operations that act on the same touch position but have different touch operation strengths may correspond to different operation instructions. For example: when a touch operation whose intensity of the touch operation is less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the movement posture of the electronic device 100.
  • the angular velocity of the electronic device 100 around three axes ie, x, y, and z axes
  • the gyro sensor 180B can be used for image stabilization.
  • the gyro sensor 180B detects the shake angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to counteract the shake of the electronic device 100 through reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 uses the air pressure value measured by the air pressure sensor 180C to calculate the altitude to assist positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 may use the magnetic sensor 180D to detect the opening and closing of the flip holster.
  • the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D.
  • features such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices, and apply to applications such as horizontal and vertical screen switching, pedometers, and so on.
  • the electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 may use the distance sensor 180F to measure the distance to achieve fast focusing.
  • the proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector such as a photodiode.
  • the light emitting diode may be an infrared light emitting diode.
  • the electronic device 100 emits infrared light to the outside through the light emitting diode.
  • the electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100.
  • the electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
  • the proximity light sensor 180G can also be used in leather case mode, and the pocket mode will automatically unlock and lock the screen.
  • the ambient light sensor 180L is used to sense the brightness of the ambient light.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived brightness of the ambient light.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touch.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photographs, fingerprint answering calls, and so on.
  • the temperature sensor 180J is used to detect temperature.
  • the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection.
  • the electronic device 100 when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature.
  • the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194, and the touch screen is composed of the touch sensor 180K and the display screen 194, which is also called a “touch screen”.
  • the touch sensor 180K is used to detect touch operations acting on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • the visual output related to the touch operation can be provided through the display screen 194.
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100, which is different from the position of the display screen 194.
  • the bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can obtain the vibration signal of the vibrating bone mass of the human voice.
  • the bone conduction sensor 180M can also contact the human pulse and receive the blood pressure pulse signal.
  • the bone conduction sensor 180M may also be provided in the earphone, combined with the bone conduction earphone.
  • the audio module 170 can parse the voice signal based on the vibration signal of the vibrating bone block of the voice obtained by the bone conduction sensor 180M, and realize the voice function.
  • the application processor can analyze the heart rate information based on the blood pressure beating signal obtained by the bone conduction sensor 180M, and realize the heart rate detection function.
  • the button 190 includes a power-on button, a volume button, and so on.
  • the button 190 may be a mechanical button. It can also be a touch button.
  • the electronic device 100 may receive key input, and generate key signal input related to user settings and function control of the electronic device 100.
  • the motor 191 can generate vibration prompts.
  • the motor 191 can be used for incoming call vibration notification, and can also be used for touch vibration feedback.
  • touch operations applied to different applications can correspond to different vibration feedback effects.
  • Acting on touch operations in different areas of the display screen 194, the motor 191 can also correspond to different vibration feedback effects.
  • Different application scenarios for example: time reminding, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, or to indicate messages, missed calls, notifications, and so on.
  • the SIM card interface 195 is used to connect to the SIM card.
  • the SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device 100.
  • the electronic device 100 may support 1 or N SIM card interfaces, and N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
  • the same SIM card interface 195 can insert multiple cards at the same time. The types of the multiple cards can be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 may also be compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to implement functions such as call and data communication.
  • the electronic device 100 adopts an eSIM, that is, an embedded SIM card.
  • the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
  • the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the embodiment of the present application takes an Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 by way of example.
  • FIG. 1B is a software structure block diagram of an electronic device 100 according to an embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Communication between layers through software interface.
  • the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
  • the application layer can include a series of application packages.
  • the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and so on.
  • the window manager is used to manage window programs.
  • the window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, take a screenshot, etc.
  • the content provider is used to store and retrieve data and make these data accessible to applications.
  • the data may include videos, images, audios, phone calls made and received, browsing history and bookmarks, phone book, etc.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, and so on.
  • the view system can be used to build applications.
  • the display interface can be composed of one or more views.
  • a display interface that includes a short message notification icon may include a view that displays text and a view that displays pictures.
  • the phone manager is used to provide the communication function of the electronic device 100. For example, the management of the call status (including connecting, hanging up, etc.).
  • the resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
  • the notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and it can automatically disappear after a short stay without user interaction.
  • the notification manager is used to notify download completion, message reminders, and so on.
  • the notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or a scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, text messages are prompted in the status bar, prompt sounds, electronic devices vibrate, and indicator lights flash.
  • Android Runtime includes core libraries and virtual machines. Android runtime is responsible for the scheduling and management of the Android system.
  • the core library consists of two parts: one part is the function functions that the java language needs to call, and the other part is the core library of Android.
  • the application layer and application framework layer run in a virtual machine.
  • the virtual machine executes the java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), three-dimensional graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc.
  • the surface manager is used to manage the display subsystem and provides a combination of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
  • the media library can support multiple audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing.
  • the 2D graphics engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
  • the corresponding hardware interrupt is sent to the kernel layer.
  • the kernel layer processes touch operations into original input events (including touch coordinates, time stamps of touch operations, etc.).
  • the original input events are stored in the kernel layer.
  • the application framework layer obtains the original input event from the kernel layer and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation, and the control corresponding to the click operation is the control of the camera application icon as an example, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer.
  • the 3D camera module 193 captures still images or videos.
  • the following describes an exemplary user interface for application menus on the electronic device 100.
  • FIG. 2A exemplarily shows an exemplary user interface 21 for an application menu on the electronic device 100.
  • the electronic device 100 may be configured with a 3D camera module 193.
  • 193-1 may be a color camera
  • 193-2 may be a structured light 3D camera module.
  • 193-1 may be a color camera
  • 193-2 may be a TOF 3D camera module.
  • 193-1 and 193-2 may be two color cameras.
  • the 3D camera module 193 may be disposed on the top of the electronic device 100, such as the "bangs" position of the electronic device 100 (ie, the area AA shown in FIG. 2A).
  • the area AA may also include an illuminator 197 (not shown in FIG. 1A), a speaker 170A, a proximity light sensor 180G, an ambient light sensor 180L, and the like.
  • a 3D camera module 193 and an illuminator 197 may also be configured on the back of the electronic device 100.
  • the user interface 21 may include: a status bar 201, a tray 223 with icons of commonly used applications, a calendar indicator 203, a weather indicator 205, a navigation bar 225, and other application icons. in:
  • the status bar 201 may include: one or more signal strength indicators 201-1 of a mobile communication signal (also called a cellular signal), an indicator 201-2 of an operator of the mobile communication signal, a time indicator 201-3, Battery status indicator 201-4 etc.
  • the calendar indicator 203 can be used to indicate the current time, such as date, day of the week, hour and minute information, and so on.
  • the weather indicator 205 can be used to indicate the type of weather, such as cloudy to clear, light rain, etc., and can also be used to indicate information such as temperature.
  • the tray 223 with icons of commonly used application programs can display: a phone icon 223-1, a short message icon 223-2, a contact icon 221-4, and so on.
  • the navigation bar 225 may include system navigation keys such as a return button 225-1, a main interface (Gome screen) button 225-3, and a call-out task history button 225-5.
  • system navigation keys such as a return button 225-1, a main interface (Gome screen) button 225-3, and a call-out task history button 225-5.
  • the electronic device 100 may display the previous page of the current page.
  • the main interface button 225-3 the electronic device 100 may display the main interface.
  • the electronic device 100 may display the task recently opened by the user.
  • the naming of each navigation key can also be other, which is not limited in this application. Not limited to virtual keys, each navigation key in the navigation bar 225 can also be implemented as a physical key.
  • Other application icons can be for example: Wechat TM (Wechat TM ) icon 211, QQ TM icon 212, Twitter TM (Twitter TM ) icon 213, Facebook TM (Facebook TM ) icon 214, mailbox TM icon 215 , Cloud sharing icon 216, memo icon 217, setting icon 218, gallery icon 219, camera icon 220.
  • the user interface 21 may also include a page indicator 221.
  • the icons of other applications may be distributed on multiple pages, and the page indicator 221 may be used to indicate the application in which page the user is currently browsing. The user can swipe the area of other application icons left and right to browse application icons in other pages.
  • the user interface 21 exemplarily shown in FIG. 2A may be a main interface (Gome screen).
  • the electronic device 100 may also include a home button.
  • the main screen key can be a physical key or a virtual key (such as key 225-3).
  • the home screen key can be used to receive instructions from the user and return the currently displayed UI to the home interface, so that it is convenient for the user to view the home screen at any time.
  • the above instruction can be an operation instruction for the user to press the home screen key once, or an operation instruction for the user to press the home screen key twice in a short period of time, or the user to press and hold the home screen key for a predetermined period of time. Operation instructions.
  • the home screen key can also be integrated with a fingerprint recognizer, so that when the home screen key is pressed, fingerprints are collected and recognized accordingly.
  • the electronic device can detect a touch operation (such as a click operation on the icon 220) acting on the icon 220 of the camera, and in response to this operation, it can display the user interface 31 exemplarily shown in FIG. 3B.
  • the user interface 31 may be a user interface of a “camera” application program, which may be used by the user to take pictures, such as taking pictures and videos.
  • "Camera” is an image capture application on smart phones, tablet computers and other electronic devices. This application does not restrict the name of the application.
  • the user can click the icon 220 to open the user interface 31 of the “camera”.
  • the user can also open the user interface 31 in other applications, for example, the user clicks the shooting control in "WeChatTM " to open the user interface 31.
  • WeChatTM is a social application that allows users to share photos taken with others.
  • FIG. 3B exemplarily shows a user interface 31 of the "camera” application on an electronic device such as a smart phone.
  • the user interface 31 may include: an area 301, a shooting mode list 302, a control 303, a control 304, and a control 305. in:
  • the area 301 may be referred to as a preview frame 301.
  • the preview frame 301 can be used to display the color images collected by the 3D camera module 193 in real time.
  • the electronic device can refresh the displayed content in it in real time, so that the user can preview the color image currently collected by the camera 193.
  • the 3D camera module 193 may be a rear camera or a front camera.
  • the one or more shooting mode options may be displayed in the shooting mode list 302.
  • the one or more camera options may include: night scene mode option 302A, portrait mode option 302B, camera mode option 302C, video mode option 302D, and more shooting mode options 302E.
  • the one or more camera options can be expressed as text information on the interface.
  • the night scene mode option 302A, portrait mode option 302B, camera mode option 302C, video mode option 302D, and more shooting mode options 302E can respectively correspond to the text "night scene”. , "Portrait”, “Photograph”, “Video”, “More”.
  • the one or more camera options may also be represented as icons or other forms of interactive elements (IE) on the interface.
  • the electronic device 100 may select the camera mode option 302C by default, and the display state of the camera mode option 302C (eg, the camera mode option 302C is highlighted) may indicate that the camera mode option 302C has been selected.
  • the electronic device 100 can detect a user operation acting on the shooting mode option, and the user operation can be used to select a shooting mode, and in response to the operation, the electronic device 100 can start the shooting mode selected by the user.
  • the electronic device 100 may further display more other shooting mode options, such as large aperture shooting mode options, slow motion shooting mode options, etc., which can be shown to the user Richer camera functions.
  • more shooting mode options 302E may not be displayed in the shooting mode list 302, and the user can browse other shooting mode options by sliding left/right in the shooting mode list 302.
  • the control 303 can be used to monitor user operations that trigger shooting (photographing or video recording).
  • the electronic device can detect a user operation that acts on the control 303 (such as a click operation on the control 303), and in response to the operation, the electronic device 100 can save the image in the preview box 301.
  • the saved image can be a picture or a video.
  • the electronic device 100 may also display a thumbnail of the saved image in the control 304.
  • the control 303 may be a button or other forms of control.
  • the control 303 may be referred to as a shooting control.
  • the control 304 can be used to monitor the user operation that triggers the camera switch.
  • the electronic device 100 can detect a user operation (such as a click operation on the control 304) acting on the control 304, and in response to the operation, the electronic device 100 can switch the camera (such as switching the rear camera to the front camera, or the front camera). Switch to the rear camera).
  • the control 305 can be used to monitor the user operation that triggers the opening of the "gallery".
  • the electronic device 100 can detect a user operation (such as a click operation on the control 305) acting on the control 305, and in response to the operation, the electronic device 100 can display a user interface of the "Gallery", and the user interface can display the electronic device 100 saved pictures.
  • the "gallery” is a picture management application on electronic devices such as smart phones, tablet computers, etc., and can also be referred to as "album”, and the name of the application is not limited in this embodiment.
  • "Gallery” can support users to perform various operations on pictures stored on electronic devices, such as browsing, editing, deleting, and selecting operations.
  • the user interface 31 can show the user a variety of camera functions (modes) provided by the "camera", and the user can choose to turn on the corresponding shooting mode by clicking the shooting mode option.
  • modes camera functions
  • UI user interface
  • FIG. 3C exemplarily shows the user interface 32 provided by the "portrait” photographing function of the "camera” application.
  • the electronic device 100 can detect a user operation that acts on the portrait mode option 302B (such as a click operation on the portrait mode option 302B), and in response to the user operation, the electronic device 100 can turn on "portrait” to take photos Function and display the user interface exemplarily shown in Fig. 3C.
  • a user operation that acts on the portrait mode option 302B (such as a click operation on the portrait mode option 302B)
  • the electronic device 100 can turn on "portrait” to take photos Function and display the user interface exemplarily shown in Fig. 3C.
  • the portrait mode option may be referred to as the first shooting mode option.
  • the user interface 32 includes a preview box 301, a shooting mode list 302, a control 303, a control 304, a control 305, and a control 306 and a control 207.
  • the preview box 301, the shooting mode list 302, the control 303, the control 304, and the control 305 can refer to the related description in the user interface 31, which will not be repeated here.
  • the control 306 can be used to monitor the user operation of opening the light effect template option
  • the control 307 can be used to monitor the user operation of opening the character beautification option.
  • the electronic device 100 may display a variety of light effect template options in the user interface 31.
  • Different light effect templates can represent (or correspond to) different light effect parameters, such as light source position, layer fusion parameters, texture pattern projection position, projection direction, etc. Users can choose different light effect templates to make the photos obtained by shooting show different effects. This application does not limit the interface expression form of the multiple light effect template options in the user interface 31.
  • the electronic device 100 may display the user interface 33 exemplarily shown in FIG. 3C.
  • Fig. 3C exemplarily shows the user interface provided by the character beautification function. The following content will introduce the user interface exemplarily shown in FIG. 3C in detail, and will not be repeated here.
  • the electronic device 100 may also update the display state of the portrait mode option, and the updated display state may indicate that the portrait mode has been selected.
  • the updated display state may be the text information "portrait” corresponding to the highlight shooting mode option 303B.
  • the updated display status can also present other interface expressions, such as the font of the text information "Portrait” becomes larger, the text information "Portrait” is framed, the text information "Portrait” is underlined, and options 303B The color is deepened and so on.
  • the electronic device 100 may output prompt information 308 in the preview box 301 ,
  • the prompt message 308 may be the text "No person detected", which may be used to prompt the electronic device 100 that no person is detected.
  • the character beautification function can be integrated into the "portrait" camera function.
  • the character beautification function may also be a camera function in the “camera” application.
  • the photographing mode list 302 in the user interface 31 may display a character beautification mode option.
  • the electronic device 100 may display the user interface provided by the character beautification function exemplarily shown in FIG. 3D.
  • FIG. 3D exemplarily shows the user interface 33 provided by the character beautification function of the "camera” application.
  • the user interface 33 includes a preview box 301, a shooting mode list 302, a control 303, a control 304, a control 305, as well as a skin beautification option 309 and a body beautification option 310.
  • the preview box 301, the shooting mode list 302, the control 303, the control 304, and the control 305 can refer to the related description in the user interface 31, which will not be repeated here.
  • the skin beautification option 309 and the body beautification option 310 may be represented as icons on the interface, as shown in FIG. 3D. Not limited to icons, the skin beautification option 309 and the body beautification option 310 can also be expressed as text (such as the text "beauty skin", “beauty body”) or other forms of interactive elements (IE) on the interface.
  • icons such as the text "beauty skin”, “beauty body” or other forms of interactive elements (IE) on the interface.
  • the electronic device 100 detects a user operation (such as a click operation on the beautifying option 310) that acts on the beautifying option 310, the user operation is used to select the beautifying option 310.
  • a user operation such as a click operation on the beautifying option 310
  • the electronic device 100 may analyze whether the color image collected by the 3D camera module 193 contains key points of the human body based on the key point recognition technology. If the key points of the human body are included, it is determined that a person is detected; otherwise, it is determined that no person is detected.
  • the specific implementation of determining the key points of the human body based on the key point recognition technology will be described in detail in the follow-up content, and will not be expanded here.
  • the existing human body beautification methods are mainly concentrated on the computer side, such as the existing abode photoshop software.
  • the user needs to input portrait photos into the software, artificially mark various parts of the human body, and then manually adjust the proportion of fat to thin parts of the human body.
  • various parts of the body in the portrait photo cannot be detected automatically and accurately, and the body parts need to be manually marked, resulting in inaccurate shaping of the parts; and manual adjustment is required repeatedly until the adjustment is satisfactory.
  • the application software of some mobile terminals also implements the body beauty function.
  • the image is collected through the camera, and then the human body is detected, and various body parts are estimated.
  • Each body part (area A as shown in Figure 4) performs body shaping.
  • the user needs to select the various body parts that need to be beautiful, which may easily cause the overall proportion of the human body to be imbalanced, such as lengthening the head, which affects the beauty.
  • some software is difficult to achieve the expected effect in the adjustment process due to the preset limitations of the function itself.
  • the existing portrait photos lack 3D depth information, and 2D color images are acquired through a monocular camera, and the 3D depth information is lost.
  • the body proportion data before and after beautification cannot be known, and the adjustment is blind.
  • FIG. 5 is a schematic flowchart of a depth-based human body image beautification method provided by an embodiment of the present application. As shown in FIG. 5, the method may include the following steps:
  • FIG. 6 is a schematic flowchart of a depth-based human body image beautification method provided by an embodiment of the present application. As shown in FIG. 6, the method may include the following steps:
  • Step S01 detecting the first operation used by the user to turn on the camera
  • Step S02 in response to the first operation, display a user interface on the display screen, the user interface including a preview frame, the preview frame includes a first human body image of the person being photographed, and the first human body image includes a depth image And color images;
  • Step S03 using a preset key point detection model to determine multiple key points of the human body in the color image, and using the depth image data and camera parameters to determine position information of the multiple key points of the human body;
  • Step S04 Determine the body proportion parameter of the photographed person according to the position information of the multiple key points of the human body
  • Step S05 It is detected that a second operation of the user instructing the camera is detected, and the second operation is an operation of instructing the body shape template by the user;
  • Step S06 in response to the second operation, display a second human body image of the photographed person in the preview frame, and the figure proportion parameter of the photographed person in the second human body image is determined by the body shape template.
  • the body proportion parameters are adjusted adaptively.
  • the key point detection model is used to identify multiple key points of the human body, and the figure scale parameters of the person being photographed are determined according to the position information of the key points of the human body, and then the body proportion parameters of the body shape template set by the user are adaptively adjusted.
  • the body proportion parameters of the person being photographed are described, and the beautified image of the human body after beautification is obtained.
  • users only need to select the corresponding body shape template to perform body beauty processing on the captured human body image, without manual and repeated adjustment, avoiding the overall proportion of the human body and bringing a newer experience to the user.
  • Step S01 detecting the first operation used by the user to turn on the camera
  • Step S02 in response to the first operation, display a user interface on the display screen, the user interface including a preview frame, the preview frame includes a first human body image of the person being photographed, and the first human body image includes Depth image and color image.
  • the user's shooting behavior may include a first operation of the user to turn on the camera; in response to the first operation, a user interface is displayed on the display screen.
  • Fig. 3A shows a graphical user interface (GUI) of the mobile phone, and the GUI is the desktop of the mobile phone.
  • GUI graphical user interface
  • the electronic device detects that the user clicks the icon 220 of the camera application (application, APP) on the desktop, it can start the camera application and display another GUI as shown in FIG. 3B, which may be referred to as the user interface 31.
  • the user interface 31 may include a preview box 301. In the preview state, the preview image can be displayed in the preview frame 301 in real time.
  • a first human body image may be displayed in the preview frame 301, and the first human body image is a color image.
  • the user interface may also include a control 303 for indicating the photographing mode, and other photographing controls.
  • the electronic device can turn on the 3D camera module, and collect a color image and a depth image through the 3D camera module, and the depth image includes the depth information of the person being photographed.
  • the color image includes the image of the person being photographed (that is, the foreground image) and the background image.
  • a color image may include multiple pixels, each of which has two-dimensional coordinates and color values.
  • the color value can be an RGB value or a YUV value.
  • the depth image may include a plurality of pixels, and each pixel has a two-dimensional coordinate and a depth value.
  • the color value of the corresponding pixel in the color image represents the color of the position (such as the color of clothing, the color of bare skin, etc.), and the position corresponds to the depth image
  • the depth value of the pixel point represents the vertical distance between the position and the electronic device (specifically, it may be a 3D camera module).
  • the two-dimensional coordinates of the pixel point corresponding to the position A in the color image is (x1, y1), and the pixel point
  • the RGB value of (255, 255, 255); the two-dimensional coordinates of the pixel point corresponding to position A in the depth image is (x1, y1), and the depth value of the pixel point is 350 cm.
  • the color at position A is white, and the vertical distance between position A and the electronic device is 350 cm.
  • Step S03 Determine a plurality of human body key points in the color image by using a preset key point detection model, and determine the position information of the plurality of human body key points according to the depth image and the parameters of the camera.
  • the electronic device may use the color image of the photographed person and the key point detection model to identify the human body key points of the photographed person. Recognizing the key points of the human body refers to determining the 2D coordinates of the key points.
  • the input of the key point detection model may be a color image of the human body
  • the output may be the 2D coordinates of the key point of the human body.
  • the electronic device can specifically take the color image of the captured person as input, and obtain the 2D coordinates of each key point in the color image of the captured person through the recognition of the key point detection model.
  • the key points of the human body include head key point 1, right ear key point 2, left ear key point 3, neck key point 4, right shoulder key point 5, left shoulder key point 6, right chest key point 7, left Chest key point 8, right waist key point 9, left waist key point 10, right hip key point 11, left hip key point 12, right knee key point 13, left knee key point 14, right foot key point 15, left foot key point Point 16, crotch key point 17, right elbow key point 18, right wrist key point 19, left elbow key point 20, and left wrist key point 21.
  • the key point detection model may be, for example, an hourglass network model.
  • the key point detection model is composed of four densely connected hourglass networks; the key point detection model is trained using the preset training set, and the minimum mean square error loss function is used in the training process to make the hourglass network converge and obtain a trained Key point detection model.
  • the hourglass network can effectively detect the key points of the target object.
  • the hourglass network includes an input layer, a convolutional layer, a pooling layer, an up-sampling layer, a down-sampling layer, and so on.
  • the output of the previous hourglass network is the input of the adjacent hourglass network.
  • each hourglass network adopts a relay supervision strategy to supervise and train the loss of the network.
  • the convolution layer can include many convolution operators.
  • the convolution operator is also called the kernel. Its role in image processing is equivalent to a filter that extracts specific information from the input image matrix.
  • the convolution operator can essentially It is a weight matrix. This weight matrix is usually predefined. In the process of image convolution operation, the weight matrix is usually one pixel after one pixel (or two pixels after two pixels) along the horizontal direction on the input image. Based on the value of stride), the work of extracting specific features from the image is completed.
  • a pooling layer after the convolutional layer. It can be a convolutional layer followed by a pooling layer, or a multi-layer convolutional layer followed by a pooling layer.
  • One or more pooling layers In the image processing process, the sole purpose of the pooling layer is to reduce the size of the image space.
  • the pooling layer may include an average pooling operator and/or a maximum pooling operator for sampling the input image to obtain an image with a smaller size.
  • the average pooling operator can calculate the pixel values in the image within a specific range to generate an average value as the result of the average pooling.
  • the maximum pooling operator can take the pixel with the largest value within a specific range as the result of the maximum pooling.
  • the operators in the pooling layer should also be related to the image size.
  • the size of the image output after processing by the pooling layer can be smaller than the size of the image of the input pooling layer, and each pixel in the image output by the pooling layer represents the average value or the maximum value of the corresponding sub-region of the image input to the pooling layer.
  • the method before determining multiple human key points in the color image by using a preset key point detection model, the method further includes:
  • the minimum mean square error loss function is used to make the hourglass network converge, and the trained key point detection model is obtained.
  • the training set includes a plurality of human body image samples.
  • the human body image samples in the training set need to be preprocessed, for example, the human body image samples are cropped to a standard size, the environmental interference area is removed, and the cropped human body image samples Manually mark each key point.
  • the preprocessed training samples are input into the fourth-order hourglass network, which includes the upper road and the lower road.
  • the live pig image sample is down-sampled four times.
  • the upper-level road processes the original-size human body image
  • the lower-level road down-samples the original-size human body image and then performs up-sampling processing.
  • the intermediate characteristics of the original size 1/2, 1/4, and 1/8 can be extracted from the original size.
  • the image is restored to the original size by upsampling, which is consistent with the original size.
  • the data is added, and then a residual network is used for feature extraction; between two downsampling, three primary modules are used to extract features; between two additions, one primary module is used to extract features.
  • each hourglass network is down-sampling through the pooling layer, and neighboring interpolation is up-sampling, so that key point features can be extracted from top to bottom and bottom to top in each size. Jumping connections are used between the hourglasses, so that the key point position information at each resolution is preserved.
  • the bone recognition accuracy of the trained key point detection model meets the preset requirements.
  • the position information of the multiple key points of the human body is determined according to the depth image and camera parameters.
  • the depth value of the key points under the same coordinates is determined from the depth image
  • the position information of the key points of the human body is obtained, that is, the 3D coordinates.
  • the 3D coordinates are (x, y, z), x represents the abscissa of the pixel, y represents the ordinate of the pixel, and z represents the depth value of the pixel.
  • two-dimensional coordinates of each photographed part of the photographed person can be determined.
  • two-dimensional coordinates and depth values can represent 3D coordinates.
  • the color image and the depth image shown in FIG. 6A and FIG. 6B respectively can be combined into the distribution of color values in the 3D coordinate space, as shown in FIG. 6C.
  • the z-axis represents the depth value.
  • the photographed part refers to the part of the image collected by the 3D camera module.
  • the photographed part of the photographed person may include the front face such as face and stomach.
  • the body parts of the 3D camera module, but the buttocks and back are not part of the photographed parts.
  • Step S04 Determine the body proportion parameter of the photographed person according to the position information of the multiple key points of the human body.
  • the body proportion parameter includes one or more of head-to-body ratio, upper-to-body ratio, lower-body ratio, head-to-shoulder ratio, head-to-waist ratio, head-to-hip ratio, and shoulder-to-body ratio.
  • the electronic device may determine the length of the bones between the key points according to the depth value of the key points and the 2D coordinates of the key points. For example, as shown in FIG. 8, the vertical distances between the left hip point P1 and the left knee point P2 of the person being photographed and the electronic device will be D1 and D2, respectively.
  • the head-to-body ratio X 1 2*D 1-4 /(D 4-15 +D 4-16 ), where D nm represents the length from the key point n to the key point m calculated using 3D depth information.
  • the vertical distances between the key point 12 of the left hip, the key point 14 of the left knee and the electronic device of the photographed person will be D1 and D2, respectively.
  • the distance L between the left hip point 12 and the left knee point 14 can be calculated from the 2D coordinates of 12 and the 2D coordinates of 14. Therefore, the length between the left hip key point 12 and the left knee key point 14 can be calculated
  • the upper to lower body ratio X 2 (D 4-12 +D 4-11 )/(D 11-15 +D 12-16 ), where 4 represents the key point of the neck, 11 represents the key point of the right hip, and 12 represents For the key points of the left hip, 15 represents the key point of the right foot, and 16 represents the key point of the left foot.
  • Lower body ratio X 3 (D 11-13 +D 12-14 )/(D 13-15 +D 14-16 ), where 11 represents the key point of the right hip, 12 represents the key point of the left hip, and 13 represents the key point of the right knee Point, 14 represents the key point of the left knee, 15 represents the key point of the right foot, and 16 represents the key point of the left foot.
  • Head to shoulder ratio X 4 D 2-3 /D 5-6 , where 2 represents the key point of the right ear, 3 represents the key point of the left ear, 5 represents the key point of the right shoulder, and 6 represents the key point of the left shoulder.
  • Head-to-waist ratio X 5 D 2-3 /D 9-10 , where 2 represents the key point of the right ear, 3 represents the key point of the left ear, 9 represents the key point of the right waist, and 10 represents the key point of the left waist.
  • the head-to-hip ratio X 6 D 2-3 /D 11-12 , where 2 represents the key point of the right ear, 3 represents the key point of the left ear, 11 represents the key point of the right hip, and 12 represents the key point of the left hip.
  • Shoulder-to-body ratio X 7 2*D 5-6 /(D 5-15 +D 6-16 ), where 5 represents the key point of the right shoulder, 6 represents the key point of the left shoulder, 15 represents the key point of the right foot, and 16 represents the key point of the left foot key point.
  • the figure proportion parameter of the photographed person is determined, the figure proportion parameter of the body shape template is further determined, and the figure proportion parameter of the photographed person is compared with the figure proportion parameter of the body shape template one by one.
  • Step S05 The second operation of the user indicating the body shape template is detected.
  • the second operation of the user using the captured human body image as the body shape template is detected.
  • the second operation of the user selecting a body shape template from the preset body shape template library is detected.
  • the user can randomly select any photo containing a human body image in the gallery as a body shape template, or select a default body shape template in the body shape template library, or the user can take another person's image and import it as a body shape template.
  • the body scale parameter of the default body shape template has been stored in the "Camera" application, so that it can Quickly compare the figure ratio parameters of the body shape template with the figure ratio parameters of the person being photographed.
  • the method when making a body shape template, the method includes:
  • the color image of the body shape template and the body proportion parameter of the body shape template are saved together in a preset body shape template library.
  • the body shape template and its body proportion parameters are saved in the body shape template library, so that the user can call it in time.
  • the body shape parameter of the body shape template is also first detected by the key point detection model, and then obtained according to the recognition
  • the obtained 2D coordinates of multiple key points of the human body calculate the body proportion parameter.
  • the pose of the person in the body shape template selected by the user in the non-body shape template library should be similar to the pose of the person being photographed.
  • the 2D coordinates of the left hip key point 12 of the human body in the body shape template are (x 12 , y 12 ), and the 2D coordinates of the left knee key point 14 are (x 14 , y 14 ). Therefore, the length between the left hip key point 12 and the left knee key point 14 can be calculated
  • Also calculate the body proportion parameters of the body shape template including head-to-body ratio, upper-to-bottom ratio, lower-body ratio, head-to-shoulder ratio, head-to-waist ratio, head-to-hip ratio, and shoulder-to-body ratio.
  • Step S06 in response to the second operation, display a second human body image of the photographed person in the preview frame, and the figure proportion parameter of the photographed person in the second human body image is determined by the body shape template.
  • the body proportion parameters are adjusted adaptively.
  • step S06 includes:
  • the key point is adjusted according to the adjustment position information required by the key point, so that the figure proportion parameter of the photographed person is compatible with the figure proportion parameter of the body shape template.
  • the preset range of the parameter difference is ⁇ 5%.
  • the head-to-shoulders ratio X4 2/3 in the figure ratio parameter of the body shape template.
  • the posture of the body shape template and the posture of the subject may be different.
  • the posture of the subject can be determined based on the color image of the person being photographed and the depth information of the person being photographed.
  • the electronic device can transform the posture of the body shape template into the posture of the person being photographed through the similar transformation. Specifically, the electronic device can compare the displacements of the bone points of the two postures in the two-dimensional space, and the relative included angles of the two limbs connected by the bone points of the person being photographed.
  • the electronic device can rotate or translate the bone points of the body shape template and the limbs connected by the bone points, so that the posture of the transformed body shape template is consistent with the posture of the subject.
  • the body proportion parameter of the electronic device body shape template adjusts the body proportion parameter to be adjusted.
  • This embodiment also provides a computer storage medium in which computer instructions are stored,
  • the electronic device When the computer instruction runs on the electronic device, the electronic device is caused to execute the above-mentioned related method steps to implement the depth-based human body image beautification method in the above-mentioned embodiment.
  • This embodiment also provides a computer program product.
  • the computer program product runs on a computer
  • the computer executes the above-mentioned related steps to realize the depth-based human image beautification method in the above-mentioned embodiment.
  • the embodiments of the present application also provide a device.
  • the device may specifically be a chip, component or module.
  • the device may include a processor and a memory connected to each other.
  • the memory is used to store computer execution instructions.
  • the processor can execute the computer-executable instructions stored in the memory, so that the chip executes the depth-based human body image beautification method in the foregoing method embodiments.
  • the electronic device, computer storage medium, computer program product, or chip provided in this embodiment are all used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the corresponding method provided above. The beneficial effects of the method will not be repeated here.
  • the disclosed device and method may be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of modules or units is only a logical function division.
  • there may be other division methods for example, multiple units or components may be combined or It can be integrated into another device, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate parts may or may not be physically separate, and the parts displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium.
  • the technical solutions of the embodiments of the present application are essentially or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of a software product, and the software product is stored in a storage medium. It includes several instructions to make a device (which may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods of the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read only memory (read only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Human Computer Interaction (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

A depth-based human body image beautification method, applied to an electronic device having a display screen and a camera. The method comprises: detecting a first operation of a user; displaying a user interface on a display screen, the preview box of the user interface comprising a first human body image of a person to be photographed, the first human body image comprising a depth image and a color image; determining multiple human body key points in the color image using a preset key point detection model, and determining the position information of the multiple human body key points according to the depth image and the parameters of the camera; determining the body proportion parameter of said person according to the position information of the multiple human body key points; detecting a second operation of the user; and displaying a second human body image of said person in the preview box, the body proportion parameter of said person in the second human body image being adaptively adjusted. The method provided by embodiments of the present application can adaptively perform body shaping on a human body image, thereby bringing an updated user experience to a user.

Description

基于深度的人体图像美化方法及电子设备Depth-based human body image beautification method and electronic equipment
本申请要求于2020年02月25日提交中国专利局,申请号为202010117261.7、申请名称为“基于深度的人体图像美化方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on February 25, 2020, the application number is 202010117261.7, and the application name is "Depth-based human image beautification method and electronic equipment", the entire content of which is incorporated by reference In this application.
技术领域Technical field
本申请涉及电子设备技术领域,具体涉及基于深度的人体图像美化方法及+电子设备。This application relates to the technical field of electronic equipment, and specifically relates to a depth-based method for beautifying human body images and electronic equipment.
背景技术Background technique
目前,现有的人体美化方法主要集中在电脑端,例如现有的abode photoshop软件,用户需要将人像照片输入软件,人为标记出人体的各个部位,然后人工手动调节人体局部的胖瘦比例。在美化处理过程中,不能自动准确地检测出人像照片中的身体各个部位,需要手动标记身体部位,导致塑形部位不够准确;并且,需要反复人工手动调节,直至调节到自己满意的效果。At present, the existing human body beautification methods are mainly concentrated on the computer side, such as the existing abode photoshop software. The user needs to input portrait photos into the software, artificially mark various parts of the human body, and then manually adjust the proportion of fat to thin parts of the human body. In the beautification process, various parts of the body in the portrait photo cannot be detected automatically and accurately, and the body parts need to be manually marked, resulting in inaccurate shaping of the parts; and manual adjustment is required repeatedly until the adjustment is satisfactory.
有些移动终端(例如手机)的应用软件也实现了美体功能,通过摄像头采集到图像,然后检测出人体,估计出各身体部位,根据用户设定的美体塑形参数来对各个身体部位进行美体塑形。美化过程中,用户需要一一选择需要美体的各个身体部位,容易导致人体整体比例失调,例如把头部拉长了,影响美感。而且,有些软件因为功能本身预设的限制,在调节过程中难以达到预期的效果。The application software of some mobile terminals (such as mobile phones) also realizes the function of body beauty. The image is collected through the camera, and then the human body is detected, and various body parts are estimated. According to the body shaping parameters set by the user, each body part is beautified. shape. In the beautification process, the user needs to select the various body parts that need to be beautiful, which may easily cause the overall proportion of the human body to be imbalanced, such as lengthening the head, which affects the beauty. Moreover, some software is difficult to achieve the expected effect in the adjustment process due to the preset limitations of the function itself.
申请内容Application content
本申请实施例提供基于深度的人体图像美化方法及电子设备,利用关键点检测技术,能够自适应地对人体图像进行美体塑形,无需手动反复调节,避免人体整体比例失调,为用户带来更新的使用体验。The embodiments of the present application provide a depth-based human image beautification method and electronic device. Using key point detection technology, it can adaptively shape the human body image without manual and repeated adjustment, avoiding the overall proportion of the human body, and bringing updates to users. Experience.
第一方面,本申请提供一种基于深度的人体图像美化方法,应用于具有显示屏和摄像头的电子设备,所述方法包括:In the first aspect, the present application provides a depth-based method for beautifying human body images, which is applied to an electronic device with a display screen and a camera, and the method includes:
检测到用户用于打开相机的第一操作;The first operation used by the user to turn on the camera is detected;
响应于所述第一操作,在所述显示屏显示用户界面,所述用户界面包括预览框,所述预览框内包括被拍摄人物的第一人体图像,所述第一人体图像包括深度图像及彩色图像;In response to the first operation, a user interface is displayed on the display screen, the user interface includes a preview frame, the preview frame includes a first human body image of the person being photographed, the first human body image includes a depth image and Color image
利用预设的关键点检测模型确定所述彩色图像中的多个人体关键点,并根据所述深度图像及所述摄像头的参数确定所述多个人体关键点的位置信息;Determining a plurality of human body key points in the color image by using a preset key point detection model, and determining position information of the plurality of human body key points according to the depth image and the parameters of the camera;
根据所述多个人体关键点的位置信息确定所述被拍摄人物的身材比例参数;Determining the body proportion parameter of the photographed person according to the position information of the multiple key points of the human body;
检测到所述用户用于指示体型模板的第二操作;The second operation used by the user to indicate the body shape template is detected;
响应于所述第二操作,在所述预览框内显示所述被拍摄人物的第二人体图像,所述第二人体图像中所述被拍摄人物的身材比例参数根据所述体型模板的身材比例参数自适应进行了调整处理。In response to the second operation, a second human body image of the photographed person is displayed in the preview frame, and the figure scale parameter of the photographed person in the second human body image is based on the figure proportion of the body shape template Parameter adaptation has been adjusted.
第二方面,本申请还提供了一种电子设备,包括:In the second aspect, this application also provides an electronic device, including:
显示屏;摄像头;一个或多个处理器;存储器;多个应用程序;以及一个或多个计算机程序,其中所述一个或多个计算机程序被存储在所述存储器中,所述一个或多个计算机程序包括指令,当所述指令被所述设备执行时,使得所述设备执行以下步骤:A display screen; a camera; one or more processors; a memory; a plurality of application programs; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more The computer program includes instructions that, when executed by the device, cause the device to perform the following steps:
检测到用户用于打开相机的第一操作;The first operation used by the user to turn on the camera is detected;
响应于所述第一操作,在所述显示屏显示用户界面,所述用户界面包括预览框,所述预览框内包括被拍摄人物的第一人体图像,所述第一人体图像包括深度图像及彩色图像;In response to the first operation, a user interface is displayed on the display screen, the user interface includes a preview frame, the preview frame includes a first human body image of the person being photographed, the first human body image includes a depth image and Color image
利用预设的关键点检测算法确定所述彩色图像中的多个人体关键点,并利用所述深度图像及所述摄像头的参数确定所述多个人体关键点的位置信息;Using a preset key point detection algorithm to determine multiple key points of the human body in the color image, and using the depth image and the parameters of the camera to determine the position information of the multiple key points of the human body;
根据所述多个人体关键点的位置信息确定所述被拍摄人物的身材比例参数;Determining the body proportion parameter of the photographed person according to the position information of the multiple key points of the human body;
检测到所述用户用于指示体型模板的第二操作;The second operation used by the user to indicate the body shape template is detected;
响应于所述第二操作,在所述预览框内显示所述被拍摄人物的第二人体图像,所述第二人体图像中所述被拍摄人物的身材比例参数根据所述体型模板的身材比例参数自适应进行了调整处理。In response to the second operation, a second human body image of the photographed person is displayed in the preview frame, and the figure scale parameter of the photographed person in the second human body image is based on the figure proportion of the body shape template Parameter adaptation has been adjusted.
第三方面,本申请还提供一种计算机设备,包括存储器,处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时使得所述计算机设备实现上述的基于深度的人体图像美化方法。In a third aspect, the present application also provides a computer device, including a memory, a processor, and a computer program stored in the memory and capable of being run on the processor. When the processor executes the computer program, The computer device implements the depth-based image beautification method of the human body.
第四方面,本申请还提供一种包含指令的计算机程序产品,当所述计算机程序产品在电子设备上运行时,使得所述电子设备执行上述的基于深度的人体图像美化方法。In a fourth aspect, the present application also provides a computer program product containing instructions that, when the computer program product runs on an electronic device, causes the electronic device to execute the above-mentioned depth-based human body image beautification method.
第五方面,本申请还提供一种计算机可读存储介质,包括指令,当所述指令在电子设备上运行时,使得所述电子设备执行上述的基于深度的人体图像美化方法。In a fifth aspect, the present application also provides a computer-readable storage medium, including instructions, which when run on an electronic device, cause the electronic device to execute the above-mentioned depth-based beautification method for human body images.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained from these drawings without creative labor.
图1A为本申请实施例提供的电子设备的硬件结构示意图;FIG. 1A is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the application;
图1B为本申请实施例提供的电子设备的软件结构示意图;FIG. 1B is a schematic diagram of the software structure of an electronic device provided by an embodiment of the application;
图2A为本申请实施例提供的电子设备的主视图;2A is a front view of an electronic device provided by an embodiment of the application;
图2B为本申请实施例提供的电子设备的后视图;2B is a rear view of the electronic device provided by the embodiment of the application;
图3A为本申请实施例提供的电子设备的一种图形用户界面示意图;3A is a schematic diagram of a graphical user interface of an electronic device provided by an embodiment of this application;
图3B为本申请实施例提供的电子设备的另一种图形用户界面示意图;3B is a schematic diagram of another graphical user interface of an electronic device provided by an embodiment of the application;
图3C为本申请实施例提供的电子设备的另一种图形用户界面示意图;3C is a schematic diagram of another graphical user interface of an electronic device provided by an embodiment of the application;
图3D为本申请实施例提供的电子设备的另一种图形用户界面示意图;3D is a schematic diagram of another graphical user interface of an electronic device provided by an embodiment of the application;
图4为现有技术提供的一种图形用户界面示意图;Fig. 4 is a schematic diagram of a graphical user interface provided by the prior art;
图5为本申请实施例提供的基于深度的人体图像美化方法的流程示意图;FIG. 5 is a schematic flowchart of a depth-based human body image beautification method provided by an embodiment of the application;
图6A为本申请实施例提供的彩色图像的在2D坐标空间中的像素点示意图;6A is a schematic diagram of pixels in a 2D coordinate space of a color image provided by an embodiment of the application;
图6B为本申请实施例提供的深度图像的在2D坐标空间中的像素点示意图;6B is a schematic diagram of pixels in a 2D coordinate space of a depth image provided by an embodiment of the application;
图6C为本申请实施例提供的彩色图像的在3D坐标空间中的像素点示意图;6C is a schematic diagram of pixels in a 3D coordinate space of a color image provided by an embodiment of the application;
图7为本申请实施例提供的人体骨骼点的示意图;FIG. 7 is a schematic diagram of human bone points provided by an embodiment of the application;
图8为根据骨骼点的深度值以及2D坐标确定骨骼点之间的骨骼的长度的计算示意图;8 is a schematic diagram of calculating the length of the bone between the bone points according to the depth value and 2D coordinates of the bone points;
图9A为本申请实施例提供的电子设备的另一种图形用户界面示意图;FIG. 9A is a schematic diagram of another graphical user interface of an electronic device provided by an embodiment of the application;
图9B为本申请实施例提供的电子设备的另一种图形用户界面示意图。FIG. 9B is a schematic diagram of another graphical user interface of an electronic device provided by an embodiment of the application.
具体实施方式Detailed ways
为了更好的理解本申请的技术方案,下面结合附图对本申请实施例进行详细描述。In order to better understand the technical solutions of the present application, the following describes the embodiments of the present application in detail with reference to the accompanying drawings.
应当明确,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。It should be clear that the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b,或c中的至少一项(个),可以表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c可以是单个,也可以是多个。In this application, "at least one" refers to one or more, and "multiple" refers to two or more. "And/or" describes the association relationship of the associated objects, indicating that there can be three relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone, where A, B can be singular or plural. The character "/" generally indicates that the associated objects before and after are in an "or" relationship. "The following at least one item (a)" or similar expressions refers to any combination of these items, including any combination of a single item (a) or a plurality of items (a). For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple .
为了便于理解,示例的给出了部分与本申请实施例相关概念的说明以供参考。如下所示:For ease of understanding, some illustrations of concepts related to the embodiments of the present application are given as examples for reference. As follows:
本申请实施例提供的基于深度的人体图像美化方法,可以应用于电子设备,也可是单独的应用程序,该应用程序可实现本申请中在拍照后自动实现基于深度的人体图像美化方法。具体地,本申请提供的基于深度的人体图像美化方法可以通过关键点检测技术和图像处理技术为用户实现实时自适应人体美化塑身功能,为用户带来全新的体验。The depth-based human image beautification method provided in the embodiments of the present application can be applied to an electronic device or a separate application program, which can realize the depth-based human image beautification method in the present application automatically after taking a picture. Specifically, the depth-based human body image beautification method provided by the present application can implement real-time adaptive body beautification and body shaping functions for users through key point detection technology and image processing technology, and bring users a brand-new experience.
本申请实施例提供的基于深度的人体图像美化方法可以应用于手机、平板电脑、可穿戴设备等具有拍照功能的电子设备上,本申请实施例对电子设备的具体类型不作任何限制。The depth-based human body image beautification method provided in the embodiments of this application can be applied to electronic devices with camera functions such as mobile phones, tablet computers, and wearable devices. The embodiments of this application do not impose any restrictions on the specific types of electronic devices.
本申请以下实施例中,智能手机等电子设备的应用程序“相机”可提供“美体”功能。其中,“美体”功能可用于在拍照预览或录像预览过程中对被拍摄人物的身体图像进行调整,使得调整后的身体图像所表现的体型相较于被拍摄人物的实际体型发生了体型美化。体型美化可包括:美化身体比例(如拉长腿部、扩宽肩部等)。“美体”功能所涉及的对身体图像进行调整可以包括:确定关键点需要调整到的目标位置,然后 可以采用双立方、双线性、近邻等常见的图像缩放算法对关键点之间的人体图像进行缩放(scale)处理,使得在人体图像被缩放后关键点能够位于其对应的目标位置,以实现美化身体比例的目的。In the following embodiments of this application, the application "camera" of electronic devices such as smart phones can provide the "beauty" function. Among them, the "Beauty" function can be used to adjust the body image of the person being photographed during the photo preview or video preview process, so that the body shape represented by the adjusted body image is beautified compared to the actual body shape of the person being photographed. Body beautification can include: beautify the proportions of the body (such as lengthening the legs, widening the shoulders, etc.). The adjustment of the body image involved in the "Beauty" function can include: determining the target position to which the key points need to be adjusted, and then using common image scaling algorithms such as bicubic, bilinear, and nearest neighbors to adjust the body image between the key points A scaling process is performed so that the key points can be located at their corresponding target positions after the human body image is scaled, so as to achieve the purpose of beautifying the body proportions.
“美体”功能所涉及的对人体图像进行调整还可以包括:采用双立方、双线性、近邻等常见的图像缩放算法来对被拍摄人物的整体身体图像进行图像缩放(scale)处理来实现调整身体胖瘦或塑形的目的。例如瘦腿涉及的图像处理可包括采用图像缩放算法对腿部图像进行压缩处理,压缩处理后的腿部图像表现的腿部比被拍摄人物的实际腿部更苗条。又例如腰部塑形设计的图像处理可包括:采用图像缩放算法对腰部图像的中间部分进行压缩处理,对腰部图像的上下两端进行拉伸处理,经过这种图像处理后的腰部图像所表现的腰部比被拍摄人物的实际腰部更有曲线,经过这种图像处理后的腰部图像所表现的腰部可以为S形腰部(腰部中间细)。本申请以下实施例中,对身体图像进行的这种处理可以称为美体处理。The adjustment of the human body image involved in the "Beauty" function can also include: adopting common image scaling algorithms such as bicubic, bilinear, and neighboring to perform image scaling (scale) processing on the overall body image of the person being photographed to realize the adjustment. The purpose of body fatness or shaping. For example, image processing related to stovepipe may include compressing the image of the leg using an image scaling algorithm, and the leg image after the compression processing shows that the leg is slimmer than the actual leg of the person being photographed. For another example, the image processing of the waist shaping design may include: using an image scaling algorithm to compress the middle part of the waist image, and stretch the upper and lower ends of the waist image. The waist image after this image processing is shown The waist is more curvilinear than the actual waist of the person being photographed, and the waist image represented by the waist image after such image processing can be an S-shaped waist (the waist is thin in the middle). In the following embodiments of the present application, this processing performed on a body image may be referred to as body beauty processing.
本申请以下实施例中,“美体”功能可以集成于“相机”应用程序中包括的“人像”拍照功能、录像功能。“美体”功能也可以作为“相机”应用程序中的独立的摄像功能。“人像”拍照功能是针对拍摄对象为人物时设置的摄像功能,以突出人物,提升拍摄图片中人物的美感。当电子设备开启“人像”拍照功能时,电子设备可以采用较大的光圈保持景深较浅,以突出人物,并可以改善色彩效果,以优化人物肤色。在检测到环境光线强度低于一定阈值时,电子设备还可以开启闪光灯进行光照补偿。In the following embodiments of the present application, the "beauty" function can be integrated into the "portrait" photographing function and video recording function included in the "camera" application. The "Beauty" function can also be used as an independent camera function in the "Camera" application. The "Portrait" camera function is a camera function set when the subject is a person, to highlight the person and enhance the beauty of the person in the captured picture. When the electronic device turns on the "portrait" camera function, the electronic device can use a larger aperture to keep the depth of field shallow, to highlight the character, and to improve the color effect to optimize the skin tone of the character. When it is detected that the ambient light intensity is lower than a certain threshold, the electronic device can also turn on the flashlight for illumination compensation.
“相机”是智能手机、平板电脑等电子设备上的一款图像拍摄的应用程序,本申请对该应用程序的名称不做限制。“人像”拍照功能、录像功能可以是“相机”应用程序中包括的摄像功能。除此之外,“相机”应用程序还可以包括其他多种摄像功能,在不同摄像功能对应的光圈大小、快门速度以及感光度等摄像参数可以不相同,可以呈现出不同的摄像效果。摄像功能又可以称为摄像模式,例如“人像”拍照功能又可以称为“人像”拍照模式。"Camera" is an image capture application on smart phones, tablet computers and other electronic devices. This application does not restrict the name of the application. The "portrait" camera function and video function may be the camera function included in the "camera" application. In addition, the "camera" application can also include a variety of other camera functions. The camera parameters such as aperture size, shutter speed, and sensitivity for different camera functions can be different, and different camera effects can be presented. The camera function can also be called the camera mode, for example, the "portrait" camera function can also be called the "portrait" camera mode.
可以理解的是,“美体”、“人像”只是本实施例中所使用的一些词语,其代表的含义在本实施例中已经记载,其名称并不能对本实施例构成任何限制。本申请实施例中提到的“美体”,在其他一些实施例中也可以被称为例如“瘦身塑型”等其他名字。It is understandable that "beauty" and "portrait" are just some words used in this embodiment, and their meanings have been recorded in this embodiment, and their names do not constitute any limitation on this embodiment. The "beauty" mentioned in the embodiments of this application may also be referred to by other names such as "slimming and shaping" in other embodiments.
首先介绍本申请以下实施例中提供的示例性电子设备100。图1A示出了电子设备100的结构示意图。电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,3D摄像模组193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。First, an exemplary electronic device 100 provided in the following embodiments of the present application is introduced. FIG. 1A shows a schematic structural diagram of an electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, and an antenna 2. , Mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, 3D camera module 193, display screen 194, and subscriber identification module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light Sensor 180L, bone conduction sensor 180M, etc.
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。 在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or arrange different components. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU), etc. Among them, the different processing units may be independent devices or integrated in one or more processors.
控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching instructions and executing instructions.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 to store instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can store instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, the processor 110 may include one or more interfaces. The interface can include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, and a universal asynchronous transmitter (universal asynchronous) interface. receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / Or Universal Serial Bus (USB) interface, etc.
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,3D摄像模组193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, charger, flash, 3D camera module 193, etc., respectively through different I2C bus interfaces. For example, the processor 110 may couple the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C bus interface to implement the touch function of the electronic device 100.
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, the processor 110 may include multiple sets of I2S buses. The processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may transmit audio signals to the wireless communication module 160 through an I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。The PCM interface can also be used for audio communication to sample, quantize and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface. In some embodiments, the audio module 170 may also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接 口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus used for asynchronous communication. The bus can be a two-way communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to realize the Bluetooth function. In some embodiments, the audio module 170 may transmit audio signals to the wireless communication module 160 through a UART interface, so as to realize the function of playing music through a Bluetooth headset.
MIPI接口可以被用于连接处理器110与显示屏194,3D摄像模组193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和3D摄像模组193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。The MIPI interface can be used to connect the processor 110 with the display screen 194, the 3D camera module 193 and other peripheral devices. The MIPI interface includes a camera serial interface (camera serial interface, CSI), a display serial interface (display serial interface, DSI), and so on. In some embodiments, the processor 110 and the 3D camera module 193 communicate through a CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate through a DSI interface to realize the display function of the electronic device 100.
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与3D摄像模组193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured through software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the 3D camera module 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and so on. The GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that complies with the USB standard specification, and specifically may be a Mini USB interface, a Micro USB interface, a USB Type C interface, and so on. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect earphones and play audio through earphones. This interface can also be used to connect other electronic devices, such as AR devices.
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules illustrated in the embodiment of the present application is merely a schematic description, and does not constitute a structural limitation of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection modes in the foregoing embodiments, or a combination of multiple interface connection modes.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。The charging management module 140 is used to receive charging input from the charger. Among them, the charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive the charging input of the wired charger through the USB interface 130. In some embodiments of wireless charging, the charging management module 140 may receive the wireless charging input through the wireless charging coil of the electronic device 100. While the charging management module 140 charges the battery 142, it can also supply power to the electronic device through the power management module 141.
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,3D摄像模组193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charge management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the 3D camera module 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 may also be provided in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be provided in the same device.
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna can be used in combination with a tuning switch.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通 信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide a wireless communication solution including 2G/3G/4G/5G and the like applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), and the like. The mobile communication module 150 can receive electromagnetic waves by the antenna 1, and perform processing such as filtering, amplifying and transmitting the received electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor, and convert it into electromagnetic waves for radiation via the antenna 1. In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110. In some embodiments, at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be provided in the same device as the mobile communication module 150 or other functional modules.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), and global navigation satellites. System (global navigation satellite system, GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be sent from the processor 110, perform frequency modulation, amplify, and convert it into electromagnetic waves to radiate through the antenna 2.
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。In some embodiments, the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite-based augmentation systems (SBAS).
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like. The GPU is an image processing microprocessor, which is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and is used for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用 液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos, and the like. The display screen 194 includes a display panel. The display panel can use liquid crystal display (LCD), organic light-emitting diode (OLED), active matrix organic light-emitting diode or active-matrix organic light-emitting diode (active-matrix organic light-emitting diode). AMOLED, flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, and N is a positive integer greater than one.
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
摄像头193可用于采集拍摄对象的彩色图像数据以及深度数据。ISP可用于处理3D摄像模组193采集的彩色图像数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。The camera 193 can be used to collect color image data and depth data of the subject. The ISP can be used to process the color image data collected by the 3D camera module 193. For example, when taking a picture, the shutter is opened, the light is transmitted to the photosensitive element of the camera through the lens, the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing and is converted into an image visible to the naked eye. ISP can also optimize the image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193.
在一些实施例中,摄像头193可以由彩色摄像模组和3D感测模组组成。In some embodiments, the camera 193 may be composed of a color camera module and a 3D sensing module.
在一些实施例中,彩色摄像模组的摄像头的感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxidesemiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。In some embodiments, the photosensitive element of the camera of the color camera module may be a charge coupled device (CCD) or a complementary metal-oxide semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transfers the electrical signal to the ISP to convert it into a digital image signal. ISP outputs digital image signals to DSP for processing. DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
在一些实施例中,3D感测模组可以是(time of flight,TOF)3D感测模块或结构光(structured light)3D感测模块。其中,结构光3D感测是一种主动式深度感测技术,结构光3D感测模组的基本零组件可包括红外线(Infrared)发射器、IR相机模等。结构光3D感测模组的工作原理是先对被拍摄物体发射特定图案的光斑(pattern),再接收该物体表面上的光斑图案编码(light coding),进而比对与原始投射光斑的异同,并利用三角原理计算出物体的三维坐标。该三维坐标中就包括电子设备100距离被拍摄物体的距离。其中,TOF 3D感测也是主动式深度感测技术,TOF 3D感测模组的基本组件可包括红外线(Infrared)发射器、IR相机模等。TOF 3D感测模组的工作原理是通过红外线折返的时间去计算TOF 3D感测模组跟被拍摄物体之间的距离(即深度),以得到3D景深图。In some embodiments, the 3D sensing module may be a (time of flight, TOF) 3D sensing module or a structured light (structured light) 3D sensing module. Among them, structured light 3D sensing is an active depth sensing technology, and the basic components of the structured light 3D sensing module may include infrared (Infrared) emitters, IR camera modules, and so on. The working principle of the structured light 3D sensing module is to first emit a specific pattern of light spots on the object to be photographed, and then receive the light coding on the surface of the object, and then compare the similarities and differences with the original projected light spots. And use the triangulation principle to calculate the three-dimensional coordinates of the object. The three-dimensional coordinates include the distance between the electronic device 100 and the object to be photographed. Among them, TOF 3D sensing is also an active depth sensing technology. The basic components of a TOF 3D sensing module can include an infrared (Infrared) transmitter, an IR camera module, and so on. The working principle of the TOF 3D sensing module is to calculate the distance (that is, depth) between the TOF 3D sensing module and the object to be photographed through the time of the infrared foldback, so as to obtain a 3D depth map.
结构光3D感测模组还可应用于人脸识别、体感游戏机、工业用机器视觉检测等领域。TOF 3D感测模组还可应用于游戏机、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)等领域。The structured light 3D sensing module can also be used in fields such as face recognition, somatosensory game consoles, and industrial machine vision detection. TOF 3D sensing modules can also be applied to game consoles, augmented reality (AR)/virtual reality (VR) and other fields.
在另一些实施例中,摄像头193还可以由两个或更多个摄像头构成。这两个或更多个摄像头可包括彩色摄像头,彩色摄像头可用于采集被拍摄物体的彩色图像数据。这两个或更多个摄像头可采用立体视觉(stereo vision)技术来采集被拍摄物体的深度数据。立体视觉技术是基于人眼视差的原理,在自然光源下,透过两个或两个以上的摄像头从不同的角度对同一物体拍摄影像,再进行三角测量法等运算来得到电子设备100 与被拍摄物之间的距离信息,即深度信息。In other embodiments, the camera 193 may also be composed of two or more cameras. The two or more cameras may include a color camera, and the color camera may be used to collect color image data of the photographed object. The two or more cameras can use stereo vision technology to collect depth data of the object being photographed. Stereo vision technology is based on the principle of human eye parallax. Under natural light sources, two or more cameras shoot images of the same object from different angles, and then perform triangulation and other calculations to obtain the electronic device 100 and the camera. The distance information between the photographs, that is, the depth information.
在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。具体的,电子设备100可以包括1个前置摄像头193以及1个后置摄像头193。其中,前置摄像头193通常可用于采集面对显示屏194的拍摄者自己的彩色图像数据以及深度数据,后置3D摄像模组193可用于采集拍摄者所面对的拍摄对象(如人物、风景等)的彩色图像数据以及深度数据。In some embodiments, the electronic device 100 may include one or N cameras 193, and N is a positive integer greater than one. Specifically, the electronic device 100 may include a front camera 193 and a rear camera 193. Among them, the front camera 193 can usually be used to collect the photographer's own color image data and depth data facing the display 194, and the rear 3D camera module 193 can be used to collect the photographic objects (such as people, landscapes, etc.) faced by the photographer. Etc.) color image data and depth data.
在一些实施例中,处理器110中的CPU或GPU或NPU可以对3D摄像模组193所采集的彩色图像数据和深度数据进行处理。在一些实施例中,NPU可以通过关键点识别技术所基于的神经网络算法,例如卷积神经网络算法(CNN),来识别3D摄像模组193(具体是彩色摄像模组)所采集的彩色图像数据,以确定被拍摄人物的关键点。CPU或GPU也可来运行神经网络算法以实现根据彩色图像数据确定被拍摄人物的关键点。在一些实施例中,CPU或GPU或NPU还可用于根据3D摄像模组193(具体是3D感测模组)所采集的深度数据和已识别出的关键点来确认被拍摄人物的身材(如身体比例、关键点之间的身体部位的胖瘦情况),并可以进一步确定针对该被拍摄人物的身体美化参数,最终根据该身体美化参数对被拍摄人物的拍摄图像进行处理,以使得该拍摄图像中该被拍摄人物的体型被美化。后续实施例中会详细介绍如何基于3D摄像模组193所采集的彩色图像数据和深度数据对被拍摄人物的图像进行美体处理,这里先不赘述。In some embodiments, the CPU, GPU, or NPU in the processor 110 may process the color image data and depth data collected by the 3D camera module 193. In some embodiments, the NPU can recognize the color images collected by the 3D camera module 193 (specifically, the color camera module) through the neural network algorithm based on the key point recognition technology, such as the convolutional neural network algorithm (CNN). Data to determine the key points of the person being photographed. The CPU or GPU can also run neural network algorithms to determine the key points of the person being photographed based on the color image data. In some embodiments, the CPU, GPU, or NPU can also be used to confirm the figure of the person being photographed (such as Body proportions, fatness and thinness of body parts between key points), and can further determine the body beautification parameters for the photographed person, and finally process the photographed image of the photographed person according to the body beautification parameters to make the shooting The figure of the person being photographed in the image is beautified. Subsequent embodiments will introduce in detail how to perform body beautification processing on the image of the photographed person based on the color image data and depth data collected by the 3D camera module 193, which will not be repeated here.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects the frequency point, the digital signal processor is used to perform Fourier transform on the energy of the frequency point.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, and so on.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, for example, the transfer mode between human brain neurons, it can quickly process input information, and it can also continuously self-learn. Through the NPU, applications such as intelligent cognition of the electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, and so on.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example, save music, video and other files in an external memory card.
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。处理器110通过运行存储在内部存储器121的指令,和/或存储在设置于处理器中的存储器的指令,执行电子设备100的各种功能应用以及数据处理。The internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions. The internal memory 121 may include a storage program area and a storage data area. Among them, the storage program area can store an operating system, an application program (such as a sound playback function, an image playback function, etc.) required by at least one function, and the like. The data storage area can store data (such as audio data, phone book, etc.) created during the use of the electronic device 100. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. For example, music playback, recording, etc.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110, or part of the functional modules of the audio module 170 may be provided in the processor 110.
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。The speaker 170A, also called "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。The receiver 170B, also called "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a call or voice message, it can receive the voice by bringing the receiver 170B close to the human ear.
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。The microphone 170C, also called "microphone", "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by approaching the microphone 170C through the human mouth, and input the sound signal into the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement noise reduction functions in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and realize directional recording functions.
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The earphone interface 170D is used to connect wired earphones. The earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, and a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be provided on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors and so on. The capacitive pressure sensor may include at least two parallel plates with conductive materials. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations that act on the same touch position but have different touch operation strengths may correspond to different operation instructions. For example: when a touch operation whose intensity of the touch operation is less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B may be used to determine the movement posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (ie, x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for image stabilization. Exemplarily, when the shutter is pressed, the gyro sensor 180B detects the shake angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to counteract the shake of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感 器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 uses the air pressure value measured by the air pressure sensor 180C to calculate the altitude to assist positioning and navigation.
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。The magnetic sensor 180D includes a Hall sensor. The electronic device 100 may use the magnetic sensor 180D to detect the opening and closing of the flip holster. In some embodiments, when the electronic device 100 is a flip machine, the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Furthermore, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, features such as automatic unlocking of the flip cover are set.
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices, and apply to applications such as horizontal and vertical screen switching, pedometers, and so on.
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。Distance sensor 180F, used to measure distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 may use the distance sensor 180F to measure the distance to achieve fast focusing.
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light to the outside through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode, and the pocket mode will automatically unlock and lock the screen.
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense the brightness of the ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived brightness of the ambient light. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touch.
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photographs, fingerprint answering calls, and so on.
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also called "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch screen is composed of the touch sensor 180K and the display screen 194, which is also called a “touch screen”. The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. The visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100, which is different from the position of the display screen 194.
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏, 接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can obtain the vibration signal of the vibrating bone mass of the human voice. The bone conduction sensor 180M can also contact the human pulse and receive the blood pressure pulse signal. In some embodiments, the bone conduction sensor 180M may also be provided in the earphone, combined with the bone conduction earphone. The audio module 170 can parse the voice signal based on the vibration signal of the vibrating bone block of the voice obtained by the bone conduction sensor 180M, and realize the voice function. The application processor can analyze the heart rate information based on the blood pressure beating signal obtained by the bone conduction sensor 180M, and realize the heart rate detection function.
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The button 190 includes a power-on button, a volume button, and so on. The button 190 may be a mechanical button. It can also be a touch button. The electronic device 100 may receive key input, and generate key signal input related to user settings and function control of the electronic device 100.
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。The motor 191 can generate vibration prompts. The motor 191 can be used for incoming call vibration notification, and can also be used for touch vibration feedback. For example, touch operations applied to different applications (such as photographing, audio playback, etc.) can correspond to different vibration feedback effects. Acting on touch operations in different areas of the display screen 194, the motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminding, receiving information, alarm clock, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, or to indicate messages, missed calls, notifications, and so on.
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。The SIM card interface 195 is used to connect to the SIM card. The SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device 100. The electronic device 100 may support 1 or N SIM card interfaces, and N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. The same SIM card interface 195 can insert multiple cards at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as call and data communication. In some embodiments, the electronic device 100 adopts an eSIM, that is, an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The embodiment of the present application takes an Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 by way of example.
图1B是本申请实施例的电子设备100的软件结构框图。FIG. 1B is a software structure block diagram of an electronic device 100 according to an embodiment of the present application.
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Communication between layers through software interface. In some embodiments, the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
应用程序层可以包括一系列应用程序包。The application layer can include a series of application packages.
如图1B所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。As shown in Figure 1B, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
如图1B所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。As shown in Figure 1B, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and so on.
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。The window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, take a screenshot, etc.
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。The content provider is used to store and retrieve data and make these data accessible to applications. The data may include videos, images, audios, phone calls made and received, browsing history and bookmarks, phone book, etc.
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。The view system includes visual controls, such as controls that display text, controls that display pictures, and so on. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface that includes a short message notification icon may include a view that displays text and a view that displays pictures.
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。The phone manager is used to provide the communication function of the electronic device 100. For example, the management of the call status (including connecting, hanging up, etc.).
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and it can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, and so on. The notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or a scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, text messages are prompted in the status bar, prompt sounds, electronic devices vibrate, and indicator lights flash.
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。Android Runtime includes core libraries and virtual machines. Android runtime is responsible for the scheduling and management of the Android system.
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。The core library consists of two parts: one part is the function functions that the java language needs to call, and the other part is the core library of Android.
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The application layer and application framework layer run in a virtual machine. The virtual machine executes the java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。The system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), three-dimensional graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc.
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The surface manager is used to manage the display subsystem and provides a combination of 2D and 3D layers for multiple applications.
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files. The media library can support multiple audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing.
2D图形引擎是2D绘图的绘图引擎。The 2D graphics engine is a drawing engine for 2D drawing.
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
下面结合捕获拍照场景,示例性说明电子设备100软件以及硬件的工作流程。In the following, the workflow of the software and hardware of the electronic device 100 will be exemplified in conjunction with capturing a photo scene.
当触摸传感器180K接收到触摸操作,相应的硬件中断被发给内核层。内核层将触摸操作加工成原始输入事件(包括触摸坐标,触摸操作的时间戳等信息)。原始输入事件被存储在内核层。应用程序框架层从内核层获取原始输入事件,识别该输入事件所对应的控件。以该触摸操作是触摸单击操作,该单击操作所对应的控件为相机应用图标的控件为例,相机应用调用应用框架层的接口,启动相机应用,进而通过调用内 核层启动摄像头驱动,通过3D摄像模组193捕获静态图像或视频。When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes touch operations into original input events (including touch coordinates, time stamps of touch operations, etc.). The original input events are stored in the kernel layer. The application framework layer obtains the original input event from the kernel layer and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation, and the control corresponding to the click operation is the control of the camera application icon as an example, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer. The 3D camera module 193 captures still images or videos.
下面介绍电子设备100上的用于应用程序菜单的示例性用户界面。The following describes an exemplary user interface for application menus on the electronic device 100.
图2A示例性示出了电子设备100上的用于应用程序菜单的示例性用户界面21。如图2A所示,电子设备100可以配置有3D摄像模组193。在一些实施例中,193-1可以是彩色摄像头,193-2可以是结构光3D摄像模组。在另一些实施例中,193-1可以是彩色摄像头,193-2可以是TOF 3D摄像模组。在再一些实施例中,193-1、193-2可以是两个彩色摄像头。如图2A所示,3D摄像模组193可设置于电子设备100的顶端,如电子设备100的“刘海”位置(即图2A中示出的区域AA)。可以知道,区域AA中除了包括3D摄像模组193之外,还可以包括照明器197(未在图1A中示出)、扬声器170A、接近光传感器180G、环境光传感器180L等。在一些实施例中,如图2B所示,电子设备100的背面也可以配置有3D摄像模组193,以及照明器197。FIG. 2A exemplarily shows an exemplary user interface 21 for an application menu on the electronic device 100. As shown in FIG. 2A, the electronic device 100 may be configured with a 3D camera module 193. In some embodiments, 193-1 may be a color camera, and 193-2 may be a structured light 3D camera module. In other embodiments, 193-1 may be a color camera, and 193-2 may be a TOF 3D camera module. In still other embodiments, 193-1 and 193-2 may be two color cameras. As shown in FIG. 2A, the 3D camera module 193 may be disposed on the top of the electronic device 100, such as the "bangs" position of the electronic device 100 (ie, the area AA shown in FIG. 2A). It can be known that in addition to the 3D camera module 193, the area AA may also include an illuminator 197 (not shown in FIG. 1A), a speaker 170A, a proximity light sensor 180G, an ambient light sensor 180L, and the like. In some embodiments, as shown in FIG. 2B, a 3D camera module 193 and an illuminator 197 may also be configured on the back of the electronic device 100.
如图2A所示,用户界面21可包括:状态栏201,具有常用应用程序图标的托盘223,日历指示符203,天气指示符205,导航栏225,以及其他应用程序图标。其中:As shown in FIG. 2A, the user interface 21 may include: a status bar 201, a tray 223 with icons of commonly used applications, a calendar indicator 203, a weather indicator 205, a navigation bar 225, and other application icons. in:
状态栏201可包括:移动通信信号(又可称为蜂窝信号)的一个或多个信号强度指示符201-1、移动通信信号的运营商的指示符201-2、时间指示符201-3、电池状态指示符201-4等。The status bar 201 may include: one or more signal strength indicators 201-1 of a mobile communication signal (also called a cellular signal), an indicator 201-2 of an operator of the mobile communication signal, a time indicator 201-3, Battery status indicator 201-4 etc.
日历指示符203可用于指示当前时间,例如日期、星期几、时分信息等。The calendar indicator 203 can be used to indicate the current time, such as date, day of the week, hour and minute information, and so on.
天气指示符205可用于指示天气类型,例如多云转晴、小雨等,还可以用于指示气温等信息。The weather indicator 205 can be used to indicate the type of weather, such as cloudy to clear, light rain, etc., and can also be used to indicate information such as temperature.
具有常用应用程序图标的托盘223可展示:电话图标223-1、短消息图标223-2、联系人图标221-4等。The tray 223 with icons of commonly used application programs can display: a phone icon 223-1, a short message icon 223-2, a contact icon 221-4, and so on.
导航栏225可包括:返回按键225-1、主界面(Gome screen)按键225-3、呼出任务历史按键225-5等系统导航键。当检测到用户点击返回按键225-1时,电子设备100可显示当前页面的上一个页面。当检测到用户点击主界面按键225-3时,电子设备100可显示主界面。当检测到用户点击呼出任务历史按键225-5时,电子设备100可显示用户最近打开的任务。各导航键的命名还可以为其他,本申请对此不做限制。不限于虚拟按键,导航栏225中的各导航键也可以实现为物理按键。The navigation bar 225 may include system navigation keys such as a return button 225-1, a main interface (Gome screen) button 225-3, and a call-out task history button 225-5. When it is detected that the user clicks the return button 225-1, the electronic device 100 may display the previous page of the current page. When it is detected that the user clicks the main interface button 225-3, the electronic device 100 may display the main interface. When it is detected that the user clicks the outgoing task history button 225-5, the electronic device 100 may display the task recently opened by the user. The naming of each navigation key can also be other, which is not limited in this application. Not limited to virtual keys, each navigation key in the navigation bar 225 can also be implemented as a physical key.
其他应用程序图标可例如:微信 TM(Wechat TM)的图标211、QQ TM的图标212、推特 TM(Twitter TM)的图标213、脸书 TM(Facebook TM)的图标214、邮箱 TM的图标215、云共享的图标216、备忘录的图标217、设置的图标218、图库的图标219、相机的图标220。用户界面21还可包括页面指示符221。其他应用程序图标可分布在多个页面,页面指示符221可用于指示用户当前浏览的是哪一个页面中的应用程序。用户可以左右滑动其他应用程序图标的区域,来浏览其他页面中的应用程序图标。 Other application icons can be for example: Wechat TM (Wechat TM ) icon 211, QQ TM icon 212, Twitter TM (Twitter TM ) icon 213, Facebook TM (Facebook TM ) icon 214, mailbox TM icon 215 , Cloud sharing icon 216, memo icon 217, setting icon 218, gallery icon 219, camera icon 220. The user interface 21 may also include a page indicator 221. The icons of other applications may be distributed on multiple pages, and the page indicator 221 may be used to indicate the application in which page the user is currently browsing. The user can swipe the area of other application icons left and right to browse application icons in other pages.
在一些实施例中,图2A示例性所示的用户界面21可以为主界面(Gome screen)。In some embodiments, the user interface 21 exemplarily shown in FIG. 2A may be a main interface (Gome screen).
在其他一些实施例中,电子设备100还可以包括主屏幕键。该主屏幕键可以是实体按键,也可以是虚拟按键(如按键225-3)。该主屏幕键可用于接收用户的指令,将当前显示的UI返回到主界面,这样可以方便用户随时查看主屏幕。上述指令具体可以是用户单次按下主屏幕键的操作指令,也可以是用户在短时间内连续两次按下主屏幕键的 操作指令,还可以是用户在预定时间内长按主屏幕键的操作指令。在本申请其他一些实施例中,主屏幕键还可以集成指纹识别器,以便用于在按下主屏幕键的时候,随之进行指纹采集和识别。In some other embodiments, the electronic device 100 may also include a home button. The main screen key can be a physical key or a virtual key (such as key 225-3). The home screen key can be used to receive instructions from the user and return the currently displayed UI to the home interface, so that it is convenient for the user to view the home screen at any time. The above instruction can be an operation instruction for the user to press the home screen key once, or an operation instruction for the user to press the home screen key twice in a short period of time, or the user to press and hold the home screen key for a predetermined period of time. Operation instructions. In some other embodiments of the present application, the home screen key can also be integrated with a fingerprint recognizer, so that when the home screen key is pressed, fingerprints are collected and recognized accordingly.
下面分别描述本申请涉及的一种应用场景:图像拍摄场景。The following describes an application scenario involved in this application: an image shooting scenario.
如图3A所示,电子设备可以检测到作用于相机的图标220的触控操作(如在图标220上的点击操作),响应于该操作,可以显示图3B示例性所示的用户界面31。用户界面31可以是“相机”应用程序的用户界面,可用于用户进行摄像,例如拍照片、录像。“相机”是智能手机、平板电脑等电子设备上的一款图像拍摄的应用程序,本申请对该应用程序的名称不做限制。也即是说,用户可以点击图标220来打开“相机”的用户界面31。不限于此,用户还可以在其他应用程序中打开用户界面31,例如用户在“微信 TM”中点击拍摄控件来打开用户界面31。“微信 TM”是一款社交类应用程序,可支持用户向他人分享所拍摄的照片等。 As shown in FIG. 3A, the electronic device can detect a touch operation (such as a click operation on the icon 220) acting on the icon 220 of the camera, and in response to this operation, it can display the user interface 31 exemplarily shown in FIG. 3B. The user interface 31 may be a user interface of a “camera” application program, which may be used by the user to take pictures, such as taking pictures and videos. "Camera" is an image capture application on smart phones, tablet computers and other electronic devices. This application does not restrict the name of the application. In other words, the user can click the icon 220 to open the user interface 31 of the “camera”. Not limited to this, the user can also open the user interface 31 in other applications, for example, the user clicks the shooting control in "WeChat™ " to open the user interface 31. " WeChatTM " is a social application that allows users to share photos taken with others.
图3B示例性示出了智能手机等电子设备上的“相机”应用程序的一个用户界面31。FIG. 3B exemplarily shows a user interface 31 of the "camera" application on an electronic device such as a smart phone.
如图3B所示,用户界面31可包括:区域301、拍摄模式列表302、控件303、控件304及控件305。其中:As shown in FIG. 3B, the user interface 31 may include: an area 301, a shooting mode list 302, a control 303, a control 304, and a control 305. in:
区域301可以称为预览框301。预览框301可用于显示3D摄像模组193实时采集的彩色图像。电子设备可以实时刷新其中的显示内容,以便于用户预览摄像头193当前采集的彩色图像。这里,3D摄像模组193可以是后置摄像头,或者是前置摄像头。The area 301 may be referred to as a preview frame 301. The preview frame 301 can be used to display the color images collected by the 3D camera module 193 in real time. The electronic device can refresh the displayed content in it in real time, so that the user can preview the color image currently collected by the camera 193. Here, the 3D camera module 193 may be a rear camera or a front camera.
拍摄模式列表302中可以显示有一个或多个拍摄模式选项。这一个或多个摄像选项可以包括:夜景模式选项302A、人像模式选项302B、拍照模式选项302C、录像模式选项302D以及更多拍摄模式选项302E。这一个或多个摄像选项在界面上可以表现为文字信息,例如夜景模式选项302A、人像模式选项302B、拍照模式选项302C、录像模式选项302D以及更多拍摄模式选项302E可以分别对应文字“夜景”、“人像”、“拍照”、“录像”、“更多”。不限于此,这一个或多个摄像选项在界面上还可以表现为图标或者其他形式的交互元素(interactive element,IE)。在一些实施例中,电子设备100可以默认选定拍照模式选项302C,拍照模式选项302C的显示状态(如拍照模式选项302C被高亮)可表示拍照模式选项302C已被选定。One or more shooting mode options may be displayed in the shooting mode list 302. The one or more camera options may include: night scene mode option 302A, portrait mode option 302B, camera mode option 302C, video mode option 302D, and more shooting mode options 302E. The one or more camera options can be expressed as text information on the interface. For example, the night scene mode option 302A, portrait mode option 302B, camera mode option 302C, video mode option 302D, and more shooting mode options 302E can respectively correspond to the text "night scene". , "Portrait", "Photograph", "Video", "More". Not limited to this, the one or more camera options may also be represented as icons or other forms of interactive elements (IE) on the interface. In some embodiments, the electronic device 100 may select the camera mode option 302C by default, and the display state of the camera mode option 302C (eg, the camera mode option 302C is highlighted) may indicate that the camera mode option 302C has been selected.
电子设备100可以检测到作用于拍摄模式选项的用户操作,该用户操作可用于选择拍摄模式,响应该操作,电子设备100可以开启用户选择的拍摄模式。特别的,当该用户操作作用于更多拍摄模式选项302E时,电子设备100可以进一步显示更多的其他拍摄模式选项,如大光圈拍摄模式选项、慢动作拍摄模式选项等等,可以向用户展示更丰富的摄像功能。不限于图3B所示,拍摄模式列表302中可以不显示更多拍摄模式选项302E,用户可以通过在拍摄模式列表302中向左/右滑动来浏览其他拍摄模式选项。The electronic device 100 can detect a user operation acting on the shooting mode option, and the user operation can be used to select a shooting mode, and in response to the operation, the electronic device 100 can start the shooting mode selected by the user. In particular, when the user operation acts on more shooting mode options 302E, the electronic device 100 may further display more other shooting mode options, such as large aperture shooting mode options, slow motion shooting mode options, etc., which can be shown to the user Richer camera functions. Not limited to that shown in FIG. 3B, more shooting mode options 302E may not be displayed in the shooting mode list 302, and the user can browse other shooting mode options by sliding left/right in the shooting mode list 302.
控件303可用于监听触发拍摄(拍照或录像)的用户操作。电子设备可以检测到的作用于控件303的用户操作(如在控件303上的点击操作),响应于该操作,电子设备100可以保存预览框301中的图像。保存的图像可以是图片或视频。另外,电子设备100还可以在控件304中显示所保存的图像的缩略图。也即是说,用户可以点击控件303来触发拍摄。其中,控件303可以是按钮或者其他形式的控件。本申请中,可以将控件303称 为拍摄控件。The control 303 can be used to monitor user operations that trigger shooting (photographing or video recording). The electronic device can detect a user operation that acts on the control 303 (such as a click operation on the control 303), and in response to the operation, the electronic device 100 can save the image in the preview box 301. The saved image can be a picture or a video. In addition, the electronic device 100 may also display a thumbnail of the saved image in the control 304. In other words, the user can click the control 303 to trigger the shooting. Among them, the control 303 may be a button or other forms of control. In this application, the control 303 may be referred to as a shooting control.
控件304可用于监听触发切换摄像头的用户操作。电子设备100可以检测到作用于控件304的用户操作(如在控件304上的点击操作),响应于该操作,电子设备100可以切换摄像头(如将后置摄像头切换为前置摄像头,或者将前置摄像头切换为后置摄像头)。The control 304 can be used to monitor the user operation that triggers the camera switch. The electronic device 100 can detect a user operation (such as a click operation on the control 304) acting on the control 304, and in response to the operation, the electronic device 100 can switch the camera (such as switching the rear camera to the front camera, or the front camera). Switch to the rear camera).
控件305可用于监听触发打开“图库”的用户操作。电子设备100可以检测到作用于控件305的用户操作(如在控件305上的点击操作),响应于该操作,电子设备100可以显示“图库”的用户界面,该用户界面中可显示有电子设备100保存的图片。这里,“图库”是智能手机、平板电脑等电子设备上的一款图片管理的应用程序,又可以称为“相册”,本实施例对该应用程序的名称不做限制。“图库”可以支持用户对存储于电子设备上的图片进行各种操作,例如浏览、编辑、删除、选择等操作。The control 305 can be used to monitor the user operation that triggers the opening of the "gallery". The electronic device 100 can detect a user operation (such as a click operation on the control 305) acting on the control 305, and in response to the operation, the electronic device 100 can display a user interface of the "Gallery", and the user interface can display the electronic device 100 saved pictures. Here, the "gallery" is a picture management application on electronic devices such as smart phones, tablet computers, etc., and can also be referred to as "album", and the name of the application is not limited in this embodiment. "Gallery" can support users to perform various operations on pictures stored on electronic devices, such as browsing, editing, deleting, and selecting operations.
可以看出,用户界面31可向用户展示“相机”所提供的多种摄像功能(模式),用户可以通过点击拍摄模式选项来选择开启相应的拍摄模式。It can be seen that the user interface 31 can show the user a variety of camera functions (modes) provided by the "camera", and the user can choose to turn on the corresponding shooting mode by clicking the shooting mode option.
基于上述图像拍摄场景,下面介绍电子设备100上实现的用户界面(user interface,UI)的一些实施例。Based on the above-mentioned image shooting scene, some embodiments of a user interface (UI) implemented on the electronic device 100 are introduced below.
图3C示例性示出了“相机”应用程序的“人像”拍照功能所提供的用户界面32。FIG. 3C exemplarily shows the user interface 32 provided by the "portrait" photographing function of the "camera" application.
在拍摄模式列表302中,电子设备100可以检测到作用于人像模式选项302B的用户操作(如在人像模式选项302B上的点击操作),响应于该用户操作,电子设备100可以开启“人像”拍照功能,并显示图3C示例性所示用的用户界面。前述内容中已经阐述了电子设备100开启“人像”拍照功能的定义,这里不再赘述。本申请中,人像模式选项可以称为第一拍摄模式选项。In the shooting mode list 302, the electronic device 100 can detect a user operation that acts on the portrait mode option 302B (such as a click operation on the portrait mode option 302B), and in response to the user operation, the electronic device 100 can turn on "portrait" to take photos Function and display the user interface exemplarily shown in Fig. 3C. In the foregoing content, the definition of enabling the “portrait” photographing function of the electronic device 100 has been explained, and the details are not repeated here. In this application, the portrait mode option may be referred to as the first shooting mode option.
如图3C所示,用户界面32包括:预览框301、拍摄模式列表302、控件303、控件304、控件305,以及306、控件207。其中:预览框301、拍摄模式列表302、控件303、控件304、控件305可以参考用户界面31中的相关描述,这里不再赘述。控件306可用于监听打开光效模板选项的用户操作,控件307可用于监听打开人物美化选项的用户操作。As shown in FIG. 3C, the user interface 32 includes a preview box 301, a shooting mode list 302, a control 303, a control 304, a control 305, and a control 306 and a control 207. Among them: the preview box 301, the shooting mode list 302, the control 303, the control 304, and the control 305 can refer to the related description in the user interface 31, which will not be repeated here. The control 306 can be used to monitor the user operation of opening the light effect template option, and the control 307 can be used to monitor the user operation of opening the character beautification option.
当检测到作用于控件306(如在控件306上的点击操作)的用户操作时,电子设备100可以在用户界面31中显示多种光效模板选项。不同的光效模板可以代表(或对应)不同的光效参数,如光源位置、图层融合参数、纹理图案投影的位置、投影的方向等。用户可以选择不同的光效模板使得拍摄得到的照片呈现出不同的效果。本申请对多种光效模板选项在用户界面31中的界面表现形式不做限制。When a user operation acting on the control 306 (such as a click operation on the control 306) is detected, the electronic device 100 may display a variety of light effect template options in the user interface 31. Different light effect templates can represent (or correspond to) different light effect parameters, such as light source position, layer fusion parameters, texture pattern projection position, projection direction, etc. Users can choose different light effect templates to make the photos obtained by shooting show different effects. This application does not limit the interface expression form of the multiple light effect template options in the user interface 31.
当检测到作用于控件307的用户操作(如在控件307上的点击操作)时,电子设备100可以显示图3C示例性所示的用户界面33。图3C示例性示出了人物美化功能所提供的用户界面。后续内容中会详细介绍图3C示例性示出的用户界面,这里先不赘述。When a user operation (such as a click operation on the control 307) acting on the control 307 is detected, the electronic device 100 may display the user interface 33 exemplarily shown in FIG. 3C. Fig. 3C exemplarily shows the user interface provided by the character beautification function. The following content will introduce the user interface exemplarily shown in FIG. 3C in detail, and will not be repeated here.
在一些实施例中,响应于作用于人像模式选项302B的用户操作,电子设备100还可以更新人像拍摄模式选项的显示状态,更新后的显示状态可表示人像拍摄模式已被选定。In some embodiments, in response to a user operation on the portrait mode option 302B, the electronic device 100 may also update the display state of the portrait mode option, and the updated display state may indicate that the portrait mode has been selected.
例如,更新后的显示状态可以是高亮拍摄模式选项303B对应的文本信息“人像”。不限于此,更新后的显示状态还可以呈现其他界面表现形式,如该文本信息“人像”的字体变大、该文本信息“人像”被加框、该文本信息“人像”被加下划线、选项303B 颜色加深等。For example, the updated display state may be the text information "portrait" corresponding to the highlight shooting mode option 303B. Not limited to this, the updated display status can also present other interface expressions, such as the font of the text information "Portrait" becomes larger, the text information "Portrait" is framed, the text information "Portrait" is underlined, and options 303B The color is deepened and so on.
在一些实施例中,在电子设备100开启“人像”拍照功能之后,如果电子设备100从3D摄像模组193采集到的彩色图像中没有检测到人物,则可以在预览框301中输出提示信息308,提示信息308可以是文字“未检测到人物”,可用于提示电子设备100未检测到人物。In some embodiments, after the electronic device 100 turns on the "portrait" photographing function, if the electronic device 100 does not detect a person in the color image collected by the 3D camera module 193, it may output prompt information 308 in the preview box 301 , The prompt message 308 may be the text "No person detected", which may be used to prompt the electronic device 100 that no person is detected.
从图3C可以看出,人物美化功能可以集成于“人像”拍照功能中。不限于此,人物美化功能也可以为“相机”应用程序中的摄像功能,此时,用户界面31中的拍摄模式列表302中可以显示有人物美化模式选项。响应于作用于人物美化模式选项的用户操作,电子设备100可以显示图3D示例性所示的人物美化功能所提供的用户界面。It can be seen from Figure 3C that the character beautification function can be integrated into the "portrait" camera function. Not limited to this, the character beautification function may also be a camera function in the “camera” application. At this time, the photographing mode list 302 in the user interface 31 may display a character beautification mode option. In response to a user operation acting on the character beautification mode option, the electronic device 100 may display the user interface provided by the character beautification function exemplarily shown in FIG. 3D.
图3D示例性示出了“相机”应用程序的人物美化功能所提供的用户界面33。如图3D所示,用户界面33包括:预览框301、拍摄模式列表302、控件303、控件304、控件305,以及美肤选项309、美体选项310。其中:预览框301、拍摄模式列表302、控件303、控件304、控件305可以参考用户界面31中的相关描述,这里不再赘述。FIG. 3D exemplarily shows the user interface 33 provided by the character beautification function of the "camera" application. As shown in FIG. 3D, the user interface 33 includes a preview box 301, a shooting mode list 302, a control 303, a control 304, a control 305, as well as a skin beautification option 309 and a body beautification option 310. Among them: the preview box 301, the shooting mode list 302, the control 303, the control 304, and the control 305 can refer to the related description in the user interface 31, which will not be repeated here.
美肤选项309、美体选项310在界面上可以表现为图标,可如图3D所示。不限于图标,美肤选项309、美体选项310在界面上还可以表现为文字(如文字“美肤”、“美体”)或者其他形式的交互元素(IE)。The skin beautification option 309 and the body beautification option 310 may be represented as icons on the interface, as shown in FIG. 3D. Not limited to icons, the skin beautification option 309 and the body beautification option 310 can also be expressed as text (such as the text "beauty skin", "beauty body") or other forms of interactive elements (IE) on the interface.
当电子设备100检测到作用于美体选项310的用户操作(如在美体选项310上的点击操作)时,该用户操作用于选定美体选项310。When the electronic device 100 detects a user operation (such as a click operation on the beautifying option 310) that acts on the beautifying option 310, the user operation is used to select the beautifying option 310.
在一些实施例中,在电子设备100开启“美体”功能之后,如果电子设备100从摄像头193采集的彩色图像中没有检测到人物,则可以在预览框301中输出提示信息308,提示信息308可以是文字“未检测到人物”,可用于提示电子设备100未检测到人物。具体的,电子设备100可以基于关键点识别技术来分析3D摄像模组193采集的彩色图像中是否包含人体关键点,如果包含人体关键点,则确定检测到人物,否则确定没有检测到人物。基于关键点识别技术确定人体关键点的具体实现后续内容中会详细介绍,这里先不展开。In some embodiments, after the electronic device 100 turns on the "Beauty" function, if the electronic device 100 does not detect a person in the color image collected by the camera 193, the prompt information 308 can be output in the preview box 301, and the prompt information 308 can be It is the text "No person detected", which can be used to remind the electronic device 100 that no person is detected. Specifically, the electronic device 100 may analyze whether the color image collected by the 3D camera module 193 contains key points of the human body based on the key point recognition technology. If the key points of the human body are included, it is determined that a person is detected; otherwise, it is determined that no person is detected. The specific implementation of determining the key points of the human body based on the key point recognition technology will be described in detail in the follow-up content, and will not be expanded here.
为了便于理解,本申请以下实施例将以具有图1A和图1B所示结构的电子设备(智能手机)为例,结合附图和应用场景,对本申请实施例提供的基于深度的人体图像美化方法进行具体阐述。For ease of understanding, the following embodiments of the present application will take the electronic device (smartphone) having the structure shown in FIG. 1A and FIG. Give specific explanations.
目前,现有的人体美化方法主要集中在电脑端,例如现有的abode photoshop软件,用户需要将人像照片输入软件,人为标记出人体的各个部位,然后人工手动调节人体局部的胖瘦比例。在美化处理过程中,不能自动准确地检测出人像照片中的身体各个部位,需要手动标记身体部位,导致塑形部位不够准确;并且,需要反复人工手动调节,直至调节到自己满意的效果。At present, the existing human body beautification methods are mainly concentrated on the computer side, such as the existing abode photoshop software. The user needs to input portrait photos into the software, artificially mark various parts of the human body, and then manually adjust the proportion of fat to thin parts of the human body. In the beautification process, various parts of the body in the portrait photo cannot be detected automatically and accurately, and the body parts need to be manually marked, resulting in inaccurate shaping of the parts; and manual adjustment is required repeatedly until the adjustment is satisfactory.
如图4所示,有些移动终端(例如手机)的应用软件也实现了美体功能,通过摄像头采集到图像,然后检测出人体,估计出各身体部位,根据用户设定的美体塑形参数来对各个身体部位(如图4所示区域A)进行美体塑形。美化过程中,用户需要一一选择需要美体的各个身体部位,容易导致人体整体比例失调,例如把头部拉长了,影响美感。而且,有些软件因为功能本身预设的限制,在调节过程中难以达到预期的效果。As shown in Figure 4, the application software of some mobile terminals (such as mobile phones) also implements the body beauty function. The image is collected through the camera, and then the human body is detected, and various body parts are estimated. Each body part (area A as shown in Figure 4) performs body shaping. In the beautification process, the user needs to select the various body parts that need to be beautiful, which may easily cause the overall proportion of the human body to be imbalanced, such as lengthening the head, which affects the beauty. Moreover, some software is difficult to achieve the expected effect in the adjustment process due to the preset limitations of the function itself.
进一步地,现有的人像照片缺失3D深度信息,通过单目摄像头,获取2D彩色图像,丢掉了3D深度信息,无法知道美化前后的身体比例数据,调节具有盲目性。Further, the existing portrait photos lack 3D depth information, and 2D color images are acquired through a monocular camera, and the 3D depth information is lost. The body proportion data before and after beautification cannot be known, and the adjustment is blind.
本申请实施例提供了一种基于深度的人体图像美化方法,该方法可以在具有深度摄像头及RGB摄像头的电子设备(例如手机、平板电脑等)中实现。图5是本申请实施例提供的基于深度的人体图像美化方法的示意性流程图,如图5所示,该方法可以包括以下步骤:The embodiments of the present application provide a depth-based method for beautifying human body images. The method can be implemented in an electronic device (such as a mobile phone, a tablet computer, etc.) having a depth camera and an RGB camera. FIG. 5 is a schematic flowchart of a depth-based human body image beautification method provided by an embodiment of the present application. As shown in FIG. 5, the method may include the following steps:
本申请实施例提供了一种基于深度的人体图像美化方法,该方法可以具有深度摄像头及RGB摄像头的电子设备(例如手机、平板电脑等)中实现。图6是本申请实施例提供的基于深度的人体图像美化方法的示意性流程图,如图6所示,该方法可以包括以下步骤:The embodiment of the present application provides a depth-based method for beautifying human body images. The method can be implemented in an electronic device (such as a mobile phone, a tablet computer, etc.) having a depth camera and an RGB camera. FIG. 6 is a schematic flowchart of a depth-based human body image beautification method provided by an embodiment of the present application. As shown in FIG. 6, the method may include the following steps:
步骤S01,检测到用户用于打开相机的第一操作;Step S01, detecting the first operation used by the user to turn on the camera;
步骤S02,响应于所述第一操作,在显示屏显示用户界面,所述用户界面包括预览框,所述预览框内包括被拍摄人物的第一人体图像,所述第一人体图像包括深度图像及彩色图像;Step S02, in response to the first operation, display a user interface on the display screen, the user interface including a preview frame, the preview frame includes a first human body image of the person being photographed, and the first human body image includes a depth image And color images;
步骤S03,利用预设的关键点检测模型确定所述彩色图像中的多个人体关键点,并利用所述深度图像数据及摄像头参数确定所述多个人体关键点的位置信息;Step S03, using a preset key point detection model to determine multiple key points of the human body in the color image, and using the depth image data and camera parameters to determine position information of the multiple key points of the human body;
步骤S04,根据所述多个人体关键点的位置信息确定所述被拍摄人物的身材比例参数;Step S04: Determine the body proportion parameter of the photographed person according to the position information of the multiple key points of the human body;
步骤S05,检测到所述用户指示相机的第二操作,所述第二操作为所述用户指示体型模板的操作;Step S05: It is detected that a second operation of the user instructing the camera is detected, and the second operation is an operation of instructing the body shape template by the user;
步骤S06,响应于所述第二操作,在所述预览框内显示所述被拍摄人物的第二人体图像,所述第二人体图像中所述被拍摄人物的身材比例参数被所述体型模板的身材比例参数自适应进行了调整处理。Step S06, in response to the second operation, display a second human body image of the photographed person in the preview frame, and the figure proportion parameter of the photographed person in the second human body image is determined by the body shape template. The body proportion parameters are adjusted adaptively.
在本方案中,利用关键点检测模型识别多个人体关键点,并根据人体关键点的位置信息确定被拍摄人物的身材比例参数,然后根据用户设定的体型模板的身材比例参数自适应调节所述被拍摄人物的身材比例参数,得到美化后的人体美化图像。用户在使用过程中只需要选择相应的体型模板即可对拍摄的人体图像进行美体处理,无需手动反复调节,避免人体整体比例失调,为用户带来更新的使用体验。In this solution, the key point detection model is used to identify multiple key points of the human body, and the figure scale parameters of the person being photographed are determined according to the position information of the key points of the human body, and then the body proportion parameters of the body shape template set by the user are adaptively adjusted. The body proportion parameters of the person being photographed are described, and the beautified image of the human body after beautification is obtained. In the process of use, users only need to select the corresponding body shape template to perform body beauty processing on the captured human body image, without manual and repeated adjustment, avoiding the overall proportion of the human body and bringing a newer experience to the user.
下面对本实施例提供的基于深度的人体图像美化方法的具体技术方案进行详细的说明。The specific technical solutions of the depth-based human body image beautification method provided in this embodiment will be described in detail below.
步骤S01,检测到用户用于打开相机的第一操作;Step S01, detecting the first operation used by the user to turn on the camera;
步骤S02,响应于所述第一操作,在所述显示屏显示用户界面,所述用户界面包括预览框,所述预览框内包括被拍摄人物的第一人体图像,所述第一人体图像包括深度图像及彩色图像。Step S02, in response to the first operation, display a user interface on the display screen, the user interface including a preview frame, the preview frame includes a first human body image of the person being photographed, and the first human body image includes Depth image and color image.
在一个示例中,用户的拍摄行为可以包括用户打开相机的第一操作;响应于所述第一操作,在显示屏上显示用户界面。In an example, the user's shooting behavior may include a first operation of the user to turn on the camera; in response to the first operation, a user interface is displayed on the display screen.
图3A示出了手机的一种图形用户界面(graphical user interface,GUI),该GUI为手机的桌面。当电子设备检测到用户点击桌面上的相机应用(application,APP)的 图标220的操作后,可以启动相机应用,显示如图3B所示的另一GUI,该GUI可以称为用户界面31。该用户界面31上可以包括预览框301。在预览状态下,该预览框301内可以实时显示预览图像。Fig. 3A shows a graphical user interface (GUI) of the mobile phone, and the GUI is the desktop of the mobile phone. When the electronic device detects that the user clicks the icon 220 of the camera application (application, APP) on the desktop, it can start the camera application and display another GUI as shown in FIG. 3B, which may be referred to as the user interface 31. The user interface 31 may include a preview box 301. In the preview state, the preview image can be displayed in the preview frame 301 in real time.
电子设备在启动相机后,预览框301内可以显示有第一人体图像,该第一人体图像为彩色图像。用户界面上还可以包括用于指示拍照模式的控件303,以及其它拍摄控件。After the electronic device starts the camera, a first human body image may be displayed in the preview frame 301, and the first human body image is a color image. The user interface may also include a control 303 for indicating the photographing mode, and other photographing controls.
具体地,电子设备可以开启3D摄像模组,并通过3D摄像模组采集彩色图像和深度图像,该深度图像包括被拍摄人物的深度信息。彩色图像包括被拍摄人物的图像(即前景图像)和背景图像。Specifically, the electronic device can turn on the 3D camera module, and collect a color image and a depth image through the 3D camera module, and the depth image includes the depth information of the person being photographed. The color image includes the image of the person being photographed (that is, the foreground image) and the background image.
彩色图像可以包括多个像素点,每个像素点都具有二维坐标以及颜色值。颜色值可以是RGB值或YUV值。深度图像可以包括多个像素点,每个像素点具有二维坐标以及深度值。针对被拍摄人物身体上的某个位置,该位置在彩色图像中对应的像素点的颜色值表示该位置的颜色(例如服饰的颜色、裸露的皮肤的颜色等),该位置在深度图像中对应的像素点的深度值表示该位置与电子设备(具体可以为3D摄像模组)之间的垂直距离。例如,如图6A-图6B所示,针对被拍摄人物身体上的位置A(左髋点),位置A在彩色图像中对应的像素点的二维坐标为(x1,y1),该像素点的RGB值(255,255,255);位置A在深度图像中对应的像素点的二维坐标为(x1,y1),该像素点的深度值为350厘米。这表示位置A处的颜色为白色,位置A和电子设备之间的垂直距离为350厘米。A color image may include multiple pixels, each of which has two-dimensional coordinates and color values. The color value can be an RGB value or a YUV value. The depth image may include a plurality of pixels, and each pixel has a two-dimensional coordinate and a depth value. For a certain position on the body of the person being photographed, the color value of the corresponding pixel in the color image represents the color of the position (such as the color of clothing, the color of bare skin, etc.), and the position corresponds to the depth image The depth value of the pixel point represents the vertical distance between the position and the electronic device (specifically, it may be a 3D camera module). For example, as shown in Figures 6A-6B, for the position A (left hip point) on the body of the person being photographed, the two-dimensional coordinates of the pixel point corresponding to the position A in the color image is (x1, y1), and the pixel point The RGB value of (255, 255, 255); the two-dimensional coordinates of the pixel point corresponding to position A in the depth image is (x1, y1), and the depth value of the pixel point is 350 cm. This means that the color at position A is white, and the vertical distance between position A and the electronic device is 350 cm.
步骤S03,利用预设的关键点检测模型确定所述彩色图像中的多个人体关键点,并根据所述深度图像及所述摄像头的参数确定所述多个人体关键点的位置信息。Step S03: Determine a plurality of human body key points in the color image by using a preset key point detection model, and determine the position information of the plurality of human body key points according to the depth image and the parameters of the camera.
具体的,电子设备可以利用被拍摄人物的彩色图像和关键点检测模型,识别出被拍摄人物的人体关键点。识别出人体关键点是指确定关键点的2D坐标。Specifically, the electronic device may use the color image of the photographed person and the key point detection model to identify the human body key points of the photographed person. Recognizing the key points of the human body refers to determining the 2D coordinates of the key points.
其中,关键点检测模型的输入可以是人体的彩色图像,输出可以是人体的关键点的2D坐标。这样,电子设备具体可以将被拍摄人物的彩色图像作为输入,经过关键点检测模型的识别,得到被拍摄人物的彩色图像中各关键点的2D坐标。Among them, the input of the key point detection model may be a color image of the human body, and the output may be the 2D coordinates of the key point of the human body. In this way, the electronic device can specifically take the color image of the captured person as input, and obtain the 2D coordinates of each key point in the color image of the captured person through the recognition of the key point detection model.
如图7所示,人体关键点包括头关键点1、右耳关键点2、左耳关键点3、颈关键点4、右肩关键点5、左肩关键点6、右胸关键点7、左胸关键点8、右腰关键点9、左腰关键点10、右髋关键点11、左髋关键点12、右膝关键点13、左膝关键点14、右脚关键点15、左脚关键点16、裆部关键点17、右肘关键点18、右腕关键点19、左肘关键点20、左腕关键点21。As shown in Figure 7, the key points of the human body include head key point 1, right ear key point 2, left ear key point 3, neck key point 4, right shoulder key point 5, left shoulder key point 6, right chest key point 7, left Chest key point 8, right waist key point 9, left waist key point 10, right hip key point 11, left hip key point 12, right knee key point 13, left knee key point 14, right foot key point 15, left foot key point Point 16, crotch key point 17, right elbow key point 18, right wrist key point 19, left elbow key point 20, and left wrist key point 21.
在一种实施方式中,关键点检测模型例如可以是沙漏网络模型。具体地,关键点点检测模型由四个密集连接的沙漏网络构成;利用预设的训练集对关键点点检测模型进行训练,训练过程中采用最小均方误差损失函数使得沙漏网络收敛,得到训练好的关键点点检测模型。In an embodiment, the key point detection model may be, for example, an hourglass network model. Specifically, the key point detection model is composed of four densely connected hourglass networks; the key point detection model is trained using the preset training set, and the minimum mean square error loss function is used in the training process to make the hourglass network converge and obtain a trained Key point detection model.
可以理解地,沙漏网络能够对目标对象的关键点点进行有效检测,沙漏网络包括输入层、卷积层、池化层、上采样层、下采样层等。当四个沙漏网络连接在一起时,前一个沙漏网络的输出为相邻一个沙漏网络的输入。为了保证底层参数的正常更新,每个沙漏网络采用中继监督策略来对网络的损失进行监督训练。Understandably, the hourglass network can effectively detect the key points of the target object. The hourglass network includes an input layer, a convolutional layer, a pooling layer, an up-sampling layer, a down-sampling layer, and so on. When four hourglass networks are connected together, the output of the previous hourglass network is the input of the adjacent hourglass network. In order to ensure the normal update of the underlying parameters, each hourglass network adopts a relay supervision strategy to supervise and train the loss of the network.
卷积层可以包括很多个卷积算子,卷积算子也称为核,其在图像处理中的作用相当于一个从输入图像矩阵中提取特定信息的过滤器,卷积算子本质上可以是一个权重矩阵,这个权重矩阵通常被预先定义,在对图像进行卷积操作的过程中,权重矩阵通常在输入图像上沿着水平方向一个像素接着一个像素(或两个像素接着两个像素取决于步长stride的取值)的进行处理,从而完成从图像中提取特定特征的工作。The convolution layer can include many convolution operators. The convolution operator is also called the kernel. Its role in image processing is equivalent to a filter that extracts specific information from the input image matrix. The convolution operator can essentially It is a weight matrix. This weight matrix is usually predefined. In the process of image convolution operation, the weight matrix is usually one pixel after one pixel (or two pixels after two pixels) along the horizontal direction on the input image. Based on the value of stride), the work of extracting specific features from the image is completed.
由于常常需要减少训练参数的数量,因此,卷积层之后常常需要周期性的引入池化层,可以是一层卷积层后面跟一层池化层,也可以是多层卷积层后面接一层或多层池化层。在图像处理过程中,池化层的唯一目的就是减少图像的空间大小。池化层可以包括平均池化算子和/或最大池化算子,以用于对输入图像进行采样得到较小尺寸的图像。平均池化算子可以在特定范围内对图像中的像素值进行计算产生平均值作为平均池化的结果。最大池化算子可以在特定范围内取该范围内值最大的像素作为最大池化的结果。另外,就像卷积层中用权重矩阵的大小应该与图像尺寸相关一样,池化层中的运算符也应该与图像的大小相关。通过池化层处理后输出的图像尺寸可以小于输入池化层的图像的尺寸,池化层输出的图像中每个像素点表示输入池化层的图像的对应子区域的平均值或最大值。Because it is often necessary to reduce the number of training parameters, it is often necessary to periodically introduce a pooling layer after the convolutional layer. It can be a convolutional layer followed by a pooling layer, or a multi-layer convolutional layer followed by a pooling layer. One or more pooling layers. In the image processing process, the sole purpose of the pooling layer is to reduce the size of the image space. The pooling layer may include an average pooling operator and/or a maximum pooling operator for sampling the input image to obtain an image with a smaller size. The average pooling operator can calculate the pixel values in the image within a specific range to generate an average value as the result of the average pooling. The maximum pooling operator can take the pixel with the largest value within a specific range as the result of the maximum pooling. In addition, just as the size of the weight matrix used in the convolutional layer should be related to the image size, the operators in the pooling layer should also be related to the image size. The size of the image output after processing by the pooling layer can be smaller than the size of the image of the input pooling layer, and each pixel in the image output by the pooling layer represents the average value or the maximum value of the corresponding sub-region of the image input to the pooling layer.
可选地,利用预设的关键点检测模型确定所述彩色图像中的多个人体关键点之前,方法还包括:Optionally, before determining multiple human key points in the color image by using a preset key point detection model, the method further includes:
构建关键点检测模型,其中,关键点检测模型由四个密集连接的沙漏网络构成;Construct a key point detection model, where the key point detection model is composed of four densely connected hourglass networks;
利用预设的训练集对关键点检测模型进行训练,训练过程中采用最小均方误差损失函数使得沙漏网络收敛,得到训练好的关键点检测模型。Use the preset training set to train the key point detection model. In the training process, the minimum mean square error loss function is used to make the hourglass network converge, and the trained key point detection model is obtained.
所述训练集包括多个人体图像样本,训练前,需要对训练集中的人体图像样本进行预处理,例如将人体图像样本进行裁剪至标准大小,去除环境干扰区域,并对裁剪后的人体图像样本人工标记各个关键点。The training set includes a plurality of human body image samples. Before training, the human body image samples in the training set need to be preprocessed, for example, the human body image samples are cropped to a standard size, the environmental interference area is removed, and the cropped human body image samples Manually mark each key point.
然后将预处理后的训练样本输入四阶沙漏网络,沙漏网络包括上级路和下级路。生猪图像样本进行四次降采样,每次降采样之前,上级路处理原尺寸的人体图像,下级路对原尺寸的人体图像进行降采样之后再进行升采样处理。在本实施方式中,可以从原始尺寸中提取到原始尺寸、1/2、1/4、1/8的中间特性,每次提取特征后通过升采样使图像恢复至原始大小,与原始尺寸特征的数据进行相加,再通过一个残差网络进行特征提取;两次降采样之间,使用三个初级模块提取特征;两次相加之间,使用一个初级模块提取特征。Then the preprocessed training samples are input into the fourth-order hourglass network, which includes the upper road and the lower road. The live pig image sample is down-sampled four times. Before each down-sampling, the upper-level road processes the original-size human body image, and the lower-level road down-samples the original-size human body image and then performs up-sampling processing. In this embodiment, the intermediate characteristics of the original size, 1/2, 1/4, and 1/8 can be extracted from the original size. After each feature is extracted, the image is restored to the original size by upsampling, which is consistent with the original size. The data is added, and then a residual network is used for feature extraction; between two downsampling, three primary modules are used to extract features; between two additions, one primary module is used to extract features.
四阶沙漏网络中,每个沙漏网络都是通过池化层进行向降采样、临近插值进行升采样,从而自顶而下和自底而上地在每个尺寸上都能提取关键点特征。沙漏之间采用跳跃连接,使得每个分辨率下的关键点位置信息保存下来。In the fourth-order hourglass network, each hourglass network is down-sampling through the pooling layer, and neighboring interpolation is up-sampling, so that key point features can be extracted from top to bottom and bottom to top in each size. Jumping connections are used between the hourglasses, so that the key point position information at each resolution is preserved.
训练得到的关键点检测模型的骨骼识别准确度满足预设要求。The bone recognition accuracy of the trained key point detection model meets the preset requirements.
进一步地,根据所述深度图像及摄像头参数确定所述多个人体关键点的位置信息。Further, the position information of the multiple key points of the human body is determined according to the depth image and camera parameters.
具体地,根据所述彩色图像中识别得到的人体关键点的坐标,从深度图像确定相同坐标下的关键点的深度值;Specifically, according to the coordinates of the key points of the human body recognized in the color image, the depth value of the key points under the same coordinates is determined from the depth image;
根据人体关键点的深度值及人体关键点的坐标得到人体关键点的位置信息,即3D 坐标。例如3D坐标为(x,y,z),x表示像素点的横坐标,y表示像素点的纵坐标,z表示像素点的深度值。According to the depth value of the key points of the human body and the coordinates of the key points of the human body, the position information of the key points of the human body is obtained, that is, the 3D coordinates. For example, the 3D coordinates are (x, y, z), x represents the abscissa of the pixel, y represents the ordinate of the pixel, and z represents the depth value of the pixel.
可以看出,结合被拍摄人物的彩色图像和深度图像,可以确定出被拍摄人物的每一个被拍摄部位的二维坐标、相对于3D摄像模组的深度值,以及颜色值。其中,二维坐标和深度值可表示3D坐标。It can be seen that by combining the color image and the depth image of the photographed person, the two-dimensional coordinates of each photographed part of the photographed person, the depth value relative to the 3D camera module, and the color value can be determined. Among them, two-dimensional coordinates and depth values can represent 3D coordinates.
例如,图6A和图6B分别所示的彩色图像、深度图像可结合为颜色值在3D坐标空间中的分布,可如图6C所示。z轴表示深度值。其中,位置A的3D坐标为(x1,y1,z1),z1=350厘米,该3D坐标处的RGB值为(255,255,255);位置B的3D坐标为(x2,y2,z2),z2=345厘米,该3D坐标处的RGB值为(0,0,0)。For example, the color image and the depth image shown in FIG. 6A and FIG. 6B respectively can be combined into the distribution of color values in the 3D coordinate space, as shown in FIG. 6C. The z-axis represents the depth value. Among them, the 3D coordinates of position A are (x1, y1, z1), z1=350 cm, the RGB value at the 3D coordinates is (255,255,255); the 3D coordinates of position B are (x2, y2, z2), z2=345 Cm, the RGB value at the 3D coordinate is (0,0,0).
这里,被拍摄部位是指被3D摄像模组采集到图像的部位,例如当被拍摄人物正面面对3D摄像模组站立时,该被拍摄人物的被拍摄部位可以包括脸部、肚子等正面面对3D摄像模组的身体部位,而臀部、后背则不属于被拍摄部位。Here, the photographed part refers to the part of the image collected by the 3D camera module. For example, when the photographed person is standing facing the 3D camera module, the photographed part of the photographed person may include the front face such as face and stomach. The body parts of the 3D camera module, but the buttocks and back are not part of the photographed parts.
步骤S04,根据所述多个人体关键点的位置信息确定所述被拍摄人物的身材比例参数。所述身材比例参数包括头身比、上下身比、下身比、头肩比、头腰比、头臀比及肩身比中的一种或多种。Step S04: Determine the body proportion parameter of the photographed person according to the position information of the multiple key points of the human body. The body proportion parameter includes one or more of head-to-body ratio, upper-to-body ratio, lower-body ratio, head-to-shoulder ratio, head-to-waist ratio, head-to-hip ratio, and shoulder-to-body ratio.
具体地,电子设备可以根据关键点的深度值以及关键点的2D坐标确定关键点之间的骨骼的长度。例如,如图8所示,被拍摄人物的左髋点P1、左膝点P2和电子设备之间的垂直距离分别会是D1、D2。Specifically, the electronic device may determine the length of the bones between the key points according to the depth value of the key points and the 2D coordinates of the key points. For example, as shown in FIG. 8, the vertical distances between the left hip point P1 and the left knee point P2 of the person being photographed and the electronic device will be D1 and D2, respectively.
头身比X 1=2*D 1-4/(D 4-15+D 4-16),其中,D n-m代表利用3D深度信息计算的关键点n到关键点m的长度。 The head-to-body ratio X 1 =2*D 1-4 /(D 4-15 +D 4-16 ), where D nm represents the length from the key point n to the key point m calculated using 3D depth information.
例如,如图8所示,被拍摄人物的左髋关键点12、左膝关键点14和电子设备之间的垂直距离分别会是D1、D2。在被拍摄人物的彩色图像中,左髋点12、左膝点14之间的距离L可以由12的2D坐标和14的2D坐标计算得到。因此,可以计算出左髋关键点12、左膝关键点14之间的长度
Figure PCTCN2020126954-appb-000001
For example, as shown in FIG. 8, the vertical distances between the key point 12 of the left hip, the key point 14 of the left knee and the electronic device of the photographed person will be D1 and D2, respectively. In the color image of the person being photographed, the distance L between the left hip point 12 and the left knee point 14 can be calculated from the 2D coordinates of 12 and the 2D coordinates of 14. Therefore, the length between the left hip key point 12 and the left knee key point 14 can be calculated
Figure PCTCN2020126954-appb-000001
同样地,上下身比X 2=(D 4-12+D 4-11)/(D 11-15+D 12-16),其中,4表示颈关键点,11表示右髋关键点,12表示左髋关键点,15表示右脚关键点,16表示左脚关键点。 Similarly, the upper to lower body ratio X 2 =(D 4-12 +D 4-11 )/(D 11-15 +D 12-16 ), where 4 represents the key point of the neck, 11 represents the key point of the right hip, and 12 represents For the key points of the left hip, 15 represents the key point of the right foot, and 16 represents the key point of the left foot.
下身比X 3=(D 11-13+D 12-14)/(D 13-15+D 14-16),其中,11表示右髋关键点,12表示左髋关键点,13表示右膝关键点,14表示左膝关键点,15表示右脚关键点,16表示左脚关键点。 Lower body ratio X 3 =(D 11-13 +D 12-14 )/(D 13-15 +D 14-16 ), where 11 represents the key point of the right hip, 12 represents the key point of the left hip, and 13 represents the key point of the right knee Point, 14 represents the key point of the left knee, 15 represents the key point of the right foot, and 16 represents the key point of the left foot.
头肩比X 4=D 2-3/D 5-6,其中,2表示右耳关键点,3表示左耳关键点,5表示右肩关键点,6表示左肩关键点。 Head to shoulder ratio X 4 =D 2-3 /D 5-6 , where 2 represents the key point of the right ear, 3 represents the key point of the left ear, 5 represents the key point of the right shoulder, and 6 represents the key point of the left shoulder.
头腰比X 5=D 2-3/D 9-10,其中,2表示右耳关键点,3表示左耳关键点,9表示右腰关键点,10表示左腰关键点。 Head-to-waist ratio X 5 =D 2-3 /D 9-10 , where 2 represents the key point of the right ear, 3 represents the key point of the left ear, 9 represents the key point of the right waist, and 10 represents the key point of the left waist.
头臀比X 6=D 2-3/D 11-12,其中,2表示右耳关键点,3表示左耳关键点,11表示右髋关键点,12表示左髋关键点。 The head-to-hip ratio X 6 =D 2-3 /D 11-12 , where 2 represents the key point of the right ear, 3 represents the key point of the left ear, 11 represents the key point of the right hip, and 12 represents the key point of the left hip.
肩身比X 7=2*D 5-6/(D 5-15+D 6-16),其中,5表示右肩关键点,6表示左肩关键点,15表示右脚关键点,16表示左脚关键点。 Shoulder-to-body ratio X 7 = 2*D 5-6 /(D 5-15 +D 6-16 ), where 5 represents the key point of the right shoulder, 6 represents the key point of the left shoulder, 15 represents the key point of the right foot, and 16 represents the key point of the left foot key point.
具体地,在确定了被拍摄人物的身材比例参数后,进一步确定体型模板的身材比 例参数,并将被拍摄人物的身材比例参数与体型模板的身材比例参数一一进行比对。Specifically, after the figure proportion parameter of the photographed person is determined, the figure proportion parameter of the body shape template is further determined, and the figure proportion parameter of the photographed person is compared with the figure proportion parameter of the body shape template one by one.
步骤S05,检测到所述用户指示体型模板的第二操作。Step S05: The second operation of the user indicating the body shape template is detected.
在一种实施方式中,检测到所述用户将拍摄的人体图像作为体型模板的第二操作。In one embodiment, the second operation of the user using the captured human body image as the body shape template is detected.
检测到所述用户从预设的体型模板库中选择体型模板的第二操作;或The second operation of the user selecting a body shape template from the preset body shape template library is detected; or
检测到所述用户从预设的图库中选择的人体图像作为体型模板的第二操作。The second operation of detecting the human body image selected by the user from the preset gallery as the body shape template.
具体地,用户可以随机选择图库中的任意一张包含人体图像的照片作为体型模板,也可以选择体型模板库中默认的体型模板,或者用户通过拍摄他人的图像导入作为体型模板。Specifically, the user can randomly select any photo containing a human body image in the gallery as a body shape template, or select a default body shape template in the body shape template library, or the user can take another person's image and import it as a body shape template.
如图9A所示,在一种实施方式中,当用户选择的是体型模板库中默认的体型模板时,所述默认的体型模板的身材比例参数已存储于“相机”应用程序中,从而能够快速地根据体型模板的身材比例参数与被拍摄人物的身材比例参数进行比对。As shown in FIG. 9A, in one embodiment, when the user selects the default body shape template in the body shape template library, the body scale parameter of the default body shape template has been stored in the "Camera" application, so that it can Quickly compare the figure ratio parameters of the body shape template with the figure ratio parameters of the person being photographed.
需要说明的是,如图9B所示,体型模板库里面有很多体型模板,例如某位明星的体型模板,或者大众审美体型模板等等,在用户选定了体型模板后,“相机”应用就能自适应地根据用户选定的体型模板对彩色图像进行调整,使其被拍摄人物的身材比例参数接近该体型模板的身材比例参数。It should be noted that, as shown in Figure 9B, there are many body shape templates in the body shape template library, such as the body shape template of a certain star, or the popular aesthetic body shape template, etc. After the user selects the body shape template, the "Camera" application The color image can be adjusted adaptively according to the body shape template selected by the user, so that the figure proportion parameter of the photographed person is close to the figure proportion parameter of the body shape template.
具体地,在制作体型模板时,方法包括:Specifically, when making a body shape template, the method includes:
利用摄像头采集体型模板的彩色图像及深度图像;Use the camera to collect color images and depth images of the body shape template;
利用预设的关键点检测模型确定所述彩色图像中的多个人体关键点,并利用所述深度图像及所述摄像头的参数确定所述多个人体关键点的位置信息;Using a preset key point detection model to determine multiple key points of the human body in the color image, and using the depth image and the parameters of the camera to determine position information of the multiple key points of the human body;
根据所述体型模板的所述多个人体关键点的位置信息确定所述体型模板的身材比例参数;Determining the figure scale parameter of the figure template according to the position information of the multiple key points of the human body of the figure template;
将所述体型模板的彩色图像及所述体型模板的身材比例参数一起保存至预设的体型模板库中。The color image of the body shape template and the body proportion parameter of the body shape template are saved together in a preset body shape template library.
可以理解地,将体型模板与其身材比例参数保存至体型模板库中,从而方便用户能够及时调用。Understandably, the body shape template and its body proportion parameters are saved in the body shape template library, so that the user can call it in time.
当用户通过拍摄他人的图像导入作为体型模板时,同样需要拍摄体型模板的彩色图像及深度图像,并识别所述彩色图像得到体型模板的多个人体关键点,再利用所述深度图像及摄像头参数确定所述体型模板的多个人体关键点的位置信息;根据所述体型模板的多个人体关键点的位置信息确定所述体型模板的身材比例参数。When the user takes the image of another person and imports it as a body shape template, it is also necessary to take the color image and depth image of the body shape template, and recognize the color image to obtain multiple key points of the body shape template, and then use the depth image and camera parameters Determine the position information of multiple key points of the human body of the body shape template; determine the body proportion parameter of the body shape template according to the position information of the multiple key points of the human body of the body shape template.
在另一种实施方式中,当用户选择的是图库中的包含人体图像的照片作为体型模板时,所述体型模板的身材比例参数同样由关键点检测模型先进行关键点检测,得到然后根据识别得到的多个人体关键点的2D坐标计算身材比例参数。需要注意的是,用户选择非体型模板库中的体型模板中的人物姿态应当与被拍摄人物的姿态相近。In another embodiment, when the user selects a photo containing a human body image in the gallery as the body shape template, the body shape parameter of the body shape template is also first detected by the key point detection model, and then obtained according to the recognition The obtained 2D coordinates of multiple key points of the human body calculate the body proportion parameter. It should be noted that the pose of the person in the body shape template selected by the user in the non-body shape template library should be similar to the pose of the person being photographed.
具体地,如图7所示,体型模板中的人体的左髋关键点12的2D坐标为(x 12,y 12)、左膝关键点14的2D坐标为(x 14,y 14)。因此,可以计算出左髋关键点12、左膝关键点14之间的长度
Figure PCTCN2020126954-appb-000002
Specifically, as shown in FIG. 7, the 2D coordinates of the left hip key point 12 of the human body in the body shape template are (x 12 , y 12 ), and the 2D coordinates of the left knee key point 14 are (x 14 , y 14 ). Therefore, the length between the left hip key point 12 and the left knee key point 14 can be calculated
Figure PCTCN2020126954-appb-000002
同样计算体型模板的身材比例参数,包括头身比、上下身比、下身比、头肩比、头腰比、头臀比及肩身比。Also calculate the body proportion parameters of the body shape template, including head-to-body ratio, upper-to-bottom ratio, lower-body ratio, head-to-shoulder ratio, head-to-waist ratio, head-to-hip ratio, and shoulder-to-body ratio.
最后将体型模板的身材比例参数与被拍摄人物的身材比例参数进行比对,得到待调整的身材比例参数。Finally, the figure proportion parameter of the body shape template is compared with the figure proportion parameter of the photographed person, and the figure proportion parameter to be adjusted is obtained.
步骤S06,响应于所述第二操作,在所述预览框内显示所述被拍摄人物的第二人体图像,所述第二人体图像中所述被拍摄人物的身材比例参数被所述体型模板的身材比例参数自适应进行了调整处理。Step S06, in response to the second operation, display a second human body image of the photographed person in the preview frame, and the figure proportion parameter of the photographed person in the second human body image is determined by the body shape template. The body proportion parameters are adjusted adaptively.
具体地,步骤S06,包括:Specifically, step S06 includes:
将所述被拍摄人物的身材比例参数与所述体型模板的身材比例参数一一进行比对,将参数差值超出预设范围的身材比例参数确定为待调整的身材比例参数;Comparing the figure proportion parameters of the photographed person with the figure proportion parameters of the body shape template one by one, and determining the figure proportion parameter whose parameter difference exceeds a preset range as the figure proportion parameter to be adjusted;
根据所述体型模板的身材比例参数调整所述待调整的身材比例参数;Adjusting the to-be-adjusted figure proportion parameter according to the figure proportion parameter of the figure template;
根据调整后所述被拍摄人物的身材比例参数确定相应的关键点所需要的调整位置信息;Determine the adjustment position information required by the corresponding key point according to the body proportion parameter of the photographed person after adjustment;
根据所述关键点所需要的调整位置信息对所述关键点进行调整,以使得所述被拍摄人物的身材比例参数与所述体型模板的身材比例参数相适应。The key point is adjusted according to the adjustment position information required by the key point, so that the figure proportion parameter of the photographed person is compatible with the figure proportion parameter of the body shape template.
根据体型模板的身材比例参数调整待调节的身材比例参数。例如参数差值的预设范围为±5%,例如体型模板的身材比例参数中的头肩比X4=2/3,当被拍摄人物的头肩比X4’=2.3/3,X4’-X4=2.3/3-2/3=0.3/3=10%﹥5%,则表示被拍摄人物的头肩比需要调整,即将头肩比由2.3/3调整为2/3。Adjust the body proportion parameter to be adjusted according to the figure proportion parameter of the body shape template. For example, the preset range of the parameter difference is ±5%. For example, the head-to-shoulders ratio X4=2/3 in the figure ratio parameter of the body shape template. When the head-to-shoulders ratio of the photographed person is X4'=2.3/3, X4'-X4 =2.3/3-2/3=0.3/3=10%﹥5%, it means that the head-to-shoulders ratio of the photographed person needs to be adjusted, that is, the head-to-shoulders ratio is adjusted from 2.3/3 to 2/3.
需要说明的是,体型模板的姿态和被拍摄对象的姿态可能不同。被拍摄对象的姿态可以根据被拍摄人物的彩色图像、被拍摄人物的深度信息确定。此时,电子设备可以通过相似变换将体型模板的姿态变换为被拍摄人物的姿态。具体的,电子设备可以比较这两个姿态的骨骼点在二维空间中的位移,以及被拍摄人物的骨骼点连接的两段肢体的相对夹角。It should be noted that the posture of the body shape template and the posture of the subject may be different. The posture of the subject can be determined based on the color image of the person being photographed and the depth information of the person being photographed. At this time, the electronic device can transform the posture of the body shape template into the posture of the person being photographed through the similar transformation. Specifically, the electronic device can compare the displacements of the bone points of the two postures in the two-dimensional space, and the relative included angles of the two limbs connected by the bone points of the person being photographed.
然后,电子设备可以将体型模板的骨骼点以及骨骼点连接的肢体进行旋转或平移,使得变换后的体型模板的姿态和被拍摄对象的姿态一致。在调整体型模板的姿态之后,电子设备体型模板的身材比例参数调整待调节的身材比例参数。Then, the electronic device can rotate or translate the bone points of the body shape template and the limbs connected by the bone points, so that the posture of the transformed body shape template is consistent with the posture of the subject. After adjusting the posture of the body shape template, the body proportion parameter of the electronic device body shape template adjusts the body proportion parameter to be adjusted.
本实施例还提供一种计算机存储介质,该计算机存储介质中存储有计算机指令,This embodiment also provides a computer storage medium in which computer instructions are stored,
当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的基于深度的人体图像美化方法。When the computer instruction runs on the electronic device, the electronic device is caused to execute the above-mentioned related method steps to implement the depth-based human body image beautification method in the above-mentioned embodiment.
本实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述相关步骤,以实现上述实施例中的基于深度的人体图像美化方法。This embodiment also provides a computer program product. When the computer program product runs on a computer, the computer executes the above-mentioned related steps to realize the depth-based human image beautification method in the above-mentioned embodiment.
另外,本申请的实施例还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中的基于深度的人体图像美化方法。In addition, the embodiments of the present application also provide a device. The device may specifically be a chip, component or module. The device may include a processor and a memory connected to each other. The memory is used to store computer execution instructions. When the device is running, The processor can execute the computer-executable instructions stored in the memory, so that the chip executes the depth-based human body image beautification method in the foregoing method embodiments.
其中,本实施例提供的电子设备、计算机存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。Among them, the electronic device, computer storage medium, computer program product, or chip provided in this embodiment are all used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the corresponding method provided above. The beneficial effects of the method will not be repeated here.
通过以上实施方式的描述,所属领域的技术人员可以了解到,为描述的方便和简 洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。Through the description of the above embodiments, those skilled in the art can understand that for the convenience and conciseness of the description, only the division of the above-mentioned functional modules is used as an example. The function module is completed, that is, the internal structure of the device is divided into different function modules to complete all or part of the functions described above.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device and method may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be combined or It can be integrated into another device, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate parts may or may not be physically separate, and the parts displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or they may be distributed to multiple different places. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application are essentially or the part that contributes to the prior art, or all or part of the technical solutions can be embodied in the form of a software product, and the software product is stored in a storage medium. It includes several instructions to make a device (which may be a single-chip microcomputer, a chip, etc.) or a processor (processor) execute all or part of the steps of the methods of the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read only memory (read only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.
以上内容,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above content is only the specific implementation of this application, but the protection scope of this application is not limited to this. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in this application. Covered in the scope of protection of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims (16)

  1. 一种基于深度的人体图像美化方法,其特征在于,应用于具有显示屏和摄像头的电子设备,所述方法包括:A method for beautifying human body images based on depth, characterized in that it is applied to an electronic device with a display screen and a camera, and the method includes:
    检测到用户用于打开相机的第一操作;The first operation used by the user to turn on the camera is detected;
    响应于所述第一操作,在所述显示屏显示用户界面,所述用户界面包括预览框,所述预览框内包括被拍摄人物的第一人体图像,所述第一人体图像包括深度图像及彩色图像;In response to the first operation, a user interface is displayed on the display screen, the user interface includes a preview frame, the preview frame includes a first human body image of the person being photographed, the first human body image includes a depth image and Color image
    利用预设的关键点检测模型确定所述彩色图像中的多个人体关键点,并根据所述深度图像及所述摄像头的参数确定所述多个人体关键点的位置信息;Determining a plurality of human body key points in the color image by using a preset key point detection model, and determining position information of the plurality of human body key points according to the depth image and the parameters of the camera;
    根据所述多个人体关键点的位置信息确定所述被拍摄人物的身材比例参数;Determining the body proportion parameter of the photographed person according to the position information of the multiple key points of the human body;
    检测到所述用户用于指示体型模板的第二操作;The second operation used by the user to indicate the body shape template is detected;
    响应于所述第二操作,在所述预览框内显示所述被拍摄人物的第二人体图像,所述第二人体图像中所述被拍摄人物的身材比例参数根据所述体型模板的身材比例参数自适应进行了调整处理。In response to the second operation, a second human body image of the photographed person is displayed in the preview frame, and the figure scale parameter of the photographed person in the second human body image is based on the figure proportion of the body shape template Parameter adaptation has been adjusted.
  2. 如权利要求1所述的方法,其特征在于,检测到所述用户用于指示体型模板的第二操作,包括:The method according to claim 1, wherein detecting the second operation used by the user to indicate the body shape template comprises:
    检测到所述用户将拍摄的人体图像作为体型模板的第二操作;或Detecting the second operation of the user using the captured human body image as the body shape template; or
    检测到所述用户从预设的体型模板库中选择体型模板的第二操作;或The second operation of the user selecting a body shape template from the preset body shape template library is detected; or
    检测到所述用户从预设的图库中选择的人体图像作为体型模板的第二操作。The second operation of detecting the human body image selected by the user from the preset gallery as the body shape template.
  3. 如权利要求1~2所述的方法,其特征在于,所述身材比例参数包括头身比、上下身比、下身比、头肩比、头腰比、头臀比及肩身比中的一种或多种;所述第二人体图像中所述被拍摄人物的身材比例参数根据所述体型模板的身材比例参数自适应进行了调整处理,包括:The method according to claims 1 to 2, wherein the body ratio parameters include one of head-to-body ratio, upper-to-body ratio, lower-body ratio, head-to-shoulder ratio, head-to-waist ratio, head-to-hip ratio, and shoulder-to-body ratio Or more; the figure scale parameter of the photographed person in the second human body image is adaptively adjusted according to the figure scale parameter of the body shape template, including:
    将所述被拍摄人物的身材比例参数与所述体型模板的身材比例参数一一进行比对,将参数差值超出预设范围的身材比例参数确定为待调整的身材比例参数;Comparing the figure proportion parameters of the photographed person with the figure proportion parameters of the body shape template one by one, and determining the figure proportion parameter whose parameter difference exceeds a preset range as the figure proportion parameter to be adjusted;
    根据所述体型模板的身材比例参数调整所述待调整的身材比例参数;Adjusting the to-be-adjusted figure proportion parameter according to the figure proportion parameter of the figure template;
    根据调整后所述被拍摄人物的身材比例参数确定相应的关键点所需要的调整位置信息;Determine the adjustment position information required by the corresponding key point according to the body proportion parameter of the photographed person after adjustment;
    根据所述关键点所需要的调整位置信息对所述关键点进行调整,以使得所述被拍摄人物的身材比例参数与所述体型模板的身材比例参数相适应。The key point is adjusted according to the adjustment position information required by the key point, so that the figure proportion parameter of the photographed person is compatible with the figure proportion parameter of the body shape template.
  4. 如权利要求1~2所述的方法,其特征在于,所述用户界面还包括:拍摄控件;所述方法还包括:3. The method of claims 1 to 2, wherein the user interface further comprises: a shooting control; and the method further comprises:
    响应于检测到的作用于所述拍摄控件的用户操作,保存所述预览框中显示的所述第二人体图像。In response to the detected user operation acting on the shooting control, the second human body image displayed in the preview frame is saved.
  5. 如权利要求1所述的方法,其特征在于,在所述利用预设的关键点检测算法确定所述彩色图像中的多个人体关键点,并根据所述深度图像及所述摄像头的参数确定所述多个人体关键点的位置信息之前,所述方法还包括:The method according to claim 1, wherein a plurality of human key points in the color image are determined by using a preset key point detection algorithm, and the determination is made according to the depth image and the parameters of the camera Before the position information of the multiple key points of the human body, the method further includes:
    构建关键点检测模型,其中,所述关键点检测模型由四个密集连接的沙漏网络构成;Construct a key point detection model, wherein the key point detection model is composed of four densely connected hourglass networks;
    利用预设的训练集对所述关键点检测模型进行训练,训练过程中采用最小均方误差损失函数使得所述沙漏网络收敛,得到训练好的关键点检测模型。A preset training set is used to train the key point detection model, and a minimum mean square error loss function is used in the training process to make the hourglass network converge, and a trained key point detection model is obtained.
  6. 如权利要求1所述的方法,其特征在于,所述利用所述深度图像及所述摄像头的参数确定所述多个人体关键点的位置信息,包括:The method according to claim 1, wherein the determining the position information of the multiple key points of the human body by using the depth image and the parameters of the camera comprises:
    根据所述彩色图像中识别得到的人体关键点的坐标,从所述深度图像确定相同坐标下的所述人体关键点的深度值;Determining the depth value of the key points of the human body under the same coordinates from the depth image according to the coordinates of the key points of the human body recognized in the color image;
    根据所述人体关键点的深度值及所述人体关键点的坐标得到所述人体关键点的位置信息。The position information of the key point of the human body is obtained according to the depth value of the key point of the human body and the coordinates of the key point of the human body.
  7. 如权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1, wherein the method further comprises:
    利用摄像头采集体型模板的彩色图像及深度图像;Use the camera to collect color images and depth images of the body shape template;
    利用预设的关键点检测模型确定所述彩色图像中的多个人体关键点,并利用所述深度图像及所述摄像头的参数确定所述多个人体关键点的位置信息;Using a preset key point detection model to determine multiple key points of the human body in the color image, and using the depth image and the parameters of the camera to determine position information of the multiple key points of the human body;
    根据所述体型模板的所述多个人体关键点的位置信息确定所述体型模板的身材比例参数;Determining the figure scale parameter of the figure template according to the position information of the multiple key points of the human body of the figure template;
    将所述体型模板的彩色图像及所述体型模板的身材比例参数一起保存至预设的体型模板库中。The color image of the body shape template and the body proportion parameter of the body shape template are saved together in a preset body shape template library.
  8. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:
    显示屏;摄像头;一个或多个处理器;存储器;多个应用程序;以及一个或多个计算机程序,其中所述一个或多个计算机程序被存储在所述存储器中,所述一个或多个计算机程序包括指令,当所述指令被所述设备执行时,使得所述设备执行以下步骤:A display screen; a camera; one or more processors; a memory; a plurality of application programs; and one or more computer programs, wherein the one or more computer programs are stored in the memory, the one or more The computer program includes instructions that, when executed by the device, cause the device to perform the following steps:
    检测到用户用于打开相机的第一操作;The first operation used by the user to turn on the camera is detected;
    响应于所述第一操作,在所述显示屏显示用户界面,所述用户界面包括预览框,所述预览框内包括被拍摄人物的第一人体图像,所述第一人体图像包括深度图像及彩色图像;In response to the first operation, a user interface is displayed on the display screen, the user interface includes a preview frame, the preview frame includes a first human body image of the person being photographed, the first human body image includes a depth image and Color image
    利用预设的关键点检测算法确定所述彩色图像中的多个人体关键点,并根据所述深度图像及所述摄像头的参数确定所述多个人体关键点的位置信息;Using a preset key point detection algorithm to determine a plurality of human body key points in the color image, and determine the position information of the plurality of human body key points according to the depth image and the parameters of the camera;
    根据所述多个人体关键点的位置信息确定所述被拍摄人物的身材比例参数;Determining the body proportion parameter of the photographed person according to the position information of the multiple key points of the human body;
    检测到所述用户用于指示体型模板的第二操作;The second operation used by the user to indicate the body shape template is detected;
    响应于所述第二操作,在所述预览框内显示所述被拍摄人物的第二人体图像,所述第二人体图像中所述被拍摄人物的身材比例参数根据所述体型模板的身材比例参数自适应进行了调整处理。In response to the second operation, a second human body image of the photographed person is displayed in the preview frame, and the figure scale parameter of the photographed person in the second human body image is based on the figure proportion of the body shape template Parameter adaptation has been adjusted.
  9. 如权利要求8所述的电子设备,其特征在于,当所述指令被所述设备执行时,使得所述设备具体执行以下步骤:8. The electronic device according to claim 8, wherein when the instruction is executed by the device, the device specifically executes the following steps:
    检测到所述用户将拍摄的人体图像作为体型模板的第二操作;或Detecting the second operation of the user using the captured human body image as the body shape template; or
    检测到所述用户从预设的体型模板库中选择体型模板的第二操作;或The second operation of the user selecting a body shape template from the preset body shape template library is detected; or
    检测到所述用户从预设的图库中选择的人体图像作为体型模板的第二操作。The second operation of detecting the human body image selected by the user from the preset gallery as the body shape template.
  10. 如权利要求8~9所述的电子设备,其特征在于,所述身材比例参数包括头身比、上下身比、下身比、头肩比、头腰比、头臀比及肩身比中的一种或多种;当 所述指令被所述设备执行时,使得所述设备具体执行以下步骤:The electronic device of claims 8-9, wherein the body ratio parameter includes one of head-to-body ratio, upper-to-bottom ratio, lower-body ratio, head-to-shoulder ratio, head-to-waist ratio, head-to-hip ratio, and shoulder-to-body ratio. One or more; when the instruction is executed by the device, the device specifically executes the following steps:
    将所述被拍摄人物的身材比例参数与所述体型模板的身材比例参数一一进行比对,将参数差值超出预设范围的身材比例参数确定为待调整的身材比例参数;Comparing the figure proportion parameters of the photographed person with the figure proportion parameters of the body shape template one by one, and determining the figure proportion parameter whose parameter difference exceeds a preset range as the figure proportion parameter to be adjusted;
    根据所述体型模板的身材比例参数调整所述待调整的身材比例参数;Adjusting the to-be-adjusted figure proportion parameter according to the figure proportion parameter of the figure template;
    根据调整后所述被拍摄人物的身材比例参数确定相应的关键点所需要的调整位置信息;Determine the adjustment position information required by the corresponding key point according to the body proportion parameter of the photographed person after adjustment;
    根据所述关键点所需要的调整位置信息对所述关键点进行调整,以使得所述被拍摄人物的身材比例参数与所述体型模板的身材比例参数相适应。The key point is adjusted according to the adjustment position information required by the key point, so that the figure proportion parameter of the photographed person is compatible with the figure proportion parameter of the body shape template.
  11. 如权利要求8~9所述的电子设备,其特征在于,所述用户界面还包括:拍摄控件;当所述指令被所述设备执行时,使得所述设备具体执行以下步骤:9. The electronic device according to claims 8-9, wherein the user interface further comprises: a shooting control; when the instruction is executed by the device, the device specifically executes the following steps:
    响应于检测到的作用于所述拍摄控件的用户操作,保存所述预览框中显示的所述第二人体图像。In response to the detected user operation acting on the shooting control, the second human body image displayed in the preview frame is saved.
  12. 如权利要求8所述的电子设备,其特征在于,当所述指令被所述设备执行时,使得所述设备具体执行以下步骤:8. The electronic device according to claim 8, wherein when the instruction is executed by the device, the device specifically executes the following steps:
    构建关键点检测模型,其中,所述关键点检测模型由四个密集连接的沙漏网络构成;Construct a key point detection model, wherein the key point detection model is composed of four densely connected hourglass networks;
    利用预设的训练集对所述关键点检测模型进行训练,训练过程中采用最小均方误差损失函数使得所述沙漏网络收敛,得到训练好的关键点检测模型。A preset training set is used to train the key point detection model, and a minimum mean square error loss function is used in the training process to make the hourglass network converge, and a trained key point detection model is obtained.
  13. 如权利要求8所述的电子设备,其特征在于,当所述指令被所述设备执行时,使得所述设备具体执行以下步骤:8. The electronic device according to claim 8, wherein when the instruction is executed by the device, the device specifically executes the following steps:
    根据所述彩色图像中识别得到的人体关键点的坐标,从所述深度图像确定相同坐标下的所述人体关键点的深度值;Determining the depth value of the key points of the human body under the same coordinates from the depth image according to the coordinates of the key points of the human body recognized in the color image;
    根据所述人体关键点的深度值及所述人体关键点的坐标得到所述人体关键点的位置信息。The position information of the key point of the human body is obtained according to the depth value of the key point of the human body and the coordinates of the key point of the human body.
  14. 一种计算机设备,包括存储器,处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时使得所述计算机设备实现如权利要求1至7任一项所述的基于深度的人体图像美化方法。A computer device includes a memory, a processor, and a computer program stored on the memory and running on the processor, wherein the processor executes the computer program to make the computer device implement The method for beautifying human body images based on depth according to any one of claims 1 to 7.
  15. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在电子设备上运行时,使得所述电子设备执行如权利要求1至7任一项所述的基于深度的人体图像美化方法。A computer program product containing instructions, characterized in that, when the computer program product runs on an electronic device, the electronic device is caused to perform the depth-based human image beautification according to any one of claims 1 to 7 method.
  16. 一种计算机可读存储介质,包括指令,其特征在于,当所述指令在电子设备上运行时,使得所述电子设备执行如权利要求1至7任一项所述的基于深度的人体图像美化方法。A computer-readable storage medium, comprising instructions, characterized in that, when the instructions run on an electronic device, the electronic device is made to perform the depth-based human image beautification according to any one of claims 1 to 7 method.
PCT/CN2020/126954 2020-02-25 2020-11-06 Depth-based human body image beautification method and electronic device WO2021169394A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010117261.7A CN113382154A (en) 2020-02-25 2020-02-25 Human body image beautifying method based on depth and electronic equipment
CN202010117261.7 2020-02-25

Publications (1)

Publication Number Publication Date
WO2021169394A1 true WO2021169394A1 (en) 2021-09-02

Family

ID=77489843

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/126954 WO2021169394A1 (en) 2020-02-25 2020-11-06 Depth-based human body image beautification method and electronic device

Country Status (2)

Country Link
CN (1) CN113382154A (en)
WO (1) WO2021169394A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115359194A (en) * 2022-10-20 2022-11-18 北京百度网讯科技有限公司 Image processing method, image processing device, electronic equipment and storage medium
WO2023029992A1 (en) * 2021-09-03 2023-03-09 北京字跳网络技术有限公司 Photographing method and apparatus, and electronic device and storage medium
CN115776532A (en) * 2021-09-07 2023-03-10 荣耀终端有限公司 Method for capturing image in video and electronic equipment
WO2023045946A1 (en) * 2021-09-27 2023-03-30 上海商汤智能科技有限公司 Image processing method and apparatus, electronic device, and storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116362977B (en) * 2021-12-23 2023-12-22 荣耀终端有限公司 Method and device for eliminating interference patterns in image
CN114549706A (en) * 2022-02-21 2022-05-27 成都工业学院 Animation generation method and animation generation device
CN116074624B (en) * 2022-07-22 2023-11-10 荣耀终端有限公司 Focusing method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090257654A1 (en) * 2008-04-11 2009-10-15 Roizen Michael F System and Method for Determining an Objective Measure of Human Beauty
CN108765272A (en) * 2018-05-31 2018-11-06 Oppo广东移动通信有限公司 Image processing method, device, electronic equipment and readable storage medium storing program for executing
CN108830150A (en) * 2018-05-07 2018-11-16 山东师范大学 One kind being based on 3 D human body Attitude estimation method and device
CN109495688A (en) * 2018-12-26 2019-03-19 华为技术有限公司 Method for previewing of taking pictures, graphic user interface and the electronic equipment of electronic equipment
CN110677575A (en) * 2019-11-12 2020-01-10 Oppo广东移动通信有限公司 Image sensor, camera module and terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108549873B (en) * 2018-04-19 2019-12-24 北京华捷艾米科技有限公司 Three-dimensional face recognition method and three-dimensional face recognition system
CN109938737A (en) * 2019-03-01 2019-06-28 苏州博慧智能科技有限公司 A kind of human body body type measurement method and device based on deep learning critical point detection

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090257654A1 (en) * 2008-04-11 2009-10-15 Roizen Michael F System and Method for Determining an Objective Measure of Human Beauty
CN108830150A (en) * 2018-05-07 2018-11-16 山东师范大学 One kind being based on 3 D human body Attitude estimation method and device
CN108765272A (en) * 2018-05-31 2018-11-06 Oppo广东移动通信有限公司 Image processing method, device, electronic equipment and readable storage medium storing program for executing
CN109495688A (en) * 2018-12-26 2019-03-19 华为技术有限公司 Method for previewing of taking pictures, graphic user interface and the electronic equipment of electronic equipment
CN110677575A (en) * 2019-11-12 2020-01-10 Oppo广东移动通信有限公司 Image sensor, camera module and terminal

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023029992A1 (en) * 2021-09-03 2023-03-09 北京字跳网络技术有限公司 Photographing method and apparatus, and electronic device and storage medium
CN115776532A (en) * 2021-09-07 2023-03-10 荣耀终端有限公司 Method for capturing image in video and electronic equipment
CN115776532B (en) * 2021-09-07 2023-10-20 荣耀终端有限公司 Method for capturing images in video and electronic equipment
WO2023045946A1 (en) * 2021-09-27 2023-03-30 上海商汤智能科技有限公司 Image processing method and apparatus, electronic device, and storage medium
CN115359194A (en) * 2022-10-20 2022-11-18 北京百度网讯科技有限公司 Image processing method, image processing device, electronic equipment and storage medium
CN115359194B (en) * 2022-10-20 2023-03-14 北京百度网讯科技有限公司 Image processing method, image processing device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113382154A (en) 2021-09-10

Similar Documents

Publication Publication Date Title
CN109495688B (en) Photographing preview method of electronic equipment, graphical user interface and electronic equipment
WO2021169394A1 (en) Depth-based human body image beautification method and electronic device
CN112130742B (en) Full screen display method and device of mobile terminal
JP7238115B2 (en) Photography scenarios and methods for displaying images on electronic devices
CN113645351B (en) Application interface interaction method, electronic device and computer-readable storage medium
WO2021104485A1 (en) Photographing method and electronic device
CN111327814A (en) Image processing method and electronic equipment
CN112262563B (en) Image processing method and electronic device
WO2021129198A1 (en) Method for photography in long-focal-length scenario, and terminal
WO2020029306A1 (en) Image capture method and electronic device
WO2021258814A1 (en) Video synthesis method and apparatus, electronic device, and storage medium
WO2022017261A1 (en) Image synthesis method and electronic device
WO2022100685A1 (en) Drawing command processing method and related device therefor
CN113949803B (en) Photographing method and electronic equipment
CN113170037A (en) Method for shooting long exposure image and electronic equipment
CN115619858A (en) Object reconstruction method and related equipment
CN115967851A (en) Quick photographing method, electronic device and computer readable storage medium
CN114727220A (en) Equipment searching method and electronic equipment
CN115115679A (en) Image registration method and related equipment
CN115147451A (en) Target tracking method and device thereof
CN114444000A (en) Page layout file generation method and device, electronic equipment and readable storage medium
CN113542574A (en) Shooting preview method under zooming, terminal, storage medium and electronic equipment
WO2022078116A1 (en) Brush effect picture generation method, image editing method and device, and storage medium
WO2021204103A1 (en) Picture preview method, electronic device, and storage medium
WO2024046162A1 (en) Image recommendation method and electronic device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20921657

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20921657

Country of ref document: EP

Kind code of ref document: A1