WO2021136050A1 - Image photographing method and related apparatus - Google Patents

Image photographing method and related apparatus Download PDF

Info

Publication number
WO2021136050A1
WO2021136050A1 PCT/CN2020/138859 CN2020138859W WO2021136050A1 WO 2021136050 A1 WO2021136050 A1 WO 2021136050A1 CN 2020138859 W CN2020138859 W CN 2020138859W WO 2021136050 A1 WO2021136050 A1 WO 2021136050A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
subject
target
focus
electronic device
Prior art date
Application number
PCT/CN2020/138859
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 WO2021136050A1 publication Critical patent/WO2021136050A1/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/67Focus control based on electronic image sensor signals
    • 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

Definitions

  • This application relates to the field of image processing technology, and in particular to an image shooting method and related devices.
  • the embodiments of the present application provide an image shooting method and related devices. After the conventional focusing method is used to focus the target focus subject and the corresponding image is obtained, the conventional focusing method is difficult to achieve in-focus in the current scene, which leads to this When the sharpness of the target focus subject in the image is less than a certain threshold, a neural network model-based focusing method that is more adaptable to the scene is used for focusing to obtain a clear image.
  • the first aspect of the embodiments of the present application provides an image capturing method, which can be applied to a terminal device with a touch screen and a camera, or to an electronic device in the terminal device.
  • the method may include: in response to a user's operation to open the camera application, starting Camera, enter shooting mode; after entering shooting mode, determine the target focus subject in the current scene, that is, determine the subject in the current scene that needs to obtain a clear image; focus on the target focus subject in the current scene through the first focus method, and get A first image; when the sharpness of the target focused subject in the first image is less than a preset threshold, focus the target focused subject in the current scene by the second focusing method to obtain a second image; wherein, the first focusing method and The lens position corresponding to the second focusing method is different, that is, the lens position when the first image is obtained by focusing by the first focusing method is different from the lens position when the second image is obtained by focusing by the second focusing method.
  • the first focusing method may include a phase focusing method or a laser focusing method
  • the second focusing method is a focusing method based on a neural network model
  • the sharpness of the target focus subject in the second image captured based on the second focusing method is not less than a preset Threshold.
  • the value of the preset threshold is not the maximum value corresponding to the sharpness.
  • the focusing method based on the neural network model is used for focusing.
  • the network model is trained based on image data in a large number of scenes. Therefore, the focusing method based on the neural network model is more adaptable to the scene and can achieve aligning focus in most scenes, so as to obtain a clear shot of the target focus subject image.
  • the method further includes: when the sharpness of the target focused subject in the first image is less than a preset threshold, outputting the second image as the target image.
  • the target image may be the preview image displayed in the preview area on the shooting interface, that is, in the case where the sharpness of the target focus subject in the first image is less than the preset threshold, the second image is output as the preview image on the shooting interface.
  • Preview image may also be an image stored in a storage medium (for example, a non-volatile memory (non-volatile memory)) in response to a user's photographing instruction.
  • the method further includes: when the sharpness of the target focused subject in the first image is not less than a preset threshold, outputting the first image as the target image.
  • the target image may be a preview image on the photographing interface, or may be an image stored in a storage medium in response to a user's photographing instruction.
  • focusing on the target focused subject in the current scene by the second focusing method includes: inputting the first image marked with the target focused subject into the neural network model to obtain the neural network model
  • the first output result is the sharpness of the target focus subject in the first image
  • the lens position is adjusted according to the sharpness of the target focus subject in the first image to obtain the second image.
  • the first image marked with the target focused subject can be input into the neural network model, and the target in the first image can be obtained based on the neural network model. Focusing on the sharpness of the subject, then determining the moving position of the lens according to the sharpness of the target focusing subject, and moving the lens to the determined position, thereby completing focusing and obtaining a second image.
  • the movement value of the lens is determined according to the definition of the target focus subject in the first image and the full range, where the full range is the maximum range value that the lens can move, and the movement value is the full range.
  • the first product is the product of the sharpness and the full range; the lens is moved to the target position according to the movement value.
  • the sharpness of the target focus subject in the first image is 80%
  • the movement value of the lens is the difference between the full scale of the lens and (full scale*80%), that is, the movement value of the lens It is the product of full scale and 20% (1-80%).
  • the neural network model may be trained based on image training data marked with the focus subject and the sharpness of the focus subject, that is, before the neural network model is trained, Obtain a large number of images marked with the focus subject and the sharpness of the focus subject as the training data of the neural network model.
  • the training data can be obtained by shooting a large number of scenes with a mobile phone or camera and other imaging equipment; specifically, in the same scene, the mobile phone can move the lens back and forth to capture images at different lens positions. And determine the focus subject of the image; after obtaining images at different lens positions, the sharpness of the focus subject in the image can be marked based on the lens position corresponding to the image.
  • the neural network model In the process of training the neural network model, first select part of the training data and input it into the neural network model, and obtain the sharpness prediction result of the neural network model through the forward propagation algorithm in the neural network model. Because this part of the training data is pre-marked with the correct definition, the gap between the definition prediction result and the marked definition can be calculated, and then based on this gap, the parameter values of the neural network model are updated accordingly through the backpropagation algorithm , So that the prediction result of the neural network model can be closer to the real result. Since the neural network model is based on image training in a large number of various scenes, it has strong adaptability to various scenes. Therefore, the sharpness of the current image can be accurately obtained through the neural network model, so that the mobile phone can be based on the clearness of the image. Degree to control the position of the lens movement, so as to achieve focus and obtain a clear image.
  • the method further includes: when the first image is a multi-depth-of-field image, and the target focused subject is located in a background area in the multi-depth-of-field image, switching the target focused subject to a multi-depth image In the foreground area of the subject, the switched target focus subject is obtained; when the sharpness of the target focus subject in the first image is less than the preset threshold, the second focus method is used to focus the target focus subject in the current scene, Obtaining the second image includes: when the sharpness of the switched target focus subject in the first image is less than a preset threshold, focus the switched target focus subject in the current scene by the second focus method to obtain the second image . That is, after the target focus subject is switched to the subject in the foreground area in the multi-depth image, the second focus method is used to focus the switched target focus subject in the current scene to capture the switched target focus subject Clear second image.
  • focusing the switched target focus subject in the current scene by the second focusing method includes: inputting a first image marked with the switched target focus subject into a neural network Model, the second output result of the neural network model is obtained.
  • the second output result is the sharpness of the target focus subject after switching in the first image; adjust the lens position according to the sharpness of the target focus subject after switching in the first image to obtain The second image.
  • the method further includes: when the switched target focus subject is focused by the second focusing method, displaying a focus frame on the shooting interface according to the switched target focus subject , The focus frame is used to mark the target focus subject after switching to remind the user of the current target focus subject.
  • the method further includes: displaying prompt information 1 on the shooting interface, the prompt information 1 being used to prompt the user to switch the focus method or start the mode of focusing by the second focus method. That is to say, during the process of focusing on the target focus subject by the second focusing method, the prompt message 1 can be displayed on the shooting interface to remind the user that the focus method is currently being switched or the focus method is currently being turned on. mode.
  • the method may further include: focusing on the target in the second image When the sharpness of the subject is less than the preset threshold, a prompt message 2 is displayed on the shooting interface, and the prompt message 2 is used to prompt the user to adjust the shooting distance.
  • the method may further include: focusing on the target in the second image When the sharpness of the subject is less than the preset threshold, a prompt message 3 is displayed on the shooting interface, and the prompt message 3 is used to prompt the user to switch the camera or switch the shooting mode.
  • a second aspect of the embodiments of the present application provides an image capturing device, including: a processing unit, configured to determine a target focus subject in the current scene; and the processing unit, further configured to focus on the target subject in the current scene through a first focus method Performing focusing to obtain a first image; the processing unit is further configured to, when the sharpness of the target focused subject in the first image is less than a preset threshold, focus on the target focused subject in the current scene by the second focusing method to obtain the second Image, the sharpness of the target focus subject in the second image is not less than the preset threshold; wherein the lens positions corresponding to the first focusing method and the second focusing method are different, and the second focusing method is a focusing method based on a neural network model.
  • the image capturing device further includes an output unit configured to output the second image as the target image when the sharpness of the target focused subject in the first image is less than a preset threshold.
  • the image capturing device further includes an output unit configured to output the first image as the target image when the sharpness of the target focus subject in the first image is not less than a preset threshold.
  • the processing unit is further configured to input the first image marked with the target focus subject into the neural network model to obtain the first output result of the neural network model,
  • the first output result is the sharpness of the target focused subject in the first image; the lens position is adjusted according to the sharpness of the target focused subject in the first image to obtain a second image.
  • the processing unit is further configured to determine the movement value of the lens according to the sharpness and the full range of the target focus subject in the first image, wherein the full range The range is the maximum range value that the lens can move, the movement value is the difference between the full range and a first product, and the first product is the product of the sharpness and the full range; according to The movement value moves the lens to the target position.
  • the processing unit is further configured to switch the target focus subject to multiple depth of field when the first image is a multiple depth of field image and the target focus subject is located in the background area in the multiple depth of field image The subject in the foreground area of the image obtains the switched target focus subject; the processing unit is further configured to pass the second focus subject in the current scene when the sharpness of the switched target focus subject in the first image is less than the preset threshold The focus method focuses on the switched target focus subject to obtain a second image.
  • the image capturing device further includes a display unit for displaying a focus frame on the shooting interface according to the switched target focus subject, and the focus frame is used to mark the switched target focus subject.
  • the image capturing device further includes a display unit for displaying prompt information on the shooting interface, and the prompt information is used to prompt the user to switch the focus method or enable the second focus method to focus. mode.
  • the neural network model is obtained through training of image training data marked with the focused subject and the sharpness of the focused subject.
  • the first focusing method includes a phase focusing method or a laser focusing method.
  • the third aspect of the embodiments of the present application provides an electronic device, including: a touch screen, where the touch screen includes a touch-sensitive surface and a display; a camera; a processor; a memory; a plurality of application programs; and a computer program.
  • the computer program is stored in the memory, and the computer program includes instructions.
  • the instruction is executed by the electronic device, the electronic device is caused to execute the image capturing method in any one of the possible implementations of the first aspect.
  • a fourth aspect of the embodiments of the present application provides an electronic device, including a processor and a memory.
  • the memory is coupled with the processor, and the memory is used to store computer instructions.
  • the processor executes the computer instructions
  • the terminal device is caused to execute the image shooting method in any one of the possible implementations of the first aspect.
  • a fifth aspect of the embodiments of the present application provides an electronic device, including a memory and multiple processors.
  • the memory is coupled with multiple processors, and the memory is used to store computer instructions.
  • the terminal device is caused to execute the image capturing method in any one of the possible implementations of the first aspect.
  • the multiple processors may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), and a control Processor, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU), among which, AP, modem processor, GPU, ISP, controller, video codec, DSP, baseband processor, etc. can be used for focusing by the first focusing method, and NPU can be used for focusing by the second focusing method.
  • AP application processor
  • modem processor GPU
  • ISP image signal processor
  • NPU neural-network processing unit
  • a sixth aspect of the embodiments of the present application provides a wireless communication device, the wireless communication device includes: a processor and an interface circuit; wherein the processor is coupled to a memory through the interface circuit, and the processor is used to execute a program in the memory Code to implement the image capturing method in any possible implementation manner in the first aspect.
  • a seventh aspect of the embodiments of the present application provides a computer storage medium, including computer instructions, which when the computer instructions run on an electronic device, cause the electronic device to execute the image capturing method in any one of the possible implementations of the first aspect.
  • the eighth aspect of the embodiments of the present application provides a computer program product, which when the computer program product runs on a terminal device, causes the electronic device to execute the image capturing method in any one of the possible implementations of the first aspect.
  • the embodiments of the present application provide an image shooting method and related devices. After the conventional focusing method is used to focus the target focus subject and the corresponding image is obtained, the conventional focusing method is difficult to achieve in-focus in the current scene, which leads to this When the sharpness of the target focus subject in the image is less than a certain threshold, a neural network model-based focusing method that is more adaptable to the scene is used for focusing to obtain a clear image.
  • 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 this application.
  • Figure 1c is a schematic diagram of a set of display interfaces provided by an embodiment of the application.
  • FIG. 2 is a schematic diagram of another set of display interfaces provided by an embodiment of the application.
  • FIG. 3 is a schematic diagram of another set of display interfaces provided by an embodiment of the application.
  • FIG. 4 is a schematic diagram of another set of display interfaces provided by an embodiment of the application.
  • Figure 5a is a schematic diagram of a receptive field provided by an embodiment of the application.
  • FIG. 5b is a schematic structural diagram of a neural network model provided by an embodiment of this application.
  • FIG. 5c is a schematic diagram of another set of display interfaces provided by an embodiment of the application.
  • FIG. 6 is a schematic diagram of another set of display interfaces provided by an embodiment of the application.
  • FIG. 7 is a schematic diagram of another set of display interfaces provided by an embodiment of the application.
  • FIG. 8 is a schematic diagram of lens movement provided by an embodiment of the application.
  • FIG. 9A is a schematic diagram of a set of display interfaces provided by an embodiment of the application.
  • FIG. 9B is a schematic diagram of another set of display interfaces provided by an embodiment of the application.
  • FIG. 10 is a schematic diagram of another set of display interfaces provided by an embodiment of the application.
  • FIG. 11 is a schematic diagram of another display interface provided by an embodiment of the application.
  • FIG. 12 is a schematic diagram of another display interface provided by an embodiment of the application.
  • FIG. 13 is a schematic flowchart of an image shooting method provided by an embodiment of the application.
  • FIG. 14 is a schematic structural diagram of an electronic device provided by an embodiment of this application.
  • FIG. 15 is a schematic structural diagram of an electronic device provided by an embodiment of the application.
  • FIG. 16 is a schematic structural diagram of a wireless communication device provided by an embodiment of this application.
  • first and second are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined with “first” and “second” may explicitly or implicitly include one or more of these features. In the description of the present embodiment, unless otherwise specified, “plurality” means two or more.
  • auxiliary information is obtained through multiple devices on the terminal, and then focusing is performed based on the obtained auxiliary information, such as phase focusing method, laser focusing method, contrast focusing method or dual Auxiliary focusing methods such as eye focusing method.
  • auxiliary information obtained by these focusing methods often has limitations and gives wrong data, which ultimately results in the inability to focus sharply.
  • the phase focusing method is through hardware, a new separation lens and a linear sensor pair are added for image processing. After the two images are separated by the separation lens, the linear sensor detects the distance between the two images, thereby pushing the lens to align focus. Position to ensure the clarity of the image.
  • the phase focusing method is often difficult to predict the focus position, which makes it difficult to achieve better focusing results.
  • the laser focusing method predicts the distance between the target object and the lens by means of hardware (such as a laser emitting device and a rangefinder), and converts the distance into a corresponding lens position, thereby pushing the lens to the predicted in-focus position.
  • hardware such as a laser emitting device and a rangefinder
  • the laser emitting device emits infrared laser light
  • the infrared laser light is irradiated on the surface of the target object, and after being reflected by the target object, the infrared laser light is received by the rangefinder.
  • the distance between the target object and the lens can be calculated by calculating the time difference between the transmission time and the reception time of the infrared laser, so that focusing can be achieved based on this distance.
  • the laser focusing method uses infrared lasers to perceive the focusing distance, it is easily disturbed by ambient light, such as a scene where the sun is direct or a strong light is direct, and the rangefinder may receive other reflected light, which makes it difficult to accurately calculate the target
  • ambient light such as a scene where the sun is direct or a strong light is direct
  • the rangefinder may receive other reflected light, which makes it difficult to accurately calculate the target
  • the distance between the object and the lens causes poor focusing.
  • the contrast focusing method is to detect the contrast of the captured image, adjust the lens position continuously before detecting the maximum contrast, and finally find the lens position that can maximize the image contrast, that is, the quasi-focus position.
  • the contrast focusing method is difficult to find the maximum contrast position in flat area scenes, small target object scenes, and night scenes. It is also susceptible to external factors such as hand shake and environmental changes (such as flashing lights), resulting in image loss of focus. .
  • the embodiment of the present application provides an image shooting method, which can be applied to electronic devices. After the conventional focusing method is used to focus the target focus subject and the corresponding image is obtained, the conventional focusing method is used in the current scene.
  • the focus method based on the neural network model that is more adaptable to the scene is used to focus, which is obtained by image training in a large number of scenes
  • the neural network model provides the sharpness of the target focus subject in the image as auxiliary information to determine the lens position to obtain a clear image.
  • the image shooting method provided in the embodiments of the present application can be applied to electronic equipment, and the electronic equipment can include a terminal device or an electronic device.
  • the electronic device includes a processor and a memory and can be deployed on the terminal device.
  • terminal devices may include mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR)/virtual reality (VR) devices, laptops, ultra-mobile personal computers (ultra-mobile personal computers). , UMPC), netbooks, personal digital assistants (personal digital assistant, PDA) and other equipment.
  • the embodiments of the present application do not impose any restrictions on the specific types of terminal equipment and electronic devices.
  • 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, camera 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 light 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, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait.
  • AP application processor
  • modem processor modem processor
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec 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 may be the nerve center and command center of the electronic device 100.
  • 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 may 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 transceiver (universal asynchronous) interface.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transceiver
  • 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, camera 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 camera 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 camera 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 camera 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 external memory, the display screen 194, the camera 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 ISP is used to process the data fed back from the camera 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 is used to capture still images or videos.
  • the object generates an optical image through the lens and is projected to the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • 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 electronic device 100 may include one or N cameras 193, and N is a positive integer greater than one.
  • 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 a 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 processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121.
  • 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.
  • UFS universal flash storage
  • 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 calculates the altitude based on the air pressure value measured by the air pressure sensor 180C 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, etc.
  • 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 camera 193 collects color images
  • the ISP processes the data fed back by the camera 193
  • the NPU in the processor 110 can perform image segmentation on the ISP processed image to determine different objects on the image Or the area where different object types are located.
  • the processor 110 can retain the color of the area where the specific one or more objects are located, and perform gray-scale processing on other areas other than the area where the specific one or more objects are located, so that the entire area where the specific object is located can be grayed out. The color is preserved.
  • gray-scale processing refers to the conversion of pixel values of pixels into gray-scale values, and color images into gray-scale images (also called black-and-white images).
  • the pixel value is used to represent the color of the pixel.
  • the pixel value can be R (red) G (green) B (blue) value
  • 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 block diagram of the software structure of the 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 can include a window manager, a content provider, a view system, a phone manager, a resource manager, and a notification manager.
  • 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 electronic device as a mobile phone as an example to describe in detail the image capturing method provided in the embodiment of the present application.
  • FIG. 1c shows a graphical user interface (GUI) of the mobile phone, and the GUI is the desktop 101 of the mobile phone.
  • GUI graphical user interface
  • the mobile phone detects that the user has clicked the icon 102 of the camera application (application, APP) on the desktop 101, it can start the camera application and display another GUI as shown in (b) in Figure 1c.
  • This GUI can be called Shooting interface 103.
  • the shooting interface 103 may include a viewing frame 104. In the preview state, the preview image can be displayed in the viewing frame 104 in real time.
  • the image 1 may be displayed in the view frame 104.
  • the shooting interface may also include a control 105 for indicating the shooting mode, a control 106 for indicating the video mode, and a shooting control 107.
  • the camera mode when the mobile phone detects that the user clicks on the shooting control 307, the mobile phone performs the camera operation; in the video mode, when the mobile phone detects the user clicks on the shooting control 107, the mobile phone performs the video shooting operation.
  • the mobile phone After the mobile phone starts the camera, the mobile phone can collect the image of the current scene through the camera and display the collected image in the viewfinder frame. After acquiring the image of the current scene, the mobile phone can determine the target focus subject in the current scene, where the target focus subject may be a subject in the current scene that needs to obtain a clear image.
  • the mobile phone can determine the target focus subject in the auto focus mode. Generally, after the mobile phone starts the camera, the mobile phone can automatically enter the auto focus mode. In the auto focus mode, the mobile phone can automatically select a part of the area in the image of the current scene as the focus area, thereby determining that the target focus subject in the image of the current scene is the subject located in the focus area.
  • the focus area selected by the mobile phone can be preset, such as a square area or a circular area in the center of the image, etc.; the side length or perimeter of the focus area selected by the mobile phone can also be preset Yes, for example, when the mobile phone selects a square area as the focus area, the side length of the square area may be one-fifth of the side length of the view frame.
  • the mobile phone uses the center of the image of the current scene as a reference point, selects a square area in the center of the image as the focus area, and determines the target focus subject as the subject in the focus area.
  • the focus area selected by the mobile phone in the auto focus mode may be hidden, that is, the focus area selected by the mobile phone is not displayed on the shooting interface.
  • the mobile phone can determine the target focus subject in manual focus mode. Among them, after the mobile phone starts the camera, when the mobile phone detects that the user clicks on any position of the image in the viewfinder, the mobile phone can enter the manual focus mode. In manual focus mode, the phone can select the position the user clicks as the focus point, and select a square or circular area with the focus point as the focus area, so as to determine the target focus subject in the image of the current scene as the focus point. The subject in the focus area.
  • the user clicks on the flower in the image of the current scene in the viewfinder, as shown in Figure 3(b), after the mobile phone detects the user’s click, select A square area centered on the position clicked by the user is used as the focus area, and the flower located in the square area is determined as the target focus subject.
  • the mobile phone can determine the target focus subject in an artificial intelligence (AI) focus mode.
  • AI focus mode the mobile phone can detect the object in the image of the current scene, and when a specific object is detected, the object is determined to be the target focus subject. For example, detect people, animals, or buildings in static scenes, and determine the detected objects as the target focus subject; another example, detect moving people or animals in dynamic scenes, and determine the detected people or animals Focusing on the target subject; for another example, by identifying the foreground and the background in the image, detecting the object in the foreground of the image, and determining the object in the foreground of the image as the target focusing subject.
  • the mobile phone can detect the person in the image of the current scene, and when the person is detected, the person or the person’s face is selected as the target focus subject; for example, as As shown in Figure 4(b), the mobile phone can detect the animal in the image of the current scene, and when the animal is detected, the animal is selected as the target focus subject; for example, as shown in Figure 4(c) , The mobile phone can also detect the building in the image of the current scene, and when the building is detected, select the building as the target focus subject.
  • the mobile phone can have a variety of ways to enter the AI focus mode.
  • the mobile phone when the mobile phone detects that the user clicks on the AI control on the shooting interface, the mobile phone enters or exits the AI focus mode.
  • Figure 4 (d) when the mobile phone does not enter the AI focus mode
  • the mobile phone when the mobile phone detects that the user clicks the AI control 401 on the shooting interface, the mobile phone enters the AI focus mode and changes the display color of the AI control 401 (for example, changes the AI control 401 to color); after the mobile phone enters the AI focus mode.
  • the mobile phone detects that the user clicks the AI control 401 on the shooting interface, the mobile phone exits the AI focus mode and restores the original display color of the AI control 401 (for example, the AI control 401 is restored to white).
  • the mobile phone when the mobile phone detects that the user clicks the shooting option control on the shooting interface, the mobile phone can enter the mode selection interface, and when the mobile phone detects that the user clicks the AI mode control in the mode selection interface, the mobile phone enters AI focus Mode; Exemplarily, as shown in Figure 4 (e), when the mobile phone detects that the user clicks on the shooting option control 402, the mobile phone can enter the mode selection interface, as shown in Figure 4 (f), the mobile phone detects the user’s click mode When the AI mode control 403 in the interface is selected, the mobile phone can choose to enter the AI focus mode.
  • the mobile phone when the mobile phone detects the user's preset gesture operation on the shooting interface, it can enter or exit the AI focus mode; for example, when the mobile phone detects that the user draws a circle or drags a certain amount on the shooting interface When tracking, the phone can enter or exit AI focus mode.
  • the mobile phone After determining the target focus subject in the current scene, the mobile phone can focus on the target focus subject in the current scene through the first focusing method to obtain the first image.
  • the mobile phone may focus on the image of the current scene using a phase focusing method, that is, the first focusing method may be a phase focusing method.
  • the mobile phone may focus the image of the current scene through a laser focusing method, that is, the first focusing method may be a laser focusing method.
  • the mobile phone After the mobile phone uses the first focusing method to focus the target focused subject in the current scene and obtains the first image, the mobile phone can determine the definition of the target focused subject in the first image.
  • the mobile phone can determine the sharpness of the focused subject in the first image through a preset neural network model.
  • the mobile phone may input the first image marked with the target focus subject into the neural network model, and the neural network model outputs the clarity of the target focus subject in the first image.
  • the output value of the neural network model may be 30% , 50%, 100%, etc., where the above-mentioned 30%, 50%, 100% are the sharpness corresponding to the target focus subject in the first image.
  • the area where the target focus subject is located in the first image can be marked by the marking frame, so that the neural network model can obtain the area in the first image that needs to be output sharp.
  • the mark frame may be a frame with a preset shape, such as a square frame or a round frame, etc. The size of the mark frame matches the target focus subject, and the target focus subject can be enclosed in the mark frame .
  • the marking frame may also be a contour frame that matches the shape of the target focus subject, that is, the marking frame is a frame formed based on the outline of the target focus subject, and can just surround the target focus subject. Mark inside the box.
  • the neural network model may be obtained after training the machine learning model by using a large amount of training data.
  • the training data refers to the image data marked with the focus subject and the sharpness of the focused subject. By acquiring a large number of original images, the focused subject in the original image is marked, and the sharpness of the focused subject in these original images is marked. The training data used to train the model can be obtained.
  • the training data may be obtained by shooting a large number of scenes with a mobile phone or camera and other imaging devices in advance; specifically, in the same scene, the mobile phone can move the lens back and forth to capture images in different lens positions; After obtaining images at different lens positions, the sharpness of the image can be marked based on the lens position corresponding to the image. For example, suppose that the full range (full range) that the lens can move in a mobile phone is 500, and the lens can move back and forth between positions 100-600, where position 100 and position 600 are the two end positions where the lens can move).
  • the lens position difference refers to the difference between the lens position and the lens position when the image is taken.
  • the sharpness of the focused subject in the image has a corresponding relationship with the lens position when the image was taken. Therefore, the first image marked with the target focused subject is input to the training After the neural network model, the obtained sharpness of the target focus subject also has a corresponding relationship with the lens position, that is, the lens position when the image is in focus can be determined based on the sharpness of the target focus subject.
  • the neural network model is obtained based on image training data in a large number of scenes, the definition of the focus subject in the image based on the neural network model is more adaptable to the scene, that is, the clarity provided by the neural network model
  • the degree of auxiliary information does not have the limitations brought by the hardware, and can achieve quasi-focus in most scenes, and the focusing effect is good.
  • the above-mentioned machine learning model may be a convolutional neural network (convolutional neural network, CNN) model, a superresolution convolutional neural network (superresolution convolutional neural network, SRCNN) model, or a residual network (residual network, ResNet). ) Models and other models.
  • CNN convolutional neural network
  • SRCNN superresolution convolutional neural network
  • ResNet residual network
  • a very deep super resolution (VDSR) method based on a single image may be used to train the CNN model to obtain a trained neural network model.
  • the VDSR method refers to a given low-resolution image to generate a high-definition image
  • the specific implementation process is: through a network with a deeper network level (ie deep network), using a larger receptive field (receptive field) , Fully consider the contextual message, use residual learning and extremely high learning rate to improve the training effect.
  • the receptive field is the size of the area mapped on the input image by the pixels on the feature map output by each layer in the CNN model.
  • the receptive field is a point on the feature map corresponding to the area on the input image.
  • the receptive field after the convolution operation of the two-layer 3*3 convolution kernel is 5*5; the three-layer 3*
  • the receptive field after the 3 convolution kernel operation is 7*7.
  • the image is a 2-layer 3x3 convolution operation, and its receptive field is 5x5. The larger the receptive field, the larger the area on the input map corresponding to each feature point.
  • the process of using the VDSR method to train the CNN model may include:
  • a larger receptive field (for example, a receptive field larger than 41 ⁇ 41) can be used to ensure that more features can be learned, and through the data in the field, the labeling of the target, and the target
  • the data such as the spatial location of the CNN considers the context message, thereby improving the detection accuracy of the CNN model.
  • residual learning can be used to observe the difference between the actual observation value and the estimated value, such as a high learning rate greater than 0.1; and a gradient clipping method to avoid excessive training time.
  • the method of adopting gradient clipping may specifically be: L2norm (that is, L2 norm, where L2 refers to Euclidean distance) clipping according to a vector composed of gradients of multiple parameters.
  • L2norm that is, L2 norm, where L2 refers to Euclidean distance
  • a vector is formed by the rate of change of each parameter, and the L2norm of this vector is calculated by calculating the square and square of each element of the vector.
  • the L2norm of the rate of change of the vector can be made smaller than the preset clipnorm. It is worth noting that if the gradient clipping method is not adopted, the optimization algorithm with excessive gradient will exceed the optimal point.
  • FIG. 5b is specifically a network structure diagram for implementing the VDSR method.
  • the blurred image is subjected to in-depth convolution and activation functions through the vector convolution operator (Conv1) and activation function (Relu.1), Conv12 and Relu.2...Conv.D-1 and Relu.D-1, and finally Get high-precision images.
  • Conv1 vector convolution operator
  • activation function Relu.1
  • Conv12 Conv12 and Relu.2...Conv.D-1 and Relu.D-1
  • Get high-precision images Each layer of convolution Conv is a 3x3 matrix operator.
  • the activation function can effectively avoid gradient explosion.
  • the mobile phone can directly determine the sharpness of the target focus subject in the first image by default; in some cases below, the mobile phone can be after switching the target focus subject in the first image , To determine the sharpness of the switched target focus subject in the first image.
  • the first image may be detected.
  • the mobile phone detects that the first image is a multi-depth image and the target focus subject is located in the background area in the multi-depth image
  • the The target focus subject is switched to the subject in the foreground area in the multi-depth image, and the switched target focus subject is obtained.
  • Multi-depth image refers to an image with multiple depths of field.
  • the mobile phone can detect the sharpness or contrast of different regions in the first image. If the mobile phone detects that there are multiple sharpness or contrast areas in the first image, the mobile phone can determine that the first image is Multi-depth images.
  • the switching target focus subject is the subject in the foreground area, and based on the switched target focus subject passing
  • the neural network model can focus, which can correct the target focus subject, and focus to obtain a clear image of the subject in the foreground area, and the focus effect is good.
  • FIG. 5c shows that after the mobile phone determines that the subject corresponding to the image center of the current scene is the target focus subject, it focuses by the first focusing method to obtain the first image, and The first image is displayed on the shooting interface;
  • Figure 5c (b) shows that the mobile phone detects that the first image is a multi-depth image, and the foreground area in the first image is determined;
  • Figure 5c (c) shows that the mobile phone is in the determination of the first image After the foreground area, the subject in the foreground area is recognized, and the flowers located in the foreground area are identified, so that the target focus subject is switched to the flowers located in the foreground area.
  • the mobile phone may automatically detect the first image every time it obtains the first image, or it may detect the first image when the mobile phone is in a multi-depth shooting mode.
  • a multi-depth-of-field mode control may be displayed on the shooting interface of the mobile phone.
  • the mobile phone detects that the user clicks on the multi-depth-of-field mode control, the mobile phone enters the multi-depth shooting mode.
  • the multi-depth mode control may be a control 601; as shown in FIG. 6(b), the multi-depth mode control may be a control 602; in another embodiment ,
  • the multi-depth mode control can be displayed on the mode selection interface of the mobile phone.
  • the mobile phone When the mobile phone detects that the user clicks the shooting option control on the shooting interface, the mobile phone can enter the mode selection interface, and when the mobile phone detects that the user clicks on the mode selection interface In the multi-depth mode control, the mobile phone enters the multi-depth shooting mode; for example, as shown in FIG. 6(c), the multi-depth mode control may be a control 603.
  • the mobile phone can also detect the image of the current scene. When it detects that the image of the current scene is a multi-depth image, it automatically enters the multi-depth shooting mode, and displays the multi-depth shooting mode on the shooting interface Control to remind the user that the mobile phone has entered the multi-depth shooting mode.
  • the multi-depth mode control displayed on the shooting interface can be the control 604, or it can be as shown in Figure 6 (e).
  • the first image may be detected, and when the mobile phone detects that the first image contains the target object, the target focus subject is switched to the target object in the first image, Get the target focus subject after switching.
  • the target object may be a person; the target object may also be an animal, such as a cat, a dog, or a rabbit; the target object may also be a scene, such as flowers, grass, or trees; the target object may also be some specific objects , Such as a car, a water cup, or a mouse; the target object can also be a building, such as a tall building, iron tower, or temple.
  • Figure 7 shows that the mobile phone uses the first focusing method to focus to obtain a first image, and the first image is displayed on the shooting interface;
  • Figure 7 (b) shows the detection of the mobile phone
  • the first image contains the target object--the temple, and the target area where the temple is located in the first image is determined;
  • Figure 7(c) shows that the mobile phone performs the operation on the target area after determining the target area where the temple is located in the first image. Extract to mark the target object in the first image.
  • the mobile phone After the mobile phone determines the sharpness of the target focused subject in the first image, the mobile phone can determine whether the sharpness of the target focused subject in the current scene is less than a preset threshold.
  • the mobile phone when the mobile phone obtains the switched target focus subject, the mobile phone can determine in the current scene whether the sharpness of the switched target focus subject is less than a preset threshold.
  • the mobile phone can use the second focusing method to Focus on the target focus subject in the current scene or the switched target focus subject to obtain a second image with a better focus effect.
  • the sharpness of the target focused subject may be a degree value, score or percentage obtained based on a pre-trained neural network model, which is used to indicate the sharpness of the target focused subject; where , The higher the score or degree value, it can indicate that the target focus subject in the image is clearer.
  • a value range for expressing clarity can be 0% to 100%, or 0 to 100, or 0 to 10, etc.
  • the value of sharpness also has an association relationship with the position of the lens from which the image is obtained.
  • the sharpness corresponding to the target focus subject can be regarded as the highest;
  • the sharpness can be measured or expressed by brightness.
  • the greater the sharpness of the image the greater the brightness of the image; optionally, the sharpness can also be measured or expressed by chromaticity ,
  • the greater the sharpness of the image the greater the chromaticity of the image.
  • the brightness/chromaticity of the image may be specific to the overall brightness/chromaticity level of the entire area of the subject in the image, or specific to the overall average value of the brightness/chromaticity of each pixel in this area.
  • the sharpness can also be measured or expressed by contrast. For the same subject, the greater the sharpness of the image, the greater the contrast of the image.
  • contrast refers to the contrast between different brightness levels between the brightest white point and the darkest black point in the light and dark areas of the image. In simple terms, it is the difference between the brightest pixel in the area where the target focus subject is located. The brightness ratio between the pixels with the lowest brightness. Generally speaking, the greater the contrast, the clearer and more striking the image, and the more vivid and vivid the color; while the smaller the contrast, the more blurred the image and the grayer the color.
  • the contrast of the image may be specific to the overall contrast level of the entire area of the photographed subject in the image, or specific to the overall average value of the contrast of each pixel in this area.
  • the contrast of the image may be specific to the overall contrast level of the entire area of the photographed subject in the image, or specific to the overall average value of the contrast of each pixel in this area.
  • the blur degree value can also be used to determine whether the target focus subject in the image is out of focus. For the same subject, the larger the blur degree value, the less clear. The smaller the blur degree value, the clearer it is.
  • the blur degree value can be a degree value, score or percentage based on a pre-trained neural network model. When the blur degree value of the target focused subject in the image is greater than the preset threshold, it is determined that the target focused subject is out of focus, and the mobile phone uses the second focusing method to focus the target focused subject in the current scene or the switched target focused subject.
  • the value range of the blur degree value can also be 0 to 100%, and the value of the blur degree value has a corresponding relationship with the lens position when the first image is obtained, and the lens position when the first image is obtained is closer to the in-focus position , The smaller the blur degree value is; the farther the lens position when the first image is obtained is from the quasi-focus position, the larger the blur degree value is.
  • the blur degree value can also be characterized by contrast. During the focusing process, when the contrast of the target focus subject is the largest, the blur degree corresponds to a value of 0, and when the target focus subject has the smallest contrast, the blur degree corresponds to the value Is 100%.
  • the sharpness of the image can also be determined according to the blur degree value.
  • the sum of the blur degree and the sharpness of the image is a constant, specifically, for example, the blur degree of the first image. If it is 20% and the constant is 1, the definition of the first image is 80%.
  • the preset threshold may be a threshold preset by the terminal, and its specific value may be determined by the following exemplary method: for example, the specific value of the preset threshold is determined according to the accuracy or deviation of the neural network model , Or determine the specific value of the preset threshold according to the experience value obtained through a large number of shooting operations; optionally, the preset threshold may also be a threshold obtained by the terminal from the cloud, for example, the threshold set by the system when the terminal system is upgraded Optionally, the preset threshold may also be a threshold set by the user through the terminal, for example, a threshold set through the system interactive interface.
  • the preset threshold is a value used to measure whether the target focused subject in the image is out of focus.
  • the sharpness of the target focused subject in the first image is less than the preset threshold, it can be considered that the first image is out of focus; therefore,
  • the accuracy of the neural network model to detect sharpness and the experience value of out-of-focus can be combined to determine the specific value of the preset threshold.
  • the out-of-focus experience value refers to an out-of-focus value determined based on experience.
  • the image is considered out of focus; that is to say, in practical applications, in the neural network
  • the value of the preset threshold can be closer to the defocus experience value.
  • the difference between the preset threshold value and the defocus experience value can be determined according to the deviation of the neural network model. Difference value, thereby determining the value of the preset threshold.
  • the preset threshold may specifically be 80% or 85%; generally speaking, the preset threshold is generally 100% The value other than the value, that is, the value of the preset threshold is not the maximum value corresponding to the sharpness.
  • the mobile phone determines that the sharpness of the target focused subject in the first image is less than the preset threshold, it can be considered that the target focused subject in the first image obtained after the mobile phone uses the first focusing method to focus is relatively blurred, that is, the first image The sharpness of the target focus subject in an image does not meet the requirements.
  • the mobile phone can focus the image of the current scene again through the second focusing method to obtain a second image with higher sharpness of the target focus subject.
  • the focusing method based on the neural network model may specifically obtain the sharpness of the target focus subject in the image through the neural network model, and then determine the position of the lens to be moved according to the sharpness of the image and the position of the current lens. And through the focus motor drive the lens to move to the determined position, so as to achieve focus. Since the neural network model is based on image training in a large number of various scenes, it is highly adaptable to various scenes. Therefore, the neural network model can accurately obtain the sharpness of the target focus subject in the current image, so that the mobile phone can According to the sharpness of the image, the position of the lens is controlled to achieve focus and obtain a clear image.
  • the lens can move between position 100 and position 600.
  • the first image is determined by the above-mentioned neural network model.
  • the sharpness of the target focus subject in the image is 60%, and it is determined that the position of the lens when the first image is taken is 350, then the lens can be determined according to the sharpness of the target focus subject in the first image 60% and the full range of the lens 500
  • the position is 150 or 550. After determining the position of the lens to be moved, the lens can be moved to the determined position by pushing the focus motor.
  • the lens when it is determined that there are two positions where the lens is to be moved, the lens may be randomly moved to one of the positions, and the image collected by the lens at that position may be obtained, and then the collected image may be obtained If the sharpness of the image captured after the lens is moved is smaller than the sharpness of the target focus subject in the first image, the position where the lens moved is determined to be the in-focus position, and the focus is completed; if the lens is moving The resolution of the obtained image is less than the resolution of the target focus subject in the first image, then the lens is moved to another position to be moved, and the last position of the lens is determined to be the in-focus position, and the focusing is completed.
  • the lens when it is determined that the position of the lens to be moved is 150 or 550, the lens can be moved to position 150 first, and then after the lens is moved to position 150, the position is acquired Download the corresponding image. If the sharpness of the corresponding image when the lens position is 150 is less than that when the lens position is 350, then determine the lens at position 150 as the collimated position; if the corresponding image when the lens position is 150 If the sharpness of the lens is greater than that when the lens position is 350, then the lens is moved to position 550, and the lens is determined to be the in-focus position at position 550.
  • the lens when it is determined that there are two positions of the lens to be moved, it can be determined whether the first image is a multi-depth image, and if the first image is a multi-depth image, the lens can be moved to the position to be moved A position close to the first end position in the middle, where the first end position is the end position where the lens can achieve image aligning focus in a macro scene; if the first image is not a multi-depth image, you can move the lens to the One of the moved positions that is close to the second end position, where the second end position is the end position where the lens can achieve image in-focus in an infinite scene.
  • position 600 is the above-mentioned first end position
  • the lens can be achieved when shooting objects at infinity at position 100
  • position 100 is the second end position described above; in this way, when the first image is a multi-depth image, position 550 is closer to position 600 than position 150, so the lens can be moved to position 550;
  • position 150 is closer to the position 100 than the position 550, so the lens can be moved to the position 150.
  • the first image includes foreground objects and background objects.
  • the lens when the lens is moved to the direction of the first end point, it will be easier to image the foreground objects Clear, achieve quasi-focus; when the first image is not a multi-depth image, the first image usually includes distant objects. Therefore, when the lens is moved to the second end position, it will be easier to make distant objects The image of the object is clear and the focus is achieved.
  • the lens can move between position 100 and position 600.
  • the sharpness of the target focus subject in the image is 60%, and it is determined that the position of the lens when the first image is taken is 250, then the lens can be determined according to the sharpness of the target focus subject in the first image 60% and the full range of the lens 500
  • the position is 50 or 450. Obviously, the position 50 has exceeded the range that the lens can move, and the lens cannot be moved to the position 50. Therefore, it can be determined that the position of the lens to be moved is only 450. At this time, you can push the focus motor to Move the lens to position 450.
  • the above-mentioned neural network model is used to determine that the sharpness of the target focus subject in the first image is 60%, and it is determined that the lens when the first image is taken
  • the position is 450, then the distance between the position of the lens to be moved and the position of the lens when the first image is taken is 500 according to the 60% of the sharpness of the target focus subject in the first image and the full range of the lens 500.
  • *(1-40%) 200, combined with the position 450 of the lens when the first image was taken, it can be calculated that the position of the lens to be moved is 250 or 650.
  • the position 650 has exceeded the range that the lens can move , The lens cannot be moved to position 650, therefore, it can be determined that the position of the lens to be moved is only 250.
  • the target image when the sharpness of the target focused subject in the first image is less than a preset threshold, the second image is output as the target image.
  • the target image may be the preview image displayed in the preview area on the shooting interface, that is, in the case where the sharpness of the target focus subject in the first image is less than the preset threshold, the second image is output as the preview image on the shooting interface.
  • Preview image may also be an image stored in a storage medium (for example, a non-volatile memory) in response to a user's photographing instruction.
  • the first image is output as the target image.
  • the target image may be a preview image on the photographing interface, or may be an image stored in a storage medium in response to a user's photographing instruction.
  • the mobile phone after the mobile phone switches the target focus subject to the subject located in the foreground area of the multi-depth image, in the process that the mobile phone uses the second focusing method to focus the switched target focus subject, in order to facilitate the user to know the switch
  • the mobile phone can display a focus frame on the shooting interface, and the focus frame is used to mark the target focus subject after switching in the current scene.
  • the mobile phone may display a focus frame 901 for marking the target focus subject after switching in the current scene on the shooting interface.
  • the focus frame used to mark the switched target focus subject can also be the focus frame 902; exemplarily, as shown in Figure 9A (c), for The focus frame for marking the target focus subject after the switch may also be the focus frame 903; for example, as shown in FIG. 9A (d), the focus frame for marking the target focus subject after the switch may also be the focus frame 904.
  • the mobile phone may display the focus on the shooting interface.
  • Frame the focus frame is used to mark the target focus subject after switching (that is, the target object in the current scene).
  • the mobile phone may display on the shooting interface for marking the switched target focus subject ⁇ focus frame 905.
  • the focus frame used to mark the switched target focus subject may also be the focus frame 906; for example, as shown in FIG. 9B (c), the focus frame used to mark The focus frame of the switched target focus subject may also be the focus frame 907; for example, as shown in FIG. 9B (d), the focus frame used to mark the switched target focus subject may also be the focus frame 908.
  • the mobile phone when the mobile phone uses the second focusing method to focus, the mobile phone may display the prompt message 1 on the shooting interface to remind the user that the mobile phone is currently switching the focusing method.
  • the prompt message 1 displayed on the shooting interface of the mobile phone may be message 1001, and message 1001 is specifically “the current image is blurred and the focus mode is being switched”; for example, as shown in Fig.
  • the prompt message 1 displayed on the shooting interface of the mobile phone can be information 1002, and information 1002 can be specifically "current image Blurred, the AI focus mode has been automatically switched"; as shown in Figure 10(c), the prompt message 1 displayed on the shooting interface of the mobile phone can be message 1003, and message 1003 is specifically "The current image is blurred, AI focus has been turned on”; As shown in Figure 10(d), the prompt message 1 displayed by the mobile phone on the shooting interface can be information 1004, which is specifically "Please hold the phone steady while switching the focus mode"; as shown in Figure 10(e) , The prompt message 1 displayed by the mobile phone on the shooting interface can be message 1005, which is specifically "Secondary focusing, please hold the phone steady”; as shown in Figure 10 (f), the prompt displayed on the shooting interface by the mobile phone Message 1 can be message 1006, and message 1006 is specifically "Improving image quality, please hold your phone
  • the prompt message 1 displayed on the shooting interface of the mobile phone can automatically disappear; for example, after the prompt message 1 is displayed on the shooting interface of the mobile phone for a preset time ( For example, 1 second or 2 seconds, etc.), the prompt message 1 on the shooting interface can automatically disappear.
  • a preset time For example, 1 second or 2 seconds, etc.
  • the shooting interface After the second focusing method is used to focus the target focused subject in the current scene to obtain the second image, when the sharpness of the target focused subject in the second image is less than a preset threshold, in the shooting interface
  • the prompt message 2 is displayed on the screen, and the prompt message 2 is used to prompt the user to adjust the shooting distance. Since the camera in the mobile phone has a minimum focus distance limit, when the mobile phone is too close to the target object, it is often difficult for the mobile phone to achieve focus. Then when the sharpness of the target focus subject in the second image is less than the preset threshold, it can be considered After the mobile phone has been focused twice, it still cannot achieve quasi-focus.
  • the mobile phone may display the prompt message 2 on the shooting interface for prompting the user to adjust the shooting distance.
  • the prompt message 2 may be information 1101 on the shooting interface, and the information 1101 is specifically "The current shooting distance is too close, please move your phone away"; for example, as shown in Figure 11
  • the prompt message 2 can be the information 1102 on the shooting interface, and the message 1102 is specifically "The current shooting distance is too close, please adjust the shooting distance”; as shown in Figure 11 (c), the prompt message 2 can be It is the information 1103 on the shooting interface, and the information 1103 is specifically "the current shooting distance is less than the minimum focus distance".
  • the mobile phone when the mobile phone is equipped with multiple cameras, when the mobile phone determines that the sharpness of the target focus subject in the second image is less than the preset threshold, the mobile phone may also display the prompt message 3 on the shooting interface.
  • Prompt message 3 is used to prompt the user to switch cameras.
  • a prompt message 3 for prompting the user to switch cameras may be displayed on the shooting interface of the mobile phone.
  • the prompt message 3 may be information 1201, and the information 1201 may specifically be "the current shooting distance is over Close, please switch the macro camera"; for example, as shown in Figure 12(b), the camera switching control 1202 is displayed on the shooting interface of the mobile phone, and the mobile phone detects that the user clicks the camera switching control 1202 to indicate macro When the camera button is pressed, the mobile phone can switch the camera to a macro camera for focusing; for example, as shown in Figure 12(c), in response to the user clicking the button of the camera switch control 1202 that represents the macro camera, the mobile phone will The camera is switched to a macro camera and focused, and the camera switching control 1203 displays that the currently working camera is a macro camera.
  • the wide-angle lens in the mobile phone is configured with a wide-angle shooting mode
  • the macro lens in the mobile phone is configured with a macro shooting mode.
  • Information 3 can also be used to prompt the user to switch the shooting mode.
  • the mobile phone can enter the macro shooting mode and switch the macro lens for shooting.
  • a prompt message 3 for prompting the user to switch the shooting mode may be displayed on the shooting interface of the mobile phone.
  • the prompt message 3 may be information 1204, and the information 1204 may specifically be "current shooting distance Too close, please switch the macro shooting mode"; for example, as shown in Figure 12(e), a macro shooting mode switching control 1205 is displayed on the shooting interface of the mobile phone, and it is detected that the user clicks on the macro shooting on the mobile phone
  • the mode switching control 1205 the mobile phone can enter the macro shooting mode and switch the camera to a macro camera for focusing; for example, as shown in (f) of FIG. 12, in response to the user clicking the macro shooting mode switching control 1205 , The phone switches the camera to a macro camera and focuses, and displays the macro shooting mode control 1206 on the shooting interface.
  • the phone detects that the user clicks the close button on the macro shooting mode control 1206, the phone can exit the macro Shooting mode.
  • the embodiments of the present application provide an image capturing method, which can be implemented by electronic equipment (such as terminal equipment such as mobile phones and tablet computers or electronic devices that can be deployed on terminal equipment). As shown in Figure 13, the method may include the following steps:
  • the first focusing method may be a phase focusing method or a laser focusing method.
  • the electronic device may perform focusing by the first focusing method in the auto-focus mode as shown in FIG. 2; for example, the electronic device may also perform focusing by the first focusing method in the manual focus mode as shown in FIG. Method for focusing; for example, the electronic device may also perform focusing by the first focusing method in the AI focusing mode as shown in FIG. 4.
  • the sharpness of the target focused subject in the first image is less than the preset threshold
  • the target focused subject in the second image is sharp
  • the degree is not less than a preset threshold; wherein, the lens positions corresponding to the first focusing method and the second focusing method are different, and the second focusing method is a focusing method based on a neural network model.
  • the electronic device may determine the sharpness of the target focus subject in the first image through the aforementioned neural network model.
  • the first focusing method may include a phase focusing method or a laser focusing method
  • the second focusing method is a focusing method based on a neural network model, and the sharpness of the target focus subject in the second image captured based on the second focusing method Not less than the preset threshold.
  • the second image is output as the target image.
  • the first image is output as the target image.
  • the target image may be a preview image displayed in the preview area on the shooting interface; or, the target image may also be an image stored in a storage medium in response to a user's photographing instruction.
  • focusing on the target focused subject in the current scene by the second focusing method includes:
  • the first image marked with the target focus subject is input into the neural network model, and the first output result of the neural network model is obtained.
  • the first output result is the sharpness of the target focus subject in the first image; according to the target focus subject in the first image Adjust the lens position to obtain the second image.
  • the first image marked with the target focused subject can be input into the neural network model, and the target in the first image can be obtained based on the neural network model. Focusing on the sharpness of the subject, then determining the moving position of the lens according to the sharpness of the target focusing subject, and moving the lens to the determined position, thereby completing focusing and obtaining a second image.
  • adjusting the lens position according to the sharpness of the target focus subject in the first image includes: determining the movement value of the lens according to the sharpness of the target focus subject in the first image and the full range, where the full range is the lens can The maximum range value of the movement, the movement value is the difference between the full range and the first product, the first product is the product of the sharpness and the full range; the lens is moved to the target position according to the movement value.
  • the target focus subject when the first image is a multi-depth image and the target focus subject is located in the background area of the multi-depth image, the target focus subject is switched to the subject in the foreground area of the multi-depth image to obtain the switched The target focus subject; when the clarity of the target focus subject in the first image is less than the preset threshold, the second focus method is used to focus the target focus subject in the current scene to obtain a second image, including: switching in the first image When the sharpness of the subsequent target focused subject is less than the preset threshold, the switched target focused subject is focused by the second focusing method in the current scene to obtain a second image.
  • focusing on the switched target focus subject in the current scene by the second focus method includes: inputting the first image marked with the switched target focus subject into the neural network model to obtain the neural network model
  • the second output result is the sharpness of the switched target focus subject in the first image; the lens position is adjusted according to the sharpness of the switched target focus subject in the first image to obtain the second image.
  • the neural network model is obtained by training image training data marked with the focus subject and the sharpness of the focus subject.
  • the focus frame may be displayed on the shooting interface according to the switched target focus subject.
  • the focus frame is used to mark the target focus subject after switching.
  • a prompt message 1 may be displayed on the shooting interface, and the prompt message 1 is used to prompt the user to switch the focusing method or to turn on the mode of focusing by the second focusing method.
  • the prompt information 1 may be information 1001 to information 1006 as shown in FIG. 10.
  • the shooting interface After the second focusing method is used to focus the target focused subject in the current scene to obtain the second image, when the sharpness of the target focused subject in the second image is less than a preset threshold, in the shooting interface
  • the prompt message 2 is displayed on the screen, and the prompt message 2 is used to prompt the user to adjust the shooting distance.
  • the prompt information 2 may be information 1101 to information 1106 as shown in FIG. 11.
  • the shooting interface After the second focusing method is used to focus the target focused subject in the current scene to obtain the second image, when the sharpness of the target focused subject in the second image is less than a preset threshold, in the shooting interface
  • the prompt message 3 is displayed on the screen, and the prompt message 3 is used to prompt the user to switch the camera or switch the shooting mode.
  • the prompt information 3 may be information 1201 to information 1206 as shown in FIG. 12.
  • an electronic device in order to implement the above-mentioned functions, includes hardware and/or software modules corresponding to each function.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Those skilled in the art can use different methods for each specific application in combination with the embodiments to implement the described functions, but such implementation should not be considered as going beyond the scope of the present application.
  • the electronic device can be divided into functional modules according to the foregoing method examples.
  • each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module.
  • the above-mentioned integrated modules can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
  • FIG. 14 shows a schematic diagram of a possible composition of the electronic device 1400 involved in the foregoing embodiment.
  • the electronic device 1400 may include: a processing unit 1401 and display unit 1402.
  • processing unit 1401 may be used to support the electronic device 1400 to perform the above steps 1301, 1302, and 1303, and/or other processes used in the technology described herein.
  • the display unit 1402 may be used to support the electronic device 1400 to perform the steps of displaying the focus frame, prompt information 1, prompt information 2, and prompt information 3, and/or other processes used in the technology described herein.
  • the electronic device provided in this embodiment is used to execute the above-mentioned image capturing method, and therefore can achieve the same effect as the above-mentioned implementation method.
  • the electronic device may include a processing module, a storage module, and a communication module.
  • the processing module can be used to control and manage the actions of the electronic device, for example, can be used to support the electronic device to execute the steps performed by the processing unit 1401 described above.
  • the storage module can be used to support the storage of program codes and data in the electronic device.
  • the communication module can be used to support the communication between electronic devices and other devices.
  • the processing module may be a processor or a controller. It can implement or execute various exemplary logical blocks, modules, and circuits described in conjunction with the disclosure of this application.
  • the processor may also be a combination of computing functions, for example, a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, and so on.
  • the storage module may be a memory.
  • the communication module may specifically be a radio frequency circuit, a Bluetooth chip, a Wi-Fi chip, and other devices that interact with other electronic devices.
  • the device of each embodiment of the present application may also be implemented based on an electronic device including a memory and a processor.
  • the memory stores instructions for executing the method of each embodiment of the present application, and the processor executes the foregoing instructions so that the terminal device executes the present application. Apply the method of each embodiment.
  • FIG. 15 is a schematic structural diagram of an electronic device according to an embodiment of the application.
  • An electronic device 1500 provided by an embodiment of the present application includes a processor 1501 and a memory 1502.
  • the memory 1502 stores computer instructions.
  • the processor 1501 is used to implement the following steps when executing the computer instructions on the memory:
  • the second focus method is used to focus the target focus subject in the current scene to obtain a second image.
  • the sharpness of the target focus subject in the second image is not Less than a preset threshold; where the first focusing method and the second focusing method correspond to different lens positions, and the second focusing method is a focusing method based on a neural network model.
  • the processor 1501 is also used to implement the following step when executing the computer instructions on the memory: when the sharpness of the target focus subject in the first image is less than the preset threshold, output the second image as the target image.
  • the processor 1501 is also used to implement the following step when executing the computer instructions on the memory: when the sharpness of the target focus subject in the first image is not less than the preset threshold, output the first image as the target image.
  • the processor 1501 is also used to implement the following steps when executing the computer instructions on the memory: input the first image marked with the target focus subject into the neural network model to obtain the first output result of the neural network model, An output result is the sharpness of the target focused subject in the first image; the lens position is adjusted according to the sharpness of the target focused subject in the first image to obtain a second image.
  • the processor 1501 is also used to implement the following steps when executing the computer instructions on the memory: determining the movement value of the lens according to the sharpness of the target focus subject in the first image and the full range, where the full range is the lens The maximum range value that can be moved, the movement value is the difference between the full range and the first product, and the first product is the product of the sharpness and the full range; the lens is moved to the target position according to the movement value.
  • the processor 1501 is also used to implement the following steps when executing the computer instructions on the memory: when the first image is a multi-depth image and the target focus subject is located in the background area in the multi-depth image, focus the target The subject is switched to the subject in the foreground area in the multi-depth image, and the switched target focus subject is obtained; when the sharpness of the switched target focus subject in the first image is less than the preset threshold, the second focus is used in the current scene The method focuses on the switched target focus subject to obtain a second image.
  • the processor 1501 is also used to implement the following steps when executing the computer instructions on the memory: input the first image marked with the switched target focus subject into the neural network model to obtain the second output of the neural network model As a result, the second output result is the sharpness of the switched target focus subject in the first image; the lens position is adjusted according to the sharpness of the switched target focus subject in the first image to obtain the second image.
  • the neural network model is obtained by training the image training data labeled with the focus subject and the sharpness of the focus subject.
  • the processor 1501 is also used to implement the following steps when executing the computer instructions on the memory: display a focus frame on the shooting interface according to the switched target focus subject, and the focus frame is used to mark the switched target focus subject .
  • the processor 1501 is further configured to implement the following steps when executing computer instructions on the memory:
  • the first signal is sent to the display module of the terminal device, so that the terminal device displays a focus frame on the shooting interface, and the focus frame is used to mark the target focus subject after switching.
  • the processor 1501 is further configured to implement the following steps when executing computer instructions on the memory:
  • the prompt information 2 is used to prompt the user to switch the focus method or enable the second focus method. Focus mode.
  • the processor 1501 mentioned in the embodiments of the present application may include one or more processing units.
  • the processor 1501 may include an application processor, a modem processor, a graphics processor, an image signal processor, and a control unit.
  • the different processing units may be independent devices or integrated in one or more processors.
  • the processor 1501 may include one or more interfaces.
  • the interface may 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/receiver (universal asynchronous) interface.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transmitter/receiver
  • 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 1501 may include multiple sets of I2C buses.
  • the processor 1501 may be respectively coupled to the touch sensor, charger, flash, camera, etc. through different I2C bus interfaces.
  • the processor 1501 may couple the touch sensor through an I2C interface, so that the processor 1501 communicates with the touch sensor through the I2C bus interface, so as to realize the touch function of the terminal device.
  • the MIPI interface can be used to connect the processor 1501 with peripheral devices such as display screens and cameras of terminal 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 1501 and the camera communicate through a CSI interface to implement the shooting function of the terminal device.
  • the processor 1501 and the display screen communicate through the DSI interface to realize the display function of the terminal device.
  • the interface connection relationship between the modules illustrated in this embodiment is merely a schematic description, and does not constitute a structural limitation on the terminal device.
  • the terminal device may also adopt different interface connection modes in the foregoing embodiments, or a combination of multiple interface connection modes.
  • the memory 1502 may be a volatile memory or a non-volatile memory (non-volatile memory), or may include both volatile and non-volatile memory.
  • the non-volatile memory can be read-only memory (read-only memory, ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically erasable Programming read-only memory (electrically EPROM, EEPROM), flash memory (flash memory), hard disk drive (HDD) or solid-state drive (solid-state drive, SSD).
  • the volatile memory may be random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • static random access memory static random access memory
  • dynamic RAM dynamic random access memory
  • synchronousDRAM synchronous dynamic random access memory
  • doubledatarateSDRAM doubledatarateSDRAM
  • DDRSDRAM Double data rate synchronous dynamic random access memory
  • enhancedSDRAM enhanced synchronous dynamic random access memory
  • seriallinkDRAM seriallinkDRAM
  • directrambusRAM direct memory bus random access memory
  • memory described in this embodiment is intended to include, but is not limited to, these and any other suitable types of memory.
  • FIG. 16 is a schematic structural diagram of a wireless communication device according to an embodiment of this application.
  • An embodiment of the present application further provides a wireless communication device 1600.
  • the wireless communication device 1600 includes a processor 1601 and an interface circuit 1602; wherein, the processor 1601 is coupled to the memory 1603 through the interface circuit 1602, and the processor 1601 is used for The program code in the memory 1603 is executed, so that the wireless communication device executes the above-mentioned related method steps to implement the image shooting method in the above-mentioned embodiment.
  • This embodiment also provides a computer storage medium in which computer instructions are stored.
  • the computer instructions run on an electronic device, the electronic device executes the above-mentioned related method steps to implement the image shooting method in the above-mentioned embodiment.
  • This embodiment also provides a computer program product, which when the computer program product runs on an electronic device, causes the electronic device to execute the above-mentioned related steps, so as to realize the image shooting 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 image capturing method in the foregoing method embodiments.
  • the electronic equipment, 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 specific working process of the above-described system, device, and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
  • the disclosed system, device, and method can be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined It can be integrated into another system, 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 components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. 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 computer readable storage medium.
  • the technical solution of this application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium.
  • Including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory, random access memory, magnetic disk or optical disk and other media that can store program codes.

Abstract

Disclosed are an image photographing method and a related apparatus, which can switch, when an image photographed by means of a conventional focusing method is blurred, to carrying out focusing using a focusing method, which is based on a neural network model and has a stronger adaptability to scenarios, so as to photograph a clear image. The solution specifically comprises: determining a target focused subject in the current scenario; focusing on the target focused subject in the current scenario by means of a first focusing method to obtain a first image; and when the definition of the target focused subject in the first image is less than a preset threshold value, focusing on the target focused subject in the current scenario by means of a second focusing method to obtain a second image, wherein camera positions corresponding to the first focusing method and the second focusing method are different, the second focusing method is a focusing method based on a neural network model, and the definition of the target focused subject in the second image photographed on the basis of the second focusing method is not less than the preset threshold value.

Description

一种图像拍摄方法及相关装置Image shooting method and related device
本申请要求于2019年12月31日提交中国专利局、申请号为201911426173.9、发明名称为“一种图像拍摄方法及相关装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office, the application number is 201911426173.9, and the invention title is "an image shooting method and related device" on December 31, 2019, the entire content of which is incorporated into this application by reference in.
技术领域Technical field
本申请涉及图像处理技术领域,尤其涉及一种图像拍摄方法及相关装置。This application relates to the field of image processing technology, and in particular to an image shooting method and related devices.
背景技术Background technique
随着电子技术和图像处理技术的快速发展,智能手机、平板电脑等智能终端的拍照功能越来越强大,部分智能终端的拍照能力甚至能够媲美普通的数码相机。With the rapid development of electronic technology and image processing technology, the camera functions of smart terminals such as smartphones and tablet computers have become more and more powerful, and the camera capabilities of some smart terminals can even be comparable to ordinary digital cameras.
在使用智能终端拍照的过程中,为了能够拍得到更好清晰度的照片,需要对当前场景的图像进行对焦,也就是根据当前的场景来调节镜头的位置以获取到最高清晰度的照片。In the process of using the smart terminal to take pictures, in order to be able to take better-definition pictures, it is necessary to focus on the image of the current scene, that is, adjust the position of the lens according to the current scene to obtain the highest-definition picture.
然而,对于一些图像拍摄方法而言,比如相位对焦方法或激光对焦方法,在一些特定的场景下其对焦能力较差,往往难以有效地实现准焦,从而无法拍摄得到清晰的照片。However, for some image shooting methods, such as phase focusing method or laser focusing method, the focusing ability is poor in some specific scenes, and it is often difficult to effectively achieve collimation, so that it is impossible to take clear pictures.
发明内容Summary of the invention
本申请实施例提供了一种图像拍摄方法及相关装置,在使用常规的对焦方法对目标对焦主体进行对焦并且得到相应的图像之后,在常规的对焦方法在当前场景下难以实现准焦而导致该图像中目标对焦主体的清晰度小于一定阈值的情况下,采用对场景的适应性更强的基于神经网络模型的对焦方法进行对焦,以获得拍摄清晰的图像。The embodiments of the present application provide an image shooting method and related devices. After the conventional focusing method is used to focus the target focus subject and the corresponding image is obtained, the conventional focusing method is difficult to achieve in-focus in the current scene, which leads to this When the sharpness of the target focus subject in the image is less than a certain threshold, a neural network model-based focusing method that is more adaptable to the scene is used for focusing to obtain a clear image.
本申请实施例第一方面提供一种图像拍摄方法,可以应用于具有触摸屏和摄像头的终端设备,或应用于终端设备中的电子装置,该方法可以包括:响应于用户打开相机应用的操作,启动相机,进入拍摄模式;在进入拍摄模式后,确定当前场景中的目标对焦主体,即确定当前场景中需要获得清晰图像的主体;通过第一对焦方法对当前场景中的目标对焦主体进行对焦,得到第一图像;在第一图像中该目标对焦主体的清晰度小于预设阈值时,通过第二对焦方法对当前场景中的目标对焦主体进行对焦,得到第二图像;其中,第一对焦方法和第二对焦方法对应的镜头位置不同,即通过第一对焦方法对焦得到第一图像时的镜头位置与通过第二对焦方法对焦得到第二图像时的镜头位置不同。第一对焦方法可以包括相位对焦方法或者激光对焦方法,第二对焦方法为基于神经网络模型的对焦方法,基于第二对焦方法拍摄得到的第二图像中的目标对焦主体的清晰度不小于预设阈值。示例性地,预设阈值的值不是清晰度对应的最大取值。The first aspect of the embodiments of the present application provides an image capturing method, which can be applied to a terminal device with a touch screen and a camera, or to an electronic device in the terminal device. The method may include: in response to a user's operation to open the camera application, starting Camera, enter shooting mode; after entering shooting mode, determine the target focus subject in the current scene, that is, determine the subject in the current scene that needs to obtain a clear image; focus on the target focus subject in the current scene through the first focus method, and get A first image; when the sharpness of the target focused subject in the first image is less than a preset threshold, focus the target focused subject in the current scene by the second focusing method to obtain a second image; wherein, the first focusing method and The lens position corresponding to the second focusing method is different, that is, the lens position when the first image is obtained by focusing by the first focusing method is different from the lens position when the second image is obtained by focusing by the second focusing method. The first focusing method may include a phase focusing method or a laser focusing method, the second focusing method is a focusing method based on a neural network model, and the sharpness of the target focus subject in the second image captured based on the second focusing method is not less than a preset Threshold. Exemplarily, the value of the preset threshold is not the maximum value corresponding to the sharpness.
本实施例中,在常规的对焦方法在当前场景下难以实现准焦而导致该图像中目标对焦主体的清晰度小于一定阈值的情况下,采用基于神经网络模型的对焦方法进行对焦,由于该神经网络模型是基于大量场景下的图像数据训练得到的,因此基于神经网络模型的对焦方法对场景的适应性更强,能够在大部分的场景下实现准焦,从而能够获得目标对焦主体拍摄清晰的图像。In this embodiment, when the conventional focusing method is difficult to achieve align-in-focus in the current scene, and the sharpness of the target focus subject in the image is less than a certain threshold, the focusing method based on the neural network model is used for focusing. The network model is trained based on image data in a large number of scenes. Therefore, the focusing method based on the neural network model is more adaptable to the scene and can achieve aligning focus in most scenes, so as to obtain a clear shot of the target focus subject image.
可选地,在一种可能的实现方式中,该方法还包括:在第一图像中目标对焦主体的清晰度小于预设阈值时,输出第二图像为目标图像。示例性地,目标图像可以为拍摄界面上 预览区域所显示的预览图像,也就是说,在第一图像中目标对焦主体的清晰度小于预设阈值的情况下,输出第二图像作为拍摄界面上的预览图像。或者,目标图像还可以是响应于用户的拍照指示,存储至存储介质(例如非易失性存储器(non-volatilememory))中的图像。Optionally, in a possible implementation manner, the method further includes: when the sharpness of the target focused subject in the first image is less than a preset threshold, outputting the second image as the target image. Exemplarily, the target image may be the preview image displayed in the preview area on the shooting interface, that is, in the case where the sharpness of the target focus subject in the first image is less than the preset threshold, the second image is output as the preview image on the shooting interface. Preview image. Alternatively, the target image may also be an image stored in a storage medium (for example, a non-volatile memory (non-volatile memory)) in response to a user's photographing instruction.
可选地,在一种可能的实现方式中,该方法还包括:在第一图像中目标对焦主体的清晰度不小于预设阈值时,输出第一图像为目标图像。示例性地,目标图像可以是拍摄界面上的预览图像,也可以是响应于用户的拍照指示,存储至存储介质中的图像。Optionally, in a possible implementation manner, the method further includes: when the sharpness of the target focused subject in the first image is not less than a preset threshold, outputting the first image as the target image. Exemplarily, the target image may be a preview image on the photographing interface, or may be an image stored in a storage medium in response to a user's photographing instruction.
可选地,在一种可能的实现方式中,通过第二对焦方法对当前场景中的目标对焦主体进行对焦,包括:将标记有目标对焦主体的第一图像输入神经网络模型,得到神经网络模型的第一输出结果,第一输出结果为第一图像中目标对焦主体的清晰度;根据第一图像中目标对焦主体的清晰度调整镜头位置,得到第二图像。示例性地,在通过第二对焦方法对当前场景中的目标对焦主体进行对焦时,可以将标记有目标对焦主体的第一图像输入至神经网络模型中,基于神经网络模型得到第一图像中目标对焦主体的清晰度,然后根据目标对焦主体的清晰度确定镜头的移动位置,将镜头移动至所确定的位置上,从而完成对焦,得到第二图像。Optionally, in a possible implementation manner, focusing on the target focused subject in the current scene by the second focusing method includes: inputting the first image marked with the target focused subject into the neural network model to obtain the neural network model The first output result is the sharpness of the target focus subject in the first image; the lens position is adjusted according to the sharpness of the target focus subject in the first image to obtain the second image. Exemplarily, when the target focused subject in the current scene is focused by the second focusing method, the first image marked with the target focused subject can be input into the neural network model, and the target in the first image can be obtained based on the neural network model. Focusing on the sharpness of the subject, then determining the moving position of the lens according to the sharpness of the target focusing subject, and moving the lens to the determined position, thereby completing focusing and obtaining a second image.
可选地,在一种可能的实现方式中,根据第一图像中目标对焦主体的清晰度以及全量程确定镜头的移动值,其中,全量程为镜头可移动的最大范围值,移动值为全量程与第一乘积之间的差值,第一乘积为清晰度与全量程的乘积;根据移动值将镜头移动至目标位置。例如,在得到第一图像中目标对焦主体的清晰度为80%时,可以确定镜头的移动值为镜头的全量程与(全量程*80%)的差值,也就是说,镜头的移动值为全量程与20%(1-80%)的乘积。Optionally, in a possible implementation manner, the movement value of the lens is determined according to the definition of the target focus subject in the first image and the full range, where the full range is the maximum range value that the lens can move, and the movement value is the full range. The difference between the range and the first product. The first product is the product of the sharpness and the full range; the lens is moved to the target position according to the movement value. For example, when the sharpness of the target focus subject in the first image is 80%, it can be determined that the movement value of the lens is the difference between the full scale of the lens and (full scale*80%), that is, the movement value of the lens It is the product of full scale and 20% (1-80%).
可选地,在一种可能的实现方式中,该神经网络模型可以是基于标记有对焦主体以及对焦主体的清晰度的图像训练数据训练得到的,也就是说,在训练神经网络模型之前,可以获取大量标记有对焦主体以及对焦主体的清晰度的图像作为神经网络模型的训练数据。示例性地,训练数据可以是预先通过手机或相机等摄像设备对大量的场景进行拍摄得到的;具体地,在同一个场景下,手机可以通过来回移动镜头,拍摄获得不同镜头位置下的图像,并且确定该图像的对焦主体;在获得不同镜头位置下的图像之后,可以基于图像所对应的镜头位置来标注该图像中对焦主体的清晰度。在训练神经网络模型的过程中,先选取一部分训练数据输入至神经网络模型中,通过神经网络模型中的前向传播算法,得到神经网络模型的清晰度预测结果。由于这部分训练数据预先标记有正确的清晰度,因此可以计算清晰度预测结果和标记的清晰度之间的差距,再基于这个差距通过反向传播算法来相应地更新神经网络模型的参数取值,从而使得神经网络模型的预测结果能够更为接近真实结果。由于神经网络模型是基于大量各种场景下的图像训练得到的,对各种场景的适应性强,因此,通过神经网络模型能够准确地获取当前图像的清晰度,从而使得手机能够根据图像的清晰度来控制镜头移动的位置,从而实现对焦,获得清晰的图像。Optionally, in a possible implementation, the neural network model may be trained based on image training data marked with the focus subject and the sharpness of the focus subject, that is, before the neural network model is trained, Obtain a large number of images marked with the focus subject and the sharpness of the focus subject as the training data of the neural network model. Exemplarily, the training data can be obtained by shooting a large number of scenes with a mobile phone or camera and other imaging equipment; specifically, in the same scene, the mobile phone can move the lens back and forth to capture images at different lens positions. And determine the focus subject of the image; after obtaining images at different lens positions, the sharpness of the focus subject in the image can be marked based on the lens position corresponding to the image. In the process of training the neural network model, first select part of the training data and input it into the neural network model, and obtain the sharpness prediction result of the neural network model through the forward propagation algorithm in the neural network model. Because this part of the training data is pre-marked with the correct definition, the gap between the definition prediction result and the marked definition can be calculated, and then based on this gap, the parameter values of the neural network model are updated accordingly through the backpropagation algorithm , So that the prediction result of the neural network model can be closer to the real result. Since the neural network model is based on image training in a large number of various scenes, it has strong adaptability to various scenes. Therefore, the sharpness of the current image can be accurately obtained through the neural network model, so that the mobile phone can be based on the clearness of the image. Degree to control the position of the lens movement, so as to achieve focus and obtain a clear image.
可选地,在一种可能的实现方式中,该方法还包括:在第一图像为多景深图像,且目标对焦主体位于多景深图像中的背景区域时,将目标对焦主体切换为多景深图像中的前景 区域内的主体,从而得到切换后的目标对焦主体;在第一图像中目标对焦主体的清晰度小于预设阈值时,通过第二对焦方法对当前场景中的目标对焦主体进行对焦,得到第二图像,包括:在第一图像中切换后的目标对焦主体的清晰度小于预设阈值时,在当前场景中通过第二对焦方法对切换后的目标对焦主体进行对焦,得到第二图像。也就是说,在将目标对焦主体切换为多景深图像中的前景区域内的主体之后,通过第二对焦方法对当前场景中切换后的目标对焦主体进行对焦,以拍摄得到切换后的目标对焦主体清晰的第二图像。Optionally, in a possible implementation manner, the method further includes: when the first image is a multi-depth-of-field image, and the target focused subject is located in a background area in the multi-depth-of-field image, switching the target focused subject to a multi-depth image In the foreground area of the subject, the switched target focus subject is obtained; when the sharpness of the target focus subject in the first image is less than the preset threshold, the second focus method is used to focus the target focus subject in the current scene, Obtaining the second image includes: when the sharpness of the switched target focus subject in the first image is less than a preset threshold, focus the switched target focus subject in the current scene by the second focus method to obtain the second image . That is, after the target focus subject is switched to the subject in the foreground area in the multi-depth image, the second focus method is used to focus the switched target focus subject in the current scene to capture the switched target focus subject Clear second image.
可选地,在一种可能的实现方式中,在当前场景中通过第二对焦方法对切换后的目标对焦主体进行对焦,包括:将标记有切换后的目标对焦主体的第一图像输入神经网络模型,得到神经网络模型的第二输出结果,第二输出结果为第一图像中切换后的目标对焦主体的清晰度;根据第一图像中切换后的目标对焦主体的清晰度调整镜头位置,得到第二图像。Optionally, in a possible implementation manner, focusing the switched target focus subject in the current scene by the second focusing method includes: inputting a first image marked with the switched target focus subject into a neural network Model, the second output result of the neural network model is obtained. The second output result is the sharpness of the target focus subject after switching in the first image; adjust the lens position according to the sharpness of the target focus subject after switching in the first image to obtain The second image.
可选地,在一种可能的实现方式中,该方法还包括:在通过第二对焦方法对切换后的目标对焦主体进行对焦时,可以根据切换后的目标对焦主体在拍摄界面上显示对焦框,对焦框用于标记切换后的目标对焦主体,以提示用户当前的目标对焦主体。Optionally, in a possible implementation manner, the method further includes: when the switched target focus subject is focused by the second focusing method, displaying a focus frame on the shooting interface according to the switched target focus subject , The focus frame is used to mark the target focus subject after switching to remind the user of the current target focus subject.
可选地,在一种可能的实现方式中,该方法还包括:在拍摄界面上显示提示信息1,该提示信息1用于提示用户切换对焦方法或开启通过第二对焦方法进行对焦的模式。也就是说,在通过第二对焦方法对目标对焦主体进行对焦的过程中,可以在拍摄界面上显示提示信息1,以提示用户当前正在切换对焦方法或者当前正在开启通过第二对焦方法进行对焦的模式。Optionally, in a possible implementation manner, the method further includes: displaying prompt information 1 on the shooting interface, the prompt information 1 being used to prompt the user to switch the focus method or start the mode of focusing by the second focus method. That is to say, during the process of focusing on the target focus subject by the second focusing method, the prompt message 1 can be displayed on the shooting interface to remind the user that the focus method is currently being switched or the focus method is currently being turned on. mode.
可选地,在一种可能的实现方式中,在通过第二对焦方法对当前场景中的目标对焦主体进行对焦,得到第二图像之后,该方法还可以包括:在第二图像中的目标对焦主体的清晰度小于预设阈值时,在拍摄界面上显示提示信息2,该提示信息2用于提示用户调整拍摄距离。Optionally, in a possible implementation manner, after focusing on the target focused subject in the current scene by the second focusing method to obtain the second image, the method may further include: focusing on the target in the second image When the sharpness of the subject is less than the preset threshold, a prompt message 2 is displayed on the shooting interface, and the prompt message 2 is used to prompt the user to adjust the shooting distance.
可选地,在一种可能的实现方式中,在通过第二对焦方法对当前场景中的目标对焦主体进行对焦,得到第二图像之后,该方法还可以包括:在第二图像中的目标对焦主体的清晰度小于预设阈值时,在拍摄界面上显示提示信息3,该提示信息3用于提示用户切换摄像头或者切换拍摄模式。Optionally, in a possible implementation manner, after focusing on the target focused subject in the current scene by the second focusing method to obtain the second image, the method may further include: focusing on the target in the second image When the sharpness of the subject is less than the preset threshold, a prompt message 3 is displayed on the shooting interface, and the prompt message 3 is used to prompt the user to switch the camera or switch the shooting mode.
本申请实施例第二方面提供了一种图像拍摄装置,包括:处理单元,用于确定当前场景中的目标对焦主体;处理单元,还用于通过第一对焦方法对当前场景中的目标对焦主体进行对焦,得到第一图像;处理单元,还用于在第一图像中目标对焦主体的清晰度小于预设阈值时,通过第二对焦方法对当前场景中的目标对焦主体进行对焦,得到第二图像,第二图像中的目标对焦主体的清晰度不小于预设阈值;其中,第一对焦方法和第二对焦方法对应的镜头位置不同,第二对焦方法为基于神经网络模型的对焦方法。A second aspect of the embodiments of the present application provides an image capturing device, including: a processing unit, configured to determine a target focus subject in the current scene; and the processing unit, further configured to focus on the target subject in the current scene through a first focus method Performing focusing to obtain a first image; the processing unit is further configured to, when the sharpness of the target focused subject in the first image is less than a preset threshold, focus on the target focused subject in the current scene by the second focusing method to obtain the second Image, the sharpness of the target focus subject in the second image is not less than the preset threshold; wherein the lens positions corresponding to the first focusing method and the second focusing method are different, and the second focusing method is a focusing method based on a neural network model.
可选地,在一种可能的实现方式中,图像拍摄装置还包括输出单元,用于在第一图像中目标对焦主体的清晰度小于预设阈值时,输出第二图像为目标图像。Optionally, in a possible implementation manner, the image capturing device further includes an output unit configured to output the second image as the target image when the sharpness of the target focused subject in the first image is less than a preset threshold.
可选地,在一种可能的实现方式中,图像拍摄装置还包括输出单元,用于在第一图像中目标对焦主体的清晰度不小于预设阈值时,输出第一图像为目标图像。Optionally, in a possible implementation manner, the image capturing device further includes an output unit configured to output the first image as the target image when the sharpness of the target focus subject in the first image is not less than a preset threshold.
可选地,在一种可能的实现方式中,处理单元,还用于将标记有所述目标对焦主体的 第一图像输入所述神经网络模型,得到所述神经网络模型的第一输出结果,所述第一输出结果为所述第一图像中所述目标对焦主体的清晰度;根据所述第一图像中所述目标对焦主体的清晰度调整镜头位置,得到第二图像。Optionally, in a possible implementation manner, the processing unit is further configured to input the first image marked with the target focus subject into the neural network model to obtain the first output result of the neural network model, The first output result is the sharpness of the target focused subject in the first image; the lens position is adjusted according to the sharpness of the target focused subject in the first image to obtain a second image.
可选地,在一种可能的实现方式中,处理单元,还用于根据所述第一图像中所述目标对焦主体的清晰度以及全量程确定所述镜头的移动值,其中,所述全量程为所述镜头可移动的最大范围值,所述移动值为所述全量程与第一乘积之间的差值,所述第一乘积为所述清晰度与所述全量程的乘积;根据所述移动值将所述镜头移动至目标位置。Optionally, in a possible implementation manner, the processing unit is further configured to determine the movement value of the lens according to the sharpness and the full range of the target focus subject in the first image, wherein the full range The range is the maximum range value that the lens can move, the movement value is the difference between the full range and a first product, and the first product is the product of the sharpness and the full range; according to The movement value moves the lens to the target position.
可选地,在一种可能的实现方式中,处理单元,还用于在第一图像为多景深图像,且目标对焦主体位于多景深图像中的背景区域时,将目标对焦主体切换为多景深图像中的前景区域内的主体,得到切换后的目标对焦主体;处理单元,还用于在第一图像中切换后的目标对焦主体的清晰度小于预设阈值时,在当前场景中通过第二对焦方法对切换后的目标对焦主体进行对焦,得到第二图像。Optionally, in a possible implementation manner, the processing unit is further configured to switch the target focus subject to multiple depth of field when the first image is a multiple depth of field image and the target focus subject is located in the background area in the multiple depth of field image The subject in the foreground area of the image obtains the switched target focus subject; the processing unit is further configured to pass the second focus subject in the current scene when the sharpness of the switched target focus subject in the first image is less than the preset threshold The focus method focuses on the switched target focus subject to obtain a second image.
可选地,在一种可能的实现方式中,图像拍摄装置还包括显示单元,用于根据切换后的目标对焦主体在拍摄界面上显示对焦框,对焦框用于标记切换后的目标对焦主体。Optionally, in a possible implementation manner, the image capturing device further includes a display unit for displaying a focus frame on the shooting interface according to the switched target focus subject, and the focus frame is used to mark the switched target focus subject.
可选地,在一种可能的实现方式中,图像拍摄装置还包括显示单元,用于在拍摄界面上显示提示信息,提示信息用于提示用户切换对焦方法或开启通过第二对焦方法进行对焦的模式。Optionally, in a possible implementation, the image capturing device further includes a display unit for displaying prompt information on the shooting interface, and the prompt information is used to prompt the user to switch the focus method or enable the second focus method to focus. mode.
可选地,在一种可能的实现方式中,神经网络模型是通过标记有对焦主体以及所述对焦主体的清晰度的图像训练数据训练得到的。Optionally, in a possible implementation manner, the neural network model is obtained through training of image training data marked with the focused subject and the sharpness of the focused subject.
可选地,在一种可能的实现方式中,第一对焦方法包括相位对焦方法或激光对焦方法。Optionally, in a possible implementation manner, the first focusing method includes a phase focusing method or a laser focusing method.
本申请实施例第三方面提供了一种电子设备,包括:触摸屏,其中,触摸屏包括触敏表面和显示器;摄像头;处理器;存储器;多个应用程序;以及计算机程序。其中,计算机程序被存储在存储器中,计算机程序包括指令。当指令被电子设备执行时,使得电子设备执行上述第一方面任一项可能的实现中的图像拍摄方法。The third aspect of the embodiments of the present application provides an electronic device, including: a touch screen, where the touch screen includes a touch-sensitive surface and a display; a camera; a processor; a memory; a plurality of application programs; and a computer program. Among them, the computer program is stored in the memory, and the computer program includes instructions. When the instruction is executed by the electronic device, the electronic device is caused to execute the image capturing method in any one of the possible implementations of the first aspect.
本申请实施例第四方面提供了一种电子装置,包括处理器和存储器。该存储器与处理器耦合,存储器用于存储计算机指令,当处理器执行该计算机指令时,使得终端设备执行上述第一方面任一项可能的实现方式中的图像拍摄方法。A fourth aspect of the embodiments of the present application provides an electronic device, including a processor and a memory. The memory is coupled with the processor, and the memory is used to store computer instructions. When the processor executes the computer instructions, the terminal device is caused to execute the image shooting method in any one of the possible implementations of the first aspect.
本申请实施例第五方面提供了一种电子装置,包括存储器和多个处理器。该存储器与多个处理器耦合,存储器用于存储计算机指令,当多个处理器执行该计算机指令时,使得终端设备执行上述第一方面任一项可能的实现方式中的图像拍摄方法。示例性地,多个处理器可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU),其中,AP、调制解调处理器、GPU、ISP、控制器、视频编解码器、DSP和基带处理器等可以用于通过第一对焦方法来进行对焦,NPU可以用于通过第二对焦方法来进行对焦。A fifth aspect of the embodiments of the present application provides an electronic device, including a memory and multiple processors. The memory is coupled with multiple processors, and the memory is used to store computer instructions. When the multiple processors execute the computer instructions, the terminal device is caused to execute the image capturing method in any one of the possible implementations of the first aspect. Exemplarily, the multiple processors may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), and a control Processor, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU), among which, AP, modem processor, GPU, ISP, controller, video codec, DSP, baseband processor, etc. can be used for focusing by the first focusing method, and NPU can be used for focusing by the second focusing method.
本申请实施例第六方面提供了一种无线通信装置,该无线通信装置包括:处理器以及 接口电路;其中,该处理器通过该接口电路与存储器耦合,该处理器用于执行该存储器中的程序代码,以实现如第一方面中任一可能的实现方式中的图像拍摄方法。A sixth aspect of the embodiments of the present application provides a wireless communication device, the wireless communication device includes: a processor and an interface circuit; wherein the processor is coupled to a memory through the interface circuit, and the processor is used to execute a program in the memory Code to implement the image capturing method in any possible implementation manner in the first aspect.
本申请实施例第七方面提供了一种计算机存储介质,包括计算机指令,当计算机指令在电子设备上运行时,使得电子设备执行上述第一方面任一项可能的实现方式中的图像拍摄方法。A seventh aspect of the embodiments of the present application provides a computer storage medium, including computer instructions, which when the computer instructions run on an electronic device, cause the electronic device to execute the image capturing method in any one of the possible implementations of the first aspect.
本申请实施例第八方面提供了一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得电子设备执行上述第一方面任一项可能的实现方式中的图像拍摄方法。The eighth aspect of the embodiments of the present application provides a computer program product, which when the computer program product runs on a terminal device, causes the electronic device to execute the image capturing method in any one of the possible implementations of the first aspect.
从以上技术方案可以看出,本申请实施例具有以下优点:It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
本申请实施例提供了一种图像拍摄方法及相关装置,在使用常规的对焦方法对目标对焦主体进行对焦并且得到相应的图像之后,在常规的对焦方法在当前场景下难以实现准焦而导致该图像中目标对焦主体的清晰度小于一定阈值的情况下,采用对场景的适应性更强的基于神经网络模型的对焦方法进行对焦,以获得拍摄清晰的图像。The embodiments of the present application provide an image shooting method and related devices. After the conventional focusing method is used to focus the target focus subject and the corresponding image is obtained, the conventional focusing method is difficult to achieve in-focus in the current scene, which leads to this When the sharpness of the target focus subject in the image is less than a certain threshold, a neural network model-based focusing method that is more adaptable to the scene is used for focusing to obtain a clear image.
附图说明Description of the drawings
图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 this application;
图1c为本申请实施例提供的一组显示界面示意图;Figure 1c is a schematic diagram of a set of display interfaces provided by an embodiment of the application;
图2为本申请实施例提供的另一组显示界面示意图;2 is a schematic diagram of another set of display interfaces provided by an embodiment of the application;
图3为本申请实施例提供的另一组显示界面示意图;FIG. 3 is a schematic diagram of another set of display interfaces provided by an embodiment of the application;
图4为本申请实施例提供的另一组显示界面示意图;FIG. 4 is a schematic diagram of another set of display interfaces provided by an embodiment of the application;
图5a为本申请实施例提供的一种感受野的示意图;Figure 5a is a schematic diagram of a receptive field provided by an embodiment of the application;
图5b为本申请实施例提供的一种神经网络模型的结构示意图;FIG. 5b is a schematic structural diagram of a neural network model provided by an embodiment of this application;
图5c为本申请实施例提供的另一组显示界面示意图;FIG. 5c is a schematic diagram of another set of display interfaces provided by an embodiment of the application;
图6为本申请实施例提供的另一组显示界面示意图;FIG. 6 is a schematic diagram of another set of display interfaces provided by an embodiment of the application;
图7为本申请实施例提供的另一组显示界面示意图;FIG. 7 is a schematic diagram of another set of display interfaces provided by an embodiment of the application;
图8为本申请实施例提供的一种镜头移动示意图;FIG. 8 is a schematic diagram of lens movement provided by an embodiment of the application;
图9A为本申请实施例提供的一组显示界面示意图;FIG. 9A is a schematic diagram of a set of display interfaces provided by an embodiment of the application;
图9B为本申请实施例提供的另一组显示界面示意图;FIG. 9B is a schematic diagram of another set of display interfaces provided by an embodiment of the application;
图10为本申请实施例提供的另一组显示界面示意图;FIG. 10 is a schematic diagram of another set of display interfaces provided by an embodiment of the application;
图11为本申请实施例提供的另一种显示界面示意图;FIG. 11 is a schematic diagram of another display interface provided by an embodiment of the application;
图12为本申请实施例提供的另一种显示界面示意图;FIG. 12 is a schematic diagram of another display interface provided by an embodiment of the application;
图13为本申请实施例提供的一种图像拍摄方法的流程示意图;FIG. 13 is a schematic flowchart of an image shooting method provided by an embodiment of the application;
图14为本申请实施例提供的一种电子设备的结构示意图;FIG. 14 is a schematic structural diagram of an electronic device provided by an embodiment of this application;
图15为本申请实施例提供的一种电子装置的结构示意图;FIG. 15 is a schematic structural diagram of an electronic device provided by an embodiment of the application;
图16为本申请实施例提供的一种无线通信装置的结构示意图。FIG. 16 is a schematic structural diagram of a wireless communication device provided by an embodiment of this application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“多个”是指两个或多于两个。The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, unless otherwise specified, "/" means or, for example, A/B can mean A or B; "and/or" in this document is only a description of related objects The association relationship of indicates that there can be three kinds of relationships, for example, A and/or B, which can indicate: A alone exists, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "plurality" refers to two or more than two.
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。Hereinafter, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of these features. In the description of the present embodiment, unless otherwise specified, "plurality" means two or more.
目前,传统的对焦方法大多采用多器件辅助的方法,通过终端上的多器件获取辅助信息,再基于获取到的辅助信息来进行对焦,如相位对焦方法、激光对焦方法、反差式对焦方法或双目对焦方法等辅助对焦方法。但是,这些对焦方法所得到的辅助信息往往存在局限性而给出错误的数据,最终导致无法对焦清晰。At present, most of the traditional focusing methods adopt multi-device assisted methods. The auxiliary information is obtained through multiple devices on the terminal, and then focusing is performed based on the obtained auxiliary information, such as phase focusing method, laser focusing method, contrast focusing method or dual Auxiliary focusing methods such as eye focusing method. However, the auxiliary information obtained by these focusing methods often has limitations and gives wrong data, which ultimately results in the inability to focus sharply.
例如,相位对焦方法是通过硬件的方式,新增加了分离镜头和线性传感器对进行图像处理,通过分离镜头分离出两个图像之后,通过线性传感器检测两个图像的距离,从而推动镜头到准焦位置,保证图像的清晰。然而,在一些特定的场景下,例如光线较暗的场景、包含较多平坦区域的场景(比如湖面、天空等场景)、弱纹理场景(比如雪山等场景)或者是包括有小目标物体的场景,相位对焦方法往往较难预测对焦位置,从而难以实现较好的对焦结果。For example, the phase focusing method is through hardware, a new separation lens and a linear sensor pair are added for image processing. After the two images are separated by the separation lens, the linear sensor detects the distance between the two images, thereby pushing the lens to align focus. Position to ensure the clarity of the image. However, in some specific scenes, such as dark scenes, scenes containing more flat areas (such as lakes, sky, etc.), weak texture scenes (such as snow mountains, etc.), or scenes that include small target objects , The phase focusing method is often difficult to predict the focus position, which makes it difficult to achieve better focusing results.
又例如,激光对焦方法是通过硬件(如激光发射装置和测距仪)的方式预测目标物体和镜头的距离,将距离转换为对应的镜头位置,从而推动镜头到达预测准焦位置。比如,在拍摄时,激光发射装置发射红外激光,红外激光照射到目标物体的表面上,并且经过目标物体的反射之后,红外激光被测距仪接收到。这样一来,便可以通过计算红外激光的发射时间与接收时间之间的时间差,来计算目标物体到镜头的距离,从而基于该距离实现对焦。然而,由于激光对焦方法通过红外激光感知对焦距离,很容易受到环境光干扰,例如太阳直射场景或者是强灯光直射场景,测距仪可能会接收到其他的反射光线,从而导致难以准确地计算目标物体与镜头之间的距离,导致对焦效果差。For another example, the laser focusing method predicts the distance between the target object and the lens by means of hardware (such as a laser emitting device and a rangefinder), and converts the distance into a corresponding lens position, thereby pushing the lens to the predicted in-focus position. For example, during shooting, the laser emitting device emits infrared laser light, and the infrared laser light is irradiated on the surface of the target object, and after being reflected by the target object, the infrared laser light is received by the rangefinder. In this way, the distance between the target object and the lens can be calculated by calculating the time difference between the transmission time and the reception time of the infrared laser, so that focusing can be achieved based on this distance. However, because the laser focusing method uses infrared lasers to perceive the focusing distance, it is easily disturbed by ambient light, such as a scene where the sun is direct or a strong light is direct, and the rangefinder may receive other reflected light, which makes it difficult to accurately calculate the target The distance between the object and the lens causes poor focusing.
再例如,反差式对焦方法是检测拍摄得到的图像对应的对比度,在检测到最大对比度之前不断地调整镜头位置,最终找到能使得图像对比度最大的镜头位置,即为准焦位置。然而,反差式对焦方法在平坦区域场景、小目标物体场景、以及夜景等场景下难以找到最大对比度位置,并且容易受到手抖、环境变化(如闪烁灯)等外部因素影响,从而导致图像失焦。有鉴于此,本申请实施例提供了一种图像拍摄方法,可以应用于电子设备,在使用常规的对焦方法对目标对焦主体进行对焦并且得到相应的图像之后,在常规的对焦方法在当前场景下难以实现准焦而导致该图像中目标对焦主体的清晰度小于一定阈值的情况下,采用对场景的适应性更强的基于神经网络模型的对焦方法进行对焦,由经过大量场景下的图像训练得到的神经网络模型提供图像中目标对焦主体的清晰度作为辅助信息,来确定镜头位置,以获得拍摄清晰的图像。For another example, the contrast focusing method is to detect the contrast of the captured image, adjust the lens position continuously before detecting the maximum contrast, and finally find the lens position that can maximize the image contrast, that is, the quasi-focus position. However, the contrast focusing method is difficult to find the maximum contrast position in flat area scenes, small target object scenes, and night scenes. It is also susceptible to external factors such as hand shake and environmental changes (such as flashing lights), resulting in image loss of focus. . In view of this, the embodiment of the present application provides an image shooting method, which can be applied to electronic devices. After the conventional focusing method is used to focus the target focus subject and the corresponding image is obtained, the conventional focusing method is used in the current scene. When it is difficult to achieve the focus and the sharpness of the target focus subject in the image is less than a certain threshold, the focus method based on the neural network model that is more adaptable to the scene is used to focus, which is obtained by image training in a large number of scenes The neural network model provides the sharpness of the target focus subject in the image as auxiliary information to determine the lens position to obtain a clear image.
本申请实施例提供的图像拍摄方法可以应用于电子设备上,该电子设备可以包括终端设备或电子装置,该电子装置包括有处理器和存储器,可部署于终端设备上。其中,终端设备可以包括手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等设备。本申请实施例对终端设备以及电子装置的具体类型不作任何限制。The image shooting method provided in the embodiments of the present application can be applied to electronic equipment, and the electronic equipment can include a terminal device or an electronic device. The electronic device includes a processor and a memory and can be deployed on the terminal device. Among them, terminal devices may include mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR)/virtual reality (VR) devices, laptops, ultra-mobile personal computers (ultra-mobile personal computers). , UMPC), netbooks, personal digital assistants (personal digital assistant, PDA) and other equipment. The embodiments of the present application do not impose any restrictions on the specific types of terminal equipment and electronic devices.
示例性的,图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,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。Exemplarily, 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, camera 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 light 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, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Among them, the different processing units may be independent devices or integrated in one or more processors.
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the electronic device 100. 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 may 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 transceiver (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,充电器,闪光灯,摄像头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, camera 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,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。The MIPI interface can be used to connect the processor 110 with the display screen 194, the camera 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 camera 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与摄像头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 camera 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,摄像头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 external memory, the display screen 194, the camera 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.
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。The ISP is used to process the data fed back from the camera 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用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and is projected to the photosensitive element. The photosensitive element 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. In some embodiments, the electronic device 100 may include one or N cameras 193, and N is a positive integer greater than one.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备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 a 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可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。The internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121. 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.
电子设备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 calculates the altitude based on the air pressure value measured by the air pressure sensor 180C 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, etc.
距离传感器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.
在本申请实施例中,在拍摄场景下,摄像头193采集彩色图像,ISP对摄像头193反馈的数据进行处理,处理器110中的NPU可以对ISP处理后的图像进行图像分割,确定图像上不同物体或不同物体类型分别所在的区域。处理器110可以保留特定的一个或多个物体所在区域的色彩,并将特定的一个或多个物体所在的区域以外的其他区域进行灰度化处理,从而可以将特定的物体所在的整个区域的色彩保留下来。In the embodiment of the present application, in the shooting scene, the camera 193 collects color images, the ISP processes the data fed back by the camera 193, and the NPU in the processor 110 can perform image segmentation on the ISP processed image to determine different objects on the image Or the area where different object types are located. The processor 110 can retain the color of the area where the specific one or more objects are located, and perform gray-scale processing on other areas other than the area where the specific one or more objects are located, so that the entire area where the specific object is located can be grayed out. The color is preserved.
其中,灰度化处理是指像素点的像素值转换为灰度值,将彩色图像变为灰度图像(也称黑白图像)。其中,像素值用于表示像素点的颜色,例如像素值可以为R(红)G(绿)B(蓝)值,灰度化可以将像素点的RGB值处理为R值=G值=B值。Among them, gray-scale processing refers to the conversion of pixel values of pixels into gray-scale values, and color images into gray-scale images (also called black-and-white images). Among them, the pixel value is used to represent the color of the pixel. For example, the pixel value can be R (red) G (green) B (blue) value, and grayscale can process the RGB value of the pixel as R value = G value = B value.
电子设备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的软件结构框图。分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。应用程序层可以包括一系列应用程序包。FIG. 1b is a block diagram of the software structure of the 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. 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 can include a window manager, a content provider, a view system, a phone manager, a resource manager, and a notification manager.
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。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.
为了便于叙述,以下将以电子设备为手机为例,对本申请实施例提供的图像拍摄方法进行详细的描述。For ease of description, the following will take the electronic device as a mobile phone as an example to describe in detail the image capturing method provided in the embodiment of the present application.
图1c中的(a)示出了手机的一种图形用户界面(graphical user interface,GUI),该GUI为手机的桌面101。当手机检测到用户点击桌面101上的相机应用(application,APP)的图标102的操作后,可以启动相机应用,显示如图1c中的(b)所示的另一GUI,该GUI可以称为拍摄界面103。该拍摄界面103上可以包括取景框104。在预览状态下,该取景框104内可以实时显示预览图像。(A) in FIG. 1c shows a graphical user interface (GUI) of the mobile phone, and the GUI is the desktop 101 of the mobile phone. When the mobile phone detects that the user has clicked the icon 102 of the camera application (application, APP) on the desktop 101, it can start the camera application and display another GUI as shown in (b) in Figure 1c. This GUI can be called Shooting interface 103. The shooting interface 103 may include a viewing frame 104. In the preview state, the preview image can be displayed in the viewing frame 104 in real time.
示例性的,参见图1c中的(b),手机在启动相机后,取景框104内可以显示有图像1。拍摄界面上还可以包括用于指示拍照模式的控件105,用于指示录像模式的控件106,以及拍摄控件107。在拍照模式下,当手机检测到用户点击该拍摄控件307的操作后,手机执行拍照操作;在录像模式下,当手机检测到用户点击该拍摄控件107的操作后,手机执行拍摄视频的操作。Exemplarily, referring to (b) in FIG. 1c, after the mobile phone activates the camera, the image 1 may be displayed in the view frame 104. The shooting interface may also include a control 105 for indicating the shooting mode, a control 106 for indicating the video mode, and a shooting control 107. In the camera mode, when the mobile phone detects that the user clicks on the shooting control 307, the mobile phone performs the camera operation; in the video mode, when the mobile phone detects the user clicks on the shooting control 107, the mobile phone performs the video shooting operation.
在手机启动相机后,手机可以通过摄像头采集当前场景的图像,并且将采集到的图像显示在取景框内。在采集到当前场景的图像之后,手机可以确定当前场景中的目标对焦主体,其中,目标对焦主体可以是当前场景中需要获得清晰图像的主体。After the mobile phone starts the camera, the mobile phone can collect the image of the current scene through the camera and display the collected image in the viewfinder frame. After acquiring the image of the current scene, the mobile phone can determine the target focus subject in the current scene, where the target focus subject may be a subject in the current scene that needs to obtain a clear image.
手机确定目标对焦主体的方式可以有多种。There are many ways for the mobile phone to determine the target and focus the subject.
在一些实施例中,手机可以在自动对焦模式下确定目标对焦主体。一般地,在手机启动相机之后,手机可以自动进入自动对焦模式。在自动对焦模式下,手机可以自动选取当前场景的图像中的部分区域作为对焦区域,从而确定当前场景的图像中的目标对焦主体为位于该对焦区域内的主体。一般地,手机所选取的对焦区域可以是预先设置好的,例如是图像中心的一个方形区域或者一个圆形区域等等;手机所选取的对焦区域的边长或者周长 也可以是预先设置好的,例如在手机选取方形区域作为对焦区域的情况下,该方形区域的边长可以是取景框其中一个边长的五分之一。示例性地,如图2所示,手机以当前场景的图像的中心为参照点,选取了图像中心的一个方形区域作为对焦区域,确定目标对焦主体为该对焦区域内的主体。在一些可选的实施方式中,手机在自动对焦模式下所选取的对焦区域可以是隐藏的,也就是说,手机所选取的对焦区域在拍摄界面上是不显示的。In some embodiments, the mobile phone can determine the target focus subject in the auto focus mode. Generally, after the mobile phone starts the camera, the mobile phone can automatically enter the auto focus mode. In the auto focus mode, the mobile phone can automatically select a part of the area in the image of the current scene as the focus area, thereby determining that the target focus subject in the image of the current scene is the subject located in the focus area. Generally, the focus area selected by the mobile phone can be preset, such as a square area or a circular area in the center of the image, etc.; the side length or perimeter of the focus area selected by the mobile phone can also be preset Yes, for example, when the mobile phone selects a square area as the focus area, the side length of the square area may be one-fifth of the side length of the view frame. Exemplarily, as shown in FIG. 2, the mobile phone uses the center of the image of the current scene as a reference point, selects a square area in the center of the image as the focus area, and determines the target focus subject as the subject in the focus area. In some optional implementation manners, the focus area selected by the mobile phone in the auto focus mode may be hidden, that is, the focus area selected by the mobile phone is not displayed on the shooting interface.
在一些实施例中,手机可以在手动对焦模式下确定目标对焦主体。其中,在手机启动相机之后,当手机检测到用户点击取景框中的图像的任意一个位置之后,手机可以进入手动对焦模式。在手动对焦模式下,手机可以选取用户点击的位置作为对焦点,并且选取以对焦点为中心的一个方形区域或者圆形区域作为对焦区域,从而确定当前场景的图像中的目标对焦主体为位于该对焦区域内的主体。示例性地,如图3中(a)所示,用户在取景框中对当前场景的图像中的花朵进行了点击,如图3中(b)所示,手机检测到了用户的点击之后,选取以用户点击的位置为中心的一个方形区域作为对焦区域,并且确定位于该方形区域内的花朵为目标对焦主体。In some embodiments, the mobile phone can determine the target focus subject in manual focus mode. Among them, after the mobile phone starts the camera, when the mobile phone detects that the user clicks on any position of the image in the viewfinder, the mobile phone can enter the manual focus mode. In manual focus mode, the phone can select the position the user clicks as the focus point, and select a square or circular area with the focus point as the focus area, so as to determine the target focus subject in the image of the current scene as the focus point. The subject in the focus area. Illustratively, as shown in Figure 3(a), the user clicks on the flower in the image of the current scene in the viewfinder, as shown in Figure 3(b), after the mobile phone detects the user’s click, select A square area centered on the position clicked by the user is used as the focus area, and the flower located in the square area is determined as the target focus subject.
在一些实施例中,手机可以在人工智能(artificial intelligence,AI)对焦模式下确定目标对焦主体。在AI对焦模式下,手机可以对当前场景的图像中的对象进行检测,并且在检测到特定的对象时,确定该对象为目标对焦主体。例如,对静态场景下的人物、动物或者建筑物等进行检测,确定检测到的对象为目标对焦主体;又例如,对动态场景下移动中的人物或者动物进行检测,确定检测到的人物或者动物为目标对焦主体;再例如,通过识别图像中的前景和后景,检测位于图像前景中的对象,确定图像前景中的对象为目标对焦主体。示例性地,如图4中(a)所示,手机可以对当前场景的图像中的人物进行检测,并且在检测到人物时,选择人物或者人物的脸作为目标对焦主体;示例性地,如图4中(b)所示,手机可以对当前场景的图像中的动物进行检测,并且在检测到动物时,选择该动物作为目标对焦主体;示例性地,如图4中(c)所示,手机还可以对当前场景的图像中的建筑物进行检测,并且在检测到建筑物时,选择该建筑物作为目标对焦主体。In some embodiments, the mobile phone can determine the target focus subject in an artificial intelligence (AI) focus mode. In the AI focus mode, the mobile phone can detect the object in the image of the current scene, and when a specific object is detected, the object is determined to be the target focus subject. For example, detect people, animals, or buildings in static scenes, and determine the detected objects as the target focus subject; another example, detect moving people or animals in dynamic scenes, and determine the detected people or animals Focusing on the target subject; for another example, by identifying the foreground and the background in the image, detecting the object in the foreground of the image, and determining the object in the foreground of the image as the target focusing subject. Exemplarily, as shown in Figure 4(a), the mobile phone can detect the person in the image of the current scene, and when the person is detected, the person or the person’s face is selected as the target focus subject; for example, as As shown in Figure 4(b), the mobile phone can detect the animal in the image of the current scene, and when the animal is detected, the animal is selected as the target focus subject; for example, as shown in Figure 4(c) , The mobile phone can also detect the building in the image of the current scene, and when the building is detected, select the building as the target focus subject.
其中,手机可以有多种进入AI对焦模式的方式。在一实施例中,在手机检测到用户点击拍摄界面上的AI控件时,手机进入或者退出AI对焦模式,示例性地,如图4中(d)所示,在手机没进入AI对焦模式的情况下,手机检测到用户点击拍摄界面上的AI控件401时,手机进入AI对焦模式,并且改变AI控件401的显示颜色(例如将AI控件401变为彩色);在手机进入AI对焦模式之后,手机检测到用户点击拍摄界面上的AI控件401时,手机退出AI对焦模式,并且恢复AI控件401原来的显示颜色(例如将AI控件401恢复为白色)。在另一实施例中,在手机检测到用户点击拍摄界面上的拍摄选项控件时,手机可以进入模式选择界面,并且在手机检测到用户点击模式选择界面中的AI模式控件时,手机进入AI对焦模式;示例性地,如图4中(e)所示,手机检测到用户点击拍摄选项控件402时,手机可以进入模式选择界面,如图4中(f)所示,手机检测到用户点击模式选择界面中的AI模式控件403时,手机可以选择进入AI对焦模式。在另一实施例中,在手机检测到用户在拍摄界面上的预设手势操作时,可以进入或退出AI对焦模式;例如,在手机检测到用户在拍摄界面上画出圆圈或者拖动一定的轨迹时,手机可以进入或退出AI对焦模式。Among them, the mobile phone can have a variety of ways to enter the AI focus mode. In one embodiment, when the mobile phone detects that the user clicks on the AI control on the shooting interface, the mobile phone enters or exits the AI focus mode. Illustratively, as shown in Figure 4 (d), when the mobile phone does not enter the AI focus mode In this case, when the mobile phone detects that the user clicks the AI control 401 on the shooting interface, the mobile phone enters the AI focus mode and changes the display color of the AI control 401 (for example, changes the AI control 401 to color); after the mobile phone enters the AI focus mode, When the mobile phone detects that the user clicks the AI control 401 on the shooting interface, the mobile phone exits the AI focus mode and restores the original display color of the AI control 401 (for example, the AI control 401 is restored to white). In another embodiment, when the mobile phone detects that the user clicks the shooting option control on the shooting interface, the mobile phone can enter the mode selection interface, and when the mobile phone detects that the user clicks the AI mode control in the mode selection interface, the mobile phone enters AI focus Mode; Exemplarily, as shown in Figure 4 (e), when the mobile phone detects that the user clicks on the shooting option control 402, the mobile phone can enter the mode selection interface, as shown in Figure 4 (f), the mobile phone detects the user’s click mode When the AI mode control 403 in the interface is selected, the mobile phone can choose to enter the AI focus mode. In another embodiment, when the mobile phone detects the user's preset gesture operation on the shooting interface, it can enter or exit the AI focus mode; for example, when the mobile phone detects that the user draws a circle or drags a certain amount on the shooting interface When tracking, the phone can enter or exit AI focus mode.
在确定了当前场景中的目标对焦主体之后,手机可以通过第一对焦方法对当前场景中的目标对焦主体进行对焦,得到第一图像。After determining the target focus subject in the current scene, the mobile phone can focus on the target focus subject in the current scene through the first focusing method to obtain the first image.
在一些实施例中,手机可以是通过相位对焦方法对当前场景的图像进行对焦,即第一对焦方法可以是相位对焦方法。In some embodiments, the mobile phone may focus on the image of the current scene using a phase focusing method, that is, the first focusing method may be a phase focusing method.
在一些实施例中,手机可以是通过激光对焦方法对当前场景的图像进行对焦,即第一对焦方法可以是激光对焦方法。In some embodiments, the mobile phone may focus the image of the current scene through a laser focusing method, that is, the first focusing method may be a laser focusing method.
在手机通过第一对焦方法对当前场景中的目标对焦主体进行对焦,并且得到第一图像之后,手机可以确定第一图像中目标对焦主体的清晰度。After the mobile phone uses the first focusing method to focus the target focused subject in the current scene and obtains the first image, the mobile phone can determine the definition of the target focused subject in the first image.
在一些实施例中,手机可以通过预置的神经网络模型来确定第一图像中目标对焦主体的清晰度。具体地,手机可以将标记了目标对焦主体的第一图像输入至神经网络模型中,由神经网络模型输出第一图像中目标对焦主体的清晰度,例如,神经网络模型的输出值可以为30%、50%、100%等等,其中上述的30%、50%、100%即为第一图像中目标对焦主体对应的清晰度。In some embodiments, the mobile phone can determine the sharpness of the focused subject in the first image through a preset neural network model. Specifically, the mobile phone may input the first image marked with the target focus subject into the neural network model, and the neural network model outputs the clarity of the target focus subject in the first image. For example, the output value of the neural network model may be 30% , 50%, 100%, etc., where the above-mentioned 30%, 50%, 100% are the sharpness corresponding to the target focus subject in the first image.
具体地,在手机确定了目标对焦主体之后,可以通过标记框将目标对焦主体在第一图像中所在的区域进行标记,以使得神经网络模型能够获取到第一图像中需要输出清晰度的区域。在一种可能的实施方式中,标记框可以是预设形状的框,例如方形框或者圆形框等,该标记框的大小与目标对焦主体相匹配,能够将目标对焦主体包围于标记框内。在一种可能的实施方式中,标记框还可以是与目标对焦主体的形状相匹配的轮廓框,即标记框为基于目标对焦主体外围的轮廓所形成的框,能够刚好将目标对焦主体包围于标记框内。Specifically, after the mobile phone determines the target focus subject, the area where the target focus subject is located in the first image can be marked by the marking frame, so that the neural network model can obtain the area in the first image that needs to be output sharp. In a possible implementation, the mark frame may be a frame with a preset shape, such as a square frame or a round frame, etc. The size of the mark frame matches the target focus subject, and the target focus subject can be enclosed in the mark frame . In a possible implementation, the marking frame may also be a contour frame that matches the shape of the target focus subject, that is, the marking frame is a frame formed based on the outline of the target focus subject, and can just surround the target focus subject. Mark inside the box.
在一些实施例中,神经网络模型可以是通过采用大量的训练数据对机器学习模型进行训练后得到的。其中,训练数据指的是标注有对焦主体以及对焦主体的清晰度的图像数据,通过获取大量的原始图像,标记原始图像中的对焦主体,并且对这些原始图像中对焦主体的清晰度进行标注,即可获得用于训练模型的训练数据。In some embodiments, the neural network model may be obtained after training the machine learning model by using a large amount of training data. Among them, the training data refers to the image data marked with the focus subject and the sharpness of the focused subject. By acquiring a large number of original images, the focused subject in the original image is marked, and the sharpness of the focused subject in these original images is marked. The training data used to train the model can be obtained.
示例性地,训练数据可以是预先通过手机或相机等摄像设备对大量的场景进行拍摄得到的;具体地,在同一个场景下,手机可以通过来回移动镜头,拍摄获得不同镜头位置下的图像;在获得不同镜头位置下的图像之后,可以基于图像所对应的镜头位置来标注该图像的清晰度。例如,假设手机中镜头能够移动的全量程(full range)为500,镜头能够在100-600的位置之间来回移动,其中,位置100和位置600为镜头能够移动的两个端点位置),在某一场景下,在手机中的镜头移动到450的位置时实现准焦,即镜头的实际准焦位置为450,那么,在镜头位置为300时所拍摄的图像的清晰度为100%-(450-300)/500=70%,在镜头位置为550时所拍摄的图像的清晰度为100%-(550-450)/500=80%,在镜头位置为450时所拍摄的图像的清晰度为100%-(450-450)/500=100%。也就是说,在同一个场景下,图像的清晰度为100%与镜头位置差值与镜头全量程的比值之间的差值,其中,镜头位置差值是指拍摄该图像时的镜头位置与镜头准焦位置之间的差值的绝对值。这样,在同一个场景下,通过移动镜头至不同的位置,并且获取不同位置下的图像,便可以得到同一个场景下不同清晰度的一组图像;对于每一个不同的场景,都可以执行上述的步骤,从而获得多组不同场景下的图像。Exemplarily, the training data may be obtained by shooting a large number of scenes with a mobile phone or camera and other imaging devices in advance; specifically, in the same scene, the mobile phone can move the lens back and forth to capture images in different lens positions; After obtaining images at different lens positions, the sharpness of the image can be marked based on the lens position corresponding to the image. For example, suppose that the full range (full range) that the lens can move in a mobile phone is 500, and the lens can move back and forth between positions 100-600, where position 100 and position 600 are the two end positions where the lens can move). In a certain scene, when the lens in the mobile phone is moved to the position of 450 to achieve aligning focus, that is, the actual aligning position of the lens is 450, then the sharpness of the image taken when the lens position is 300 is 100%-( 450-300)/500=70%, the sharpness of the image taken when the lens position is 550 is 100%-(550-450)/500=80%, the sharpness of the image taken when the lens position is 450 The degree is 100%-(450-450)/500=100%. That is to say, in the same scene, the sharpness of the image is the difference between 100% and the ratio of the lens position difference to the full range of the lens. The lens position difference refers to the difference between the lens position and the lens position when the image is taken. The absolute value of the difference between the in-focus positions of the lens. In this way, in the same scene, by moving the lens to different positions and acquiring images in different positions, you can get a set of images with different definitions in the same scene; for each different scene, you can execute The above steps can obtain multiple sets of images in different scenes.
由于在用于训练神经网络模型的图像训练数据中,图像中的对焦主体的清晰度是与图像拍摄时的镜头位置具有对应关系的,因此,将标记有目标对焦主体的第一图像输入至训练后的神经网络模型后,所得到的目标对焦主体的清晰度也与镜头位置具有对应关系,也就是说,基于目标对焦主体的清晰度可以确定图像准焦时的镜头位置。并且,由于神经网络模型是基于大量场景下的图像训练数据所得到的,因此,基于神经网络模型确定图像中目标对焦主体的清晰度对场景的适应性更强,即神经网络模型所提供的清晰度辅助信息并不具有由硬件所带来的局限性,能够实现大部分场景下的准焦,对焦效果好。Since in the image training data used to train the neural network model, the sharpness of the focused subject in the image has a corresponding relationship with the lens position when the image was taken. Therefore, the first image marked with the target focused subject is input to the training After the neural network model, the obtained sharpness of the target focus subject also has a corresponding relationship with the lens position, that is, the lens position when the image is in focus can be determined based on the sharpness of the target focus subject. Moreover, because the neural network model is obtained based on image training data in a large number of scenes, the definition of the focus subject in the image based on the neural network model is more adaptable to the scene, that is, the clarity provided by the neural network model The degree of auxiliary information does not have the limitations brought by the hardware, and can achieve quasi-focus in most scenes, and the focusing effect is good.
示例性地,上述的机器学习模型具体可以是卷积神经网络(convolutional neural network,CNN)模型、超分辨率卷积神经网络(superresolution convolutional neural network,SRCNN)模型或者残差网络(residual network,ResNet)模型等模型。Exemplarily, the above-mentioned machine learning model may be a convolutional neural network (convolutional neural network, CNN) model, a superresolution convolutional neural network (superresolution convolutional neural network, SRCNN) model, or a residual network (residual network, ResNet). ) Models and other models.
在一个具体的实施例中,可以采用基于单幅图像的超分辨率(very deep super resolution,VDSR)方法对CNN模型进行训练,得到训练后的神经网络模型。其中,VDSR方法指的是给定一个低分辨率图像来生成一个高清图像,其具体实现过程是:通过一个网络层次较深的网络(即深网络),采用较大的感受野(receptive field),充分考虑上下文消息,使用残差学习和极高学习率来提高训练效果。In a specific embodiment, a very deep super resolution (VDSR) method based on a single image may be used to train the CNN model to obtain a trained neural network model. Among them, the VDSR method refers to a given low-resolution image to generate a high-definition image, the specific implementation process is: through a network with a deeper network level (ie deep network), using a larger receptive field (receptive field) , Fully consider the contextual message, use residual learning and extremely high learning rate to improve the training effect.
其中,感受野是CNN模型中每一层输出的特征图上的像素点在输入图像上映射的区域大小。简单来说,感受野即为特征图上的一个点对应输入图像上的区域,举例而言,两层3*3的卷积核卷积操作之后的感受野是5*5;三层3*3卷积核操作之后的感受野是7*7。如图5a所示,图像为2层3x3卷积操作,其感受野为5x5。感受野越大,表明每个特征点对应输入图上的区域越大。Among them, the receptive field is the size of the area mapped on the input image by the pixels on the feature map output by each layer in the CNN model. In simple terms, the receptive field is a point on the feature map corresponding to the area on the input image. For example, the receptive field after the convolution operation of the two-layer 3*3 convolution kernel is 5*5; the three-layer 3* The receptive field after the 3 convolution kernel operation is 7*7. As shown in Figure 5a, the image is a 2-layer 3x3 convolution operation, and its receptive field is 5x5. The larger the receptive field, the larger the area on the input map corresponding to each feature point.
具体地,采用VDSR方法对CNN模型进行训练的过程可以包括:Specifically, the process of using the VDSR method to train the CNN model may include:
1、在采用深网络的学习方法时,可以采用较大的感受野(例如大于41×41的感受野)来保证能够学习到更多的特征,并且通过领域内的数据、目标的标注、目标的空间位置等数据考虑上下文消息,从而提高CNN模型的检测准确率。1. When using the deep network learning method, a larger receptive field (for example, a receptive field larger than 41×41) can be used to ensure that more features can be learned, and through the data in the field, the labeling of the target, and the target The data such as the spatial location of the CNN considers the context message, thereby improving the detection accuracy of the CNN model.
2、为了加速训练过程中的收敛,可以使用残差学习来观测实际观察值和估计值之间的差,例如采用大于0.1的高学习率;以及采用梯度裁剪的方式来避免训练时间过长。2. In order to accelerate the convergence in the training process, residual learning can be used to observe the difference between the actual observation value and the estimated value, such as a high learning rate greater than 0.1; and a gradient clipping method to avoid excessive training time.
其中,采用梯度裁剪的方法具体可以为:根据多个参数的梯度所组成的向量进行L2norm(即L2范数,其中L2指的是欧式距离)裁剪。先设定一个clip norm(裁剪范数),然后在某一次反向传播之后,通过各个参数的变化率构成一个向量,通过计算向量各元素的平和方后开方来计算这个向量的L2norm。然后比较L2norm和clip norm的值,若L2norm<=clip_norm,则不做处理,否则计算缩放因子scale_factor=clip_norm/LNorm,然后令原来的梯度乘上这个缩放因子。这样,可以使得向量的变化率的L2norm小于预设的clipnorm。值得注意的是,若不采用梯度裁剪方式,会导致梯度过大优化算法超过最优点。Wherein, the method of adopting gradient clipping may specifically be: L2norm (that is, L2 norm, where L2 refers to Euclidean distance) clipping according to a vector composed of gradients of multiple parameters. First set a clip norm, and then after a certain backpropagation, a vector is formed by the rate of change of each parameter, and the L2norm of this vector is calculated by calculating the square and square of each element of the vector. Then compare the values of L2norm and clip norm, if L2norm<=clip_norm, then no processing is done, otherwise, the scaling factor scale_factor=clip_norm/LNorm is calculated, and then the original gradient is multiplied by this scaling factor. In this way, the L2norm of the rate of change of the vector can be made smaller than the preset clipnorm. It is worth noting that if the gradient clipping method is not adopted, the optimization algorithm with excessive gradient will exceed the optimal point.
3、将不同尺寸大小的图像混合在一起训练,保证不同尺寸大小的图像都能够具有较高的检测准确率。3. Mix images of different sizes for training to ensure that images of different sizes can have a higher detection accuracy.
具体地,可以参阅图5b,图5b具体为用于实现VDSR方法的网络结构图。首先,模糊 图像通过向量卷积运算子(Conv1)和激活函数(Relu.1),Conv12和Relu.2…Conv.D-1和Relu.D-1进行深层次的卷积和激活函数,最终得到高精图像。每一层卷积Conv为3x3的矩阵算子,激活函数可以有效的避免梯度爆炸,使用到的激活函数可以为:Relu(x)=max(0,x)。Specifically, refer to FIG. 5b, which is specifically a network structure diagram for implementing the VDSR method. First, the blurred image is subjected to in-depth convolution and activation functions through the vector convolution operator (Conv1) and activation function (Relu.1), Conv12 and Relu.2...Conv.D-1 and Relu.D-1, and finally Get high-precision images. Each layer of convolution Conv is a 3x3 matrix operator. The activation function can effectively avoid gradient explosion. The activation function used can be: Relu(x)=max(0,x).
一般地,在手机获得第一图像之后,手机可以默认为直接确定第一图像中目标对焦主体的清晰度;在下面的一些情况下,手机则可以是在切换第一图像中的目标对焦主体之后,确定第一图像中切换后的目标对焦主体的清晰度。Generally, after the mobile phone obtains the first image, the mobile phone can directly determine the sharpness of the target focus subject in the first image by default; in some cases below, the mobile phone can be after switching the target focus subject in the first image , To determine the sharpness of the switched target focus subject in the first image.
在一些实施例中,手机在获得第一图像之后,可以对第一图像进行检测,在手机检测到第一图像为多景深图像时,且目标对焦主体位于多景深图像中的背景区域时,将目标对焦主体切换为多景深图像中的前景区域内的主体,得到切换后的目标对焦主体。通常来说,在手机完成对焦之后,在距离焦点处被拍摄物体前后一定范围内的物体均能够呈现清晰的图像,而焦点处被拍摄物体所对应的前后距离范围则称为景深。多景深图像指的就是在一个图像中存在有多个景深的图像。示例性地,手机可以对第一图像中不同区域的清晰度或者对比度进行检测,如果手机检测到第一图像中存在多个清晰度或者对比度差异较大的区域时,手机可以确定第一图像为多景深图像。In some embodiments, after the mobile phone obtains the first image, the first image may be detected. When the mobile phone detects that the first image is a multi-depth image and the target focus subject is located in the background area in the multi-depth image, the The target focus subject is switched to the subject in the foreground area in the multi-depth image, and the switched target focus subject is obtained. Generally speaking, after the mobile phone completes focusing, objects within a certain range before and after the subject at the focal point can present a clear image, and the range of the front and rear distance corresponding to the subject at the focal point is called the depth of field. Multi-depth image refers to an image with multiple depths of field. Exemplarily, the mobile phone can detect the sharpness or contrast of different regions in the first image. If the mobile phone detects that there are multiple sharpness or contrast areas in the first image, the mobile phone can determine that the first image is Multi-depth images.
相较于现有的对焦方法,本实施例中通过对图像进行检测,在图像的目标对焦主体位于背景区域时,切换目标对焦主体为前景区域中的主体,并且基于切换后的目标对焦主体通过神经网络模型进行对焦,能够对目标对焦主体进行纠正,对焦得到前景区域中的主体清晰的图像,对焦效果好。Compared with the existing focusing method, in this embodiment, by detecting the image, when the target focus subject of the image is located in the background area, the switching target focus subject is the subject in the foreground area, and based on the switched target focus subject passing The neural network model can focus, which can correct the target focus subject, and focus to obtain a clear image of the subject in the foreground area, and the focus effect is good.
示例性地,如图5c所示,图5c中(a)表示手机在确定了当前场景的图像中心对应的主体为目标对焦主体之后,通过第一对焦方法进行对焦,获得第一图像,并且在拍摄界面上显示第一图像;图5c中(b)表示手机检测到第一图像为多景深图像,并且确定了第一图像中的前景区域;图5c(c)表示手机在确定第一图像中的前景区域之后,对前景区域中的主体进行识别,识别得到位于前景区域中的花朵,从而将目标对焦主体切换为位于前景区域内的花朵。Exemplarily, as shown in FIG. 5c, (a) in FIG. 5c shows that after the mobile phone determines that the subject corresponding to the image center of the current scene is the target focus subject, it focuses by the first focusing method to obtain the first image, and The first image is displayed on the shooting interface; Figure 5c (b) shows that the mobile phone detects that the first image is a multi-depth image, and the foreground area in the first image is determined; Figure 5c (c) shows that the mobile phone is in the determination of the first image After the foreground area, the subject in the foreground area is recognized, and the flowers located in the foreground area are identified, so that the target focus subject is switched to the flowers located in the foreground area.
在一种可能的实现方式中,手机可以是每次在获得第一图像之后,都自动对第一图像进行检测,也可以是在手机处于多景深拍摄模式时,对第一图像进行检测。例如,在手机的拍摄界面上可以显示有多景深模式控件,在手机检测到用户点击多景深模式控件时,手机进入多景深拍摄模式。示例性地,如图6中(a)所示,该多景深模式控件可以为控件601;如图6中(b)所示,该多景深模式控件可以为控件602;在另一实施例中,在手机的模式选择界面上可以显示有多景深模式控件,在手机检测到用户点击拍摄界面上的拍摄选项控件时,手机可以进入模式选择界面,并且在手机检测到用户点击模式选择界面中的多景深模式控件时,手机进入多景深拍摄模式;示例性地,如图6中(c)所示,该多景深模式控件可以为控件603。In a possible implementation, the mobile phone may automatically detect the first image every time it obtains the first image, or it may detect the first image when the mobile phone is in a multi-depth shooting mode. For example, a multi-depth-of-field mode control may be displayed on the shooting interface of the mobile phone. When the mobile phone detects that the user clicks on the multi-depth-of-field mode control, the mobile phone enters the multi-depth shooting mode. Exemplarily, as shown in FIG. 6(a), the multi-depth mode control may be a control 601; as shown in FIG. 6(b), the multi-depth mode control may be a control 602; in another embodiment , The multi-depth mode control can be displayed on the mode selection interface of the mobile phone. When the mobile phone detects that the user clicks the shooting option control on the shooting interface, the mobile phone can enter the mode selection interface, and when the mobile phone detects that the user clicks on the mode selection interface In the multi-depth mode control, the mobile phone enters the multi-depth shooting mode; for example, as shown in FIG. 6(c), the multi-depth mode control may be a control 603.
在一种可能的实现方式中,手机也可以对当前场景的图像进行检测,在检测到当前场景的图像为多景深图像时,自动进入多景深拍摄模式,并且在拍摄界面上显示多景深拍摄模式控件,以提示用户手机已进入多景深拍摄模式中。示例性地,如图6中(d)所示,手 机在进入多景深拍摄模式之后,在拍摄界面上所显示的多景深模式控件可以为控件604,也可以为如图6中(e)所示的控件605或者如图6中(f)所示的控件606。In a possible implementation, the mobile phone can also detect the image of the current scene. When it detects that the image of the current scene is a multi-depth image, it automatically enters the multi-depth shooting mode, and displays the multi-depth shooting mode on the shooting interface Control to remind the user that the mobile phone has entered the multi-depth shooting mode. Exemplarily, as shown in Figure 6 (d), after the mobile phone enters the multi-depth shooting mode, the multi-depth mode control displayed on the shooting interface can be the control 604, or it can be as shown in Figure 6 (e). The control 605 shown in FIG. 6 or the control 606 shown in (f) in FIG. 6.
在一些实施例中,手机在获得第一图像之后,可以对第一图像进行检测,在手机检测到第一图像中包含有目标对象时,将目标对焦主体切换为第一图像中的目标对象,得到切换后的目标对焦主体。示例性地,目标对象可以是人物;目标对象也可以是动物,例如猫、狗或者兔子等;目标对象还可以是景物,例如花朵、小草或树木等;目标对象还可以是一些特定的物体,例如汽车、水杯或鼠标等;目标对象还可以是建筑物,例如高楼、铁塔或庙宇等。示例性地,如图7所示,图7中(a)表示手机通过第一对焦方法进行对焦,获得第一图像,并且在拍摄界面上显示第一图像;图7中(b)表示手机检测到第一图像包含有目标对象--寺庙,并且确定了第一图像中寺庙所在的目标区域;图7中(c)表示手机在确定第一图像中寺庙所在的目标区域之后,对目标区域进行提取,以标记第一图像中的目标对象。In some embodiments, after the mobile phone obtains the first image, the first image may be detected, and when the mobile phone detects that the first image contains the target object, the target focus subject is switched to the target object in the first image, Get the target focus subject after switching. Exemplarily, the target object may be a person; the target object may also be an animal, such as a cat, a dog, or a rabbit; the target object may also be a scene, such as flowers, grass, or trees; the target object may also be some specific objects , Such as a car, a water cup, or a mouse; the target object can also be a building, such as a tall building, iron tower, or temple. Exemplarily, as shown in Figure 7, (a) in Figure 7 shows that the mobile phone uses the first focusing method to focus to obtain a first image, and the first image is displayed on the shooting interface; Figure 7 (b) shows the detection of the mobile phone The first image contains the target object--the temple, and the target area where the temple is located in the first image is determined; Figure 7(c) shows that the mobile phone performs the operation on the target area after determining the target area where the temple is located in the first image. Extract to mark the target object in the first image.
在手机确定了第一图像中目标对焦主体的清晰度之后,手机可以确定当前场景中的目标对焦主体的清晰度是否小于预设阈值。After the mobile phone determines the sharpness of the target focused subject in the first image, the mobile phone can determine whether the sharpness of the target focused subject in the current scene is less than a preset threshold.
在一些实施例中,在手机得到切换后的目标对焦主体的情况下,手机可以在当前场景下确定切换后的目标对焦主体的清晰度是否小于预设阈值。In some embodiments, when the mobile phone obtains the switched target focus subject, the mobile phone can determine in the current scene whether the sharpness of the switched target focus subject is less than a preset threshold.
在手机确定了第一图像中目标对焦主体的清晰度小于预设阈值,或者手机确定了第一图像中切换后的目标对焦主体的清晰度小于预设阈值时,手机可以通过第二对焦方法对当前场景中的目标对焦主体或者切换后的目标对焦主体进行对焦,获得对焦效果更佳的第二图像。When the mobile phone determines that the sharpness of the target focus subject in the first image is less than the preset threshold, or the mobile phone determines that the sharpness of the target focus subject after switching in the first image is less than the preset threshold, the mobile phone can use the second focusing method to Focus on the target focus subject in the current scene or the switched target focus subject to obtain a second image with a better focus effect.
需要说明的是,在本实施例中,目标对焦主体的清晰度可以是基于预先训练好的神经网络模型所得到的一个程度值、分值或百分比,用于表示目标对焦主体的清晰程度;其中,分值或者程度值越高,可以表示图像中目标对焦主体越清晰。例如,一种表达清晰度的取值范围可以是0%至100%,或者0到100,或者0到10等。具体地,清晰度的取值与获得图像的镜头位置也具有关联关系,通常镜头在目标对焦主体对应的准焦位置处所拍摄到的图像中,目标对焦主体对应的清晰度可以理解为最高;实际拍摄场景中,对于同一目标对焦主体而言,拍摄图像时,镜头位置距离目标对焦主体对应的准焦位置越接近,目标对焦主体的清晰度的取值越大;图像中目标对焦主体的各细部影纹及边界的清晰程度越高,即人眼所看到的图像中的目标对焦主体越清晰。It should be noted that in this embodiment, the sharpness of the target focused subject may be a degree value, score or percentage obtained based on a pre-trained neural network model, which is used to indicate the sharpness of the target focused subject; where , The higher the score or degree value, it can indicate that the target focus subject in the image is clearer. For example, a value range for expressing clarity can be 0% to 100%, or 0 to 100, or 0 to 10, etc. Specifically, the value of sharpness also has an association relationship with the position of the lens from which the image is obtained. Generally, in the image captured by the lens at the in-focus position corresponding to the target focus subject, the sharpness corresponding to the target focus subject can be regarded as the highest; In the shooting scene, for the same target focus subject, when shooting an image, the closer the lens position is to the in-focus position corresponding to the target focus subject, the greater the sharpness of the target focus subject; the details of the target focus subject in the image The higher the sharpness of the shading and borders, the clearer the target focus subject in the image seen by the human eye.
可选的,清晰度可以用亮度来衡量或表示,对于同一个拍摄主体而言,图像的清晰度越大,图像的亮度越大;可选的,清晰度还可以用色度来衡量或表示,对于同一个拍摄主体而言,图像的清晰度越大,图像的色度也越大。图像的亮度/色度可以具体到拍摄主体在图像中的整个区域的整体亮度/色度水平,或者具体到这个区域中各个像素的亮度/色度的整体均值。可选的,清晰度还可以用对比度来衡量或表示,对于同一个拍摄主体而言,图像的清晰度越大,图像的对比度也越大。在对焦过程中,目标对焦主体的对比度最大时,清晰度对应的取值为100%,在目标对焦主体的对比度最小时,清晰度对应的取值为0。其中,对比度指的是图像的明暗区域中最亮的白点和最暗的黑点之间不同亮度层级之间的对 比,简单来说,就是目标对焦主体所在的区域中亮度最高的像素点与亮度最低的像素点之间的亮度比值。一般来说,对比度越大,图像越清晰醒目,色彩也越鲜明艳丽;而对比度越小,图像越模糊,色彩也越灰蒙。图像的对比度可以具体到拍摄主体在图像中的整个区域的整体对比度水平,或者具体到这个区域中各个像素的对比度的整体均值。对于本领域技术人员而言,清晰度的衡量标准还有很多种公知的实施方式,本发明不予以穷举和赘述。Optionally, the sharpness can be measured or expressed by brightness. For the same subject, the greater the sharpness of the image, the greater the brightness of the image; optionally, the sharpness can also be measured or expressed by chromaticity , For the same subject, the greater the sharpness of the image, the greater the chromaticity of the image. The brightness/chromaticity of the image may be specific to the overall brightness/chromaticity level of the entire area of the subject in the image, or specific to the overall average value of the brightness/chromaticity of each pixel in this area. Optionally, the sharpness can also be measured or expressed by contrast. For the same subject, the greater the sharpness of the image, the greater the contrast of the image. During the focusing process, when the contrast of the target focused subject is the largest, the value corresponding to the sharpness is 100%, and when the contrast of the target focused subject is the smallest, the corresponding value of the sharpness is 0. Among them, contrast refers to the contrast between different brightness levels between the brightest white point and the darkest black point in the light and dark areas of the image. In simple terms, it is the difference between the brightest pixel in the area where the target focus subject is located. The brightness ratio between the pixels with the lowest brightness. Generally speaking, the greater the contrast, the clearer and more striking the image, and the more vivid and vivid the color; while the smaller the contrast, the more blurred the image and the grayer the color. The contrast of the image may be specific to the overall contrast level of the entire area of the photographed subject in the image, or specific to the overall average value of the contrast of each pixel in this area. For those skilled in the art, there are many well-known implementations of the clarity measurement standard, and the present invention will not be exhaustive or repeated.
值得注意的是,在本实施例的一些可能的实施方式中,也可以是通过模糊程度值来判断图像中的目标对焦主体是否失焦,对于同一个拍摄主体,模糊程度值越大,越不清楚。模糊程度值越小,越清楚。类似的,模糊程度值可以是基于预先训练好的神经网络模型所得到的一个程度值、分值或百分比。在图像中的目标对焦主体的模糊程度值大于预设阈值的时候,判定目标对焦主体失焦,手机通过第二对焦方法对当前场景中的目标对焦主体或者切换后的目标对焦主体进行对焦。其中,模糊程度值的取值范围也可以是0至100%,模糊程度值的取值与获得第一图像时的镜头位置具有对应关系,获得第一图像时的镜头位置距离准焦位置越近,模糊程度值的取值越小;获得第一图像时的镜头位置距离准焦位置越远,模糊程度值的取值越大。类似的,模糊程度值也可以由对比度来表征,在对焦过程中,目标对焦主体的对比度最大时,模糊程度对应的取值为0,在目标对焦主体的对比度最小时,模糊程度对应的取值为100%。在本实施例的一些可能的实施方式中,也可以根据模糊程度值来确定图像的清晰度,例如,图像的模糊程度与清晰度之和为常数,具体地,例如,第一图像的模糊程度为20%,常数为1,则第一图像的清晰度为80%。It is worth noting that in some possible implementations of this embodiment, the blur degree value can also be used to determine whether the target focus subject in the image is out of focus. For the same subject, the larger the blur degree value, the less clear. The smaller the blur degree value, the clearer it is. Similarly, the blur degree value can be a degree value, score or percentage based on a pre-trained neural network model. When the blur degree value of the target focused subject in the image is greater than the preset threshold, it is determined that the target focused subject is out of focus, and the mobile phone uses the second focusing method to focus the target focused subject in the current scene or the switched target focused subject. Among them, the value range of the blur degree value can also be 0 to 100%, and the value of the blur degree value has a corresponding relationship with the lens position when the first image is obtained, and the lens position when the first image is obtained is closer to the in-focus position , The smaller the blur degree value is; the farther the lens position when the first image is obtained is from the quasi-focus position, the larger the blur degree value is. Similarly, the blur degree value can also be characterized by contrast. During the focusing process, when the contrast of the target focus subject is the largest, the blur degree corresponds to a value of 0, and when the target focus subject has the smallest contrast, the blur degree corresponds to the value Is 100%. In some possible implementations of this embodiment, the sharpness of the image can also be determined according to the blur degree value. For example, the sum of the blur degree and the sharpness of the image is a constant, specifically, for example, the blur degree of the first image. If it is 20% and the constant is 1, the definition of the first image is 80%.
可选的,预设阈值可以是终端预先设定好的一个阈值,其具体的数值可以由以下示例性的方法确定得到:例如根据神经网络模型的精度或者偏差值来确定预设阈值的具体数值,或者根据经过大量的拍摄运算得到的经验值来确定预设阈值的具体数值;可选的,预设阈值也可以是终端从云端获取到的一个阈值,例如,终端系统升级时系统设置的阈值;可选的,预设阈值还可以是用户通过终端自行设置的一个阈值,例如,通过系统交互界面设置的一个阈值。Optionally, the preset threshold may be a threshold preset by the terminal, and its specific value may be determined by the following exemplary method: for example, the specific value of the preset threshold is determined according to the accuracy or deviation of the neural network model , Or determine the specific value of the preset threshold according to the experience value obtained through a large number of shooting operations; optionally, the preset threshold may also be a threshold obtained by the terminal from the cloud, for example, the threshold set by the system when the terminal system is upgraded Optionally, the preset threshold may also be a threshold set by the user through the terminal, for example, a threshold set through the system interactive interface.
通常来说,预设阈值为一个用于衡量图像中目标对焦主体是否失焦的值,在第一图像中目标对焦主体的清晰度小于预设阈值时,可以认为第一图像失焦;因此,在实际应用中,可以结合神经网络模型检测清晰度的精度以及失焦经验值,来确定预设阈值的具体取值。其中,失焦经验值指的是根据经验所确定的一个失焦值,在对焦主体的清晰度小于该失焦经验值时,认为图像失焦;也就是说,在实际应用中,在神经网络模型的精度越大时,预设阈值的取值可以越接近失焦经验值,在神经网络模型的精度较小时,则可以根据神经网络模型的偏差确定预设阈值与失焦经验值之间的差值,从而确定预设阈值的取值。示例性地,在手机采用神经网络模型来确定第一图像中目标对焦主体的清晰度的情况下,预设阈值具体可以是80%或者85%等;通常来说,预设阈值一般为100%之外的值,即预设阈值的值不是清晰度对应的最大取值。Generally speaking, the preset threshold is a value used to measure whether the target focused subject in the image is out of focus. When the sharpness of the target focused subject in the first image is less than the preset threshold, it can be considered that the first image is out of focus; therefore, In practical applications, the accuracy of the neural network model to detect sharpness and the experience value of out-of-focus can be combined to determine the specific value of the preset threshold. Among them, the out-of-focus experience value refers to an out-of-focus value determined based on experience. When the sharpness of the focused subject is less than the out-of-focus experience value, the image is considered out of focus; that is to say, in practical applications, in the neural network When the accuracy of the model is greater, the value of the preset threshold can be closer to the defocus experience value. When the accuracy of the neural network model is smaller, the difference between the preset threshold value and the defocus experience value can be determined according to the deviation of the neural network model. Difference value, thereby determining the value of the preset threshold. Exemplarily, in a case where the mobile phone uses a neural network model to determine the sharpness of the target focus subject in the first image, the preset threshold may specifically be 80% or 85%; generally speaking, the preset threshold is generally 100% The value other than the value, that is, the value of the preset threshold is not the maximum value corresponding to the sharpness.
可以理解的是,在手机确定第一图像中目标对焦主体的清晰度小于预设阈值时,可以认为手机通过第一对焦方法进行对焦后所得到的第一图像中目标对焦主体较为模糊,即第 一图像中目标对焦主体的清晰度不满足要求,此时,手机可以通过第二对焦方法对当前场景的图像再次进行对焦,以获得目标对焦主体清晰度较高的第二图像。It can be understood that when the mobile phone determines that the sharpness of the target focused subject in the first image is less than the preset threshold, it can be considered that the target focused subject in the first image obtained after the mobile phone uses the first focusing method to focus is relatively blurred, that is, the first image The sharpness of the target focus subject in an image does not meet the requirements. At this time, the mobile phone can focus the image of the current scene again through the second focusing method to obtain a second image with higher sharpness of the target focus subject.
为了便于理解,以下将对上文的基于神经网络模型的对焦方法进行详细的介绍。For ease of understanding, the focus method based on the neural network model above will be introduced in detail below.
在一些实施例中,基于神经网络模型的对焦方法具体可以是通过神经网络模型获取图像中目标对焦主体的清晰度,然后根据图像的清晰度以及当前镜头所在的位置来确定镜头待移动的位置,并且通过对焦马达驱动镜头移动到所确定的位置上,从而实现对焦。由于神经网络模型是基于大量各种场景下的图像训练得到的,对各种场景的适应性强,因此,通过神经网络模型能够准确地获取当前图像中目标对焦主体的清晰度,从而使得手机能够根据图像的清晰度来控制镜头移动的位置,从而实现对焦,获得清晰的图像。In some embodiments, the focusing method based on the neural network model may specifically obtain the sharpness of the target focus subject in the image through the neural network model, and then determine the position of the lens to be moved according to the sharpness of the image and the position of the current lens. And through the focus motor drive the lens to move to the determined position, so as to achieve focus. Since the neural network model is based on image training in a large number of various scenes, it is highly adaptable to various scenes. Therefore, the neural network model can accurately obtain the sharpness of the target focus subject in the current image, so that the mobile phone can According to the sharpness of the image, the position of the lens is controlled to achieve focus and obtain a clear image.
示例性地,如图8中(a)所示,假设镜头的全量程为500,镜头能够在位置100至位置600之间移动,在获得第一图像之后,通过上述的神经网络模型确定第一图像中目标对焦主体的清晰度为60%,且确定拍摄第一图像时镜头所在的位置为350,那么可以根据第一图像中目标对焦主体的清晰度60%以及镜头的全量程500,确定镜头待移动的位置与拍摄第一图像时镜头所在的位置之间的距离为500*(1-60%)=200,结合拍摄第一图像时镜头所在的位置350,可以计算得到,镜头待移动的位置为150或者是550。在确定了镜头待移动的位置之后,即可通过推动对焦马达来将镜头移动至所确定的位置上。Exemplarily, as shown in Figure 8(a), assuming that the full range of the lens is 500, the lens can move between position 100 and position 600. After the first image is obtained, the first image is determined by the above-mentioned neural network model. The sharpness of the target focus subject in the image is 60%, and it is determined that the position of the lens when the first image is taken is 350, then the lens can be determined according to the sharpness of the target focus subject in the first image 60% and the full range of the lens 500 The distance between the position to be moved and the position of the lens when the first image was taken is 500*(1-60%)=200, combined with the position of 350 when the lens was taken when the first image was taken, it can be calculated that the lens to be moved The position is 150 or 550. After determining the position of the lens to be moved, the lens can be moved to the determined position by pushing the focus motor.
在一种实施例中,在确定得到镜头待移动的位置有两个时,可以先随机将镜头移动到其中一个位置上,并且获取镜头在该位置下采集到的图像,然后获取采集到的图像的清晰度,如果镜头在移动后所采集到的图像的清晰度小于第一图像中目标对焦主体的清晰度,则确定镜头所移动的位置为准焦位置,对焦完成;如果镜头在移动所采集到的图像的清晰度小于第一图像中目标对焦主体的清晰度,则将镜头移动至另一个待移动位置上,并且确定镜头最后移动的位置为准焦位置,对焦完成。示例性地,如图8中(a)所示,在确定镜头待移动的位置为150或者是550时,可以先将镜头移动至位置150处,然后在镜头移动至位置150之后,获取该位置下对应的图像,如果在镜头位置为150时对应的图像的清晰度要小于镜头位置在350时的清晰度,则确定镜头在位置150为准焦位置;如果在镜头位置为150时对应的图像的清晰度要大于镜头位置在350时的清晰度,则将镜头继续移动至位置550处,并且确定镜头在位置550为准焦位置。In an embodiment, when it is determined that there are two positions where the lens is to be moved, the lens may be randomly moved to one of the positions, and the image collected by the lens at that position may be obtained, and then the collected image may be obtained If the sharpness of the image captured after the lens is moved is smaller than the sharpness of the target focus subject in the first image, the position where the lens moved is determined to be the in-focus position, and the focus is completed; if the lens is moving The resolution of the obtained image is less than the resolution of the target focus subject in the first image, then the lens is moved to another position to be moved, and the last position of the lens is determined to be the in-focus position, and the focusing is completed. Exemplarily, as shown in Figure 8(a), when it is determined that the position of the lens to be moved is 150 or 550, the lens can be moved to position 150 first, and then after the lens is moved to position 150, the position is acquired Download the corresponding image. If the sharpness of the corresponding image when the lens position is 150 is less than that when the lens position is 350, then determine the lens at position 150 as the collimated position; if the corresponding image when the lens position is 150 If the sharpness of the lens is greater than that when the lens position is 350, then the lens is moved to position 550, and the lens is determined to be the in-focus position at position 550.
在另一实施例中,在确定得到镜头待移动的位置有两个时,可以确定第一图像是否为多景深图像,如果第一图像为多景深图像,则可以将镜头移动至待移动的位置中靠近第一端点位置的一个位置,其中,第一端点位置为镜头在微距场景下能够实现图像准焦的端点位置;如果第一图像不是多景深图像,则可以将镜头移动至待移动的位置中靠近第二端点位置的一个位置,其中,第二端点位置为镜头在无穷远场景下能够实现图像准焦的端点位置。示例性地,假设镜头在位置600时拍摄微距下的物体时能够实现图像准焦,则位置600为上述的第一端点位置,那么,镜头在位置100时拍摄无穷远的物体时能够实现图像准焦,则位置100为上述的第二端点位置;这样,在第一图像为多景深图像时,位置550相对于位置150要更靠近位置600,因此可以将镜头移动至位置550;在第一图像不是多景深图像时,位置150相对于位置550要更靠近位置100,因此可以将镜头移动至位置150。可以理 解的是,在第一图像为多景深图像时,第一图像中包括有前景物体和后景物体,那么,将镜头往第一端点位置的方向移动时,会更容易使得前景物体成像清晰,实现准焦;在第一图像不是多景深图像时,第一图像中通常会包括较远处的物体,因此,将镜头往第二端点位置的方向移动时,会更容易使得远处的物体成像清晰,实现准焦。In another embodiment, when it is determined that there are two positions of the lens to be moved, it can be determined whether the first image is a multi-depth image, and if the first image is a multi-depth image, the lens can be moved to the position to be moved A position close to the first end position in the middle, where the first end position is the end position where the lens can achieve image aligning focus in a macro scene; if the first image is not a multi-depth image, you can move the lens to the One of the moved positions that is close to the second end position, where the second end position is the end position where the lens can achieve image in-focus in an infinite scene. Exemplarily, assuming that the lens can achieve image quasi-focus when shooting objects under macro at position 600, then position 600 is the above-mentioned first end position, then the lens can be achieved when shooting objects at infinity at position 100 When the image is in focus, position 100 is the second end position described above; in this way, when the first image is a multi-depth image, position 550 is closer to position 600 than position 150, so the lens can be moved to position 550; When an image is not a multi-depth image, the position 150 is closer to the position 100 than the position 550, so the lens can be moved to the position 150. It is understandable that when the first image is a multi-depth image, the first image includes foreground objects and background objects. Then, when the lens is moved to the direction of the first end point, it will be easier to image the foreground objects Clear, achieve quasi-focus; when the first image is not a multi-depth image, the first image usually includes distant objects. Therefore, when the lens is moved to the second end position, it will be easier to make distant objects The image of the object is clear and the focus is achieved.
在另一实施例中,在一些情况下,结合镜头能够移动的两个端点位置,可以确定得到镜头待移动的位置只有一个。示例性地,如图8中(b)所示,假设镜头的全量程为500,镜头能够在位置100至位置600之间移动,在获得第一图像之后,通过上述的神经网络模型确定第一图像中目标对焦主体的清晰度为60%,且确定拍摄第一图像时镜头所在的位置为250,那么可以根据第一图像中目标对焦主体的清晰度60%以及镜头的全量程500,确定镜头待移动的位置与拍摄第一图像时镜头所在的位置之间的距离为500*(1-40%)=200,结合拍摄第一图像时镜头所在的位置250,可以计算得到,镜头待移动的位置为50或者是450,很显然,位置50已经超出了镜头能够移动的范围,镜头是无法移动到位置50的,因此,可以确定镜头待移动的位置只有450,此时可以通过推动对焦马达来将镜头移动至位置450上。示例性地,如图8中(c)所示,在获得第一图像之后,通过上述的神经网络模型确定第一图像中目标对焦主体的清晰度为60%,且确定拍摄第一图像时镜头所在的位置为450,那么可以根据第一图像中目标对焦主体的清晰度60%以及镜头的全量程500,确定镜头待移动的位置与拍摄第一图像时镜头所在的位置之间的距离为500*(1-40%)=200,结合拍摄第一图像时镜头所在的位置450,可以计算得到,镜头待移动的位置为250或者是650,很显然,位置650已经超出了镜头能够移动的范围,镜头是无法移动到位置650的,因此,可以确定镜头待移动的位置只有250。In another embodiment, in some cases, it can be determined that there is only one position where the lens is to be moved by combining the positions of the two end points that the lens can move. Exemplarily, as shown in Figure 8(b), assuming that the full range of the lens is 500, the lens can move between position 100 and position 600. After the first image is obtained, the first image is determined by the above-mentioned neural network model. The sharpness of the target focus subject in the image is 60%, and it is determined that the position of the lens when the first image is taken is 250, then the lens can be determined according to the sharpness of the target focus subject in the first image 60% and the full range of the lens 500 The distance between the position to be moved and the position of the lens when the first image was taken is 500*(1-40%)=200, combined with the position 250 of the lens when the first image was taken, it can be calculated that the lens to be moved The position is 50 or 450. Obviously, the position 50 has exceeded the range that the lens can move, and the lens cannot be moved to the position 50. Therefore, it can be determined that the position of the lens to be moved is only 450. At this time, you can push the focus motor to Move the lens to position 450. Exemplarily, as shown in Figure 8(c), after the first image is obtained, the above-mentioned neural network model is used to determine that the sharpness of the target focus subject in the first image is 60%, and it is determined that the lens when the first image is taken The position is 450, then the distance between the position of the lens to be moved and the position of the lens when the first image is taken is 500 according to the 60% of the sharpness of the target focus subject in the first image and the full range of the lens 500. *(1-40%)=200, combined with the position 450 of the lens when the first image was taken, it can be calculated that the position of the lens to be moved is 250 or 650. Obviously, the position 650 has exceeded the range that the lens can move , The lens cannot be moved to position 650, therefore, it can be determined that the position of the lens to be moved is only 250.
在一种可能的实现方式中,在第一图像中目标对焦主体的清晰度小于预设阈值时,输出第二图像为目标图像。示例性地,目标图像可以为拍摄界面上预览区域所显示的预览图像,也就是说,在第一图像中目标对焦主体的清晰度小于预设阈值的情况下,输出第二图像作为拍摄界面上的预览图像。或者,目标图像还可以是响应于用户的拍照指示,存储至存储介质(例如非易失性存储器)中的图像。In a possible implementation manner, when the sharpness of the target focused subject in the first image is less than a preset threshold, the second image is output as the target image. Exemplarily, the target image may be the preview image displayed in the preview area on the shooting interface, that is, in the case where the sharpness of the target focus subject in the first image is less than the preset threshold, the second image is output as the preview image on the shooting interface. Preview image. Alternatively, the target image may also be an image stored in a storage medium (for example, a non-volatile memory) in response to a user's photographing instruction.
在一种可能的实现方式中,在第一图像中目标对焦主体的清晰度不小于预设阈值时,输出第一图像为目标图像。示例性地,目标图像可以是拍摄界面上的预览图像,也可以是响应于用户的拍照指示,存储至存储介质中的图像。In a possible implementation manner, when the sharpness of the target focus subject in the first image is not less than the preset threshold, the first image is output as the target image. Exemplarily, the target image may be a preview image on the photographing interface, or may be an image stored in a storage medium in response to a user's photographing instruction.
在一些实施例中,在手机将目标对焦主体切换为位于多景深图像中前景区域的主体之后,在手机通过第二对焦方法对切换后的目标对焦主体进行对焦的过程中,为了便于用户获知切换后的目标对焦主体,手机可以在拍摄界面上显示对焦框,该对焦框用于标记当前场景中切换后的目标对焦主体。示例性地,如图9A中(a)所示,在手机通过第二对焦方法进行对焦的过程中,手机可以在拍摄界面上显示用于标记当前场景中切换后的目标对焦主体的对焦框901;示例性地,如图9A中(b)所示,用于标记切换后的目标对焦主体的对焦框还可以是对焦框902;示例性地,如图9A中(c)所示,用于标记切换后的目标对焦主体的对焦框还可以是对焦框903;示例性地,如图9A中(d)所示,用于标记切换后的目标对焦主体的对焦框还可以是对焦框904。In some embodiments, after the mobile phone switches the target focus subject to the subject located in the foreground area of the multi-depth image, in the process that the mobile phone uses the second focusing method to focus the switched target focus subject, in order to facilitate the user to know the switch After the target focus subject, the mobile phone can display a focus frame on the shooting interface, and the focus frame is used to mark the target focus subject after switching in the current scene. Exemplarily, as shown in FIG. 9A (a), during the process of the mobile phone focusing by the second focusing method, the mobile phone may display a focus frame 901 for marking the target focus subject after switching in the current scene on the shooting interface. Exemplarily, as shown in Figure 9A (b), the focus frame used to mark the switched target focus subject can also be the focus frame 902; exemplarily, as shown in Figure 9A (c), for The focus frame for marking the target focus subject after the switch may also be the focus frame 903; for example, as shown in FIG. 9A (d), the focus frame for marking the target focus subject after the switch may also be the focus frame 904.
在一些实施例中,在手机将目标对焦主体切换为当前场景中的目标对象之后,在手机通过第二对焦方法对切换后的目标对焦主体进行对焦的过程中,手机可以在拍摄界面上显示对焦框,该对焦框用于标记切换后的目标对焦主体(即当前场景中的目标对象)。示例性地,如图9B中(a)所示,在手机通过第二对焦方法对切换后的目标对焦主体进行对焦的过程中,手机可以在拍摄界面上显示用于标记切换后的目标对焦主体的对焦框905。示例性地,如图9B中(b)所示,用于标记切换后的目标对焦主体的对焦框还可以是对焦框906;示例性地,如图9B中(c)所示,用于标记切换后的目标对焦主体的对焦框还可以是对焦框907;示例性地,如图9B中(d)所示,用于标记切换后的目标对焦主体的对焦框还可以是对焦框908。In some embodiments, after the mobile phone switches the target focus subject to the target object in the current scene, while the mobile phone uses the second focusing method to focus the switched target focus subject, the mobile phone may display the focus on the shooting interface. Frame, the focus frame is used to mark the target focus subject after switching (that is, the target object in the current scene). Exemplarily, as shown in FIG. 9B (a), during the process of the mobile phone focusing on the switched target focus subject through the second focusing method, the mobile phone may display on the shooting interface for marking the switched target focus subject的focus frame 905. Exemplarily, as shown in FIG. 9B (b), the focus frame used to mark the switched target focus subject may also be the focus frame 906; for example, as shown in FIG. 9B (c), the focus frame used to mark The focus frame of the switched target focus subject may also be the focus frame 907; for example, as shown in FIG. 9B (d), the focus frame used to mark the switched target focus subject may also be the focus frame 908.
在一些实施例中,在手机通过第二对焦方法进行对焦时,手机可以在拍摄界面上显示提示信息1,用于提示用户当前手机正在切换对焦方法。示例性地,如图10中(a)所示,手机在拍摄界面上显示的提示信息1可以为信息1001,信息1001具体为“当前图像模糊,正在切换对焦方式”;示例性地,如图10中(b)所示,在手机采用的第二对焦方法为基于神经网络模型的对焦方法的情况下,手机在拍摄界面上显示的提示信息1可以为信息1002,信息1002具体为“当前图像模糊,已自动切换AI对焦方式”;如图10中(c)所示,手机在拍摄界面上显示的提示信息1可以为信息1003,信息1003具体为“当前图像模糊,已开启AI对焦”;如图10中(d)所示,手机在拍摄界面上显示的提示信息1可以为信息1004,信息1004具体为“切换对焦方式中,请持稳手机”;如图10中(e)所示,手机在拍摄界面上显示的提示信息1可以为信息1005,信息1005具体为“二次对焦中,请持稳手机”;如图10中(f)所示,手机在拍摄界面上显示的提示信息1可以为信息1006,信息1006具体为“正在改善图像品质,请持稳手机”。示例性地,在手机通过第二对焦方法完成对焦之后,在手机的拍摄界面上所显示的提示信息1可以自动消失;示例性地,在手机的拍摄界面上显示提示信息1预置时间之后(例如1秒或者2秒等),拍摄界面上的提示信息1可以自动消失。In some embodiments, when the mobile phone uses the second focusing method to focus, the mobile phone may display the prompt message 1 on the shooting interface to remind the user that the mobile phone is currently switching the focusing method. Exemplarily, as shown in Fig. 10(a), the prompt message 1 displayed on the shooting interface of the mobile phone may be message 1001, and message 1001 is specifically “the current image is blurred and the focus mode is being switched”; for example, as shown in Fig. As shown in (b) of 10, when the second focusing method adopted by the mobile phone is the focusing method based on the neural network model, the prompt message 1 displayed on the shooting interface of the mobile phone can be information 1002, and information 1002 can be specifically "current image Blurred, the AI focus mode has been automatically switched"; as shown in Figure 10(c), the prompt message 1 displayed on the shooting interface of the mobile phone can be message 1003, and message 1003 is specifically "The current image is blurred, AI focus has been turned on"; As shown in Figure 10(d), the prompt message 1 displayed by the mobile phone on the shooting interface can be information 1004, which is specifically "Please hold the phone steady while switching the focus mode"; as shown in Figure 10(e) , The prompt message 1 displayed by the mobile phone on the shooting interface can be message 1005, which is specifically "Secondary focusing, please hold the phone steady"; as shown in Figure 10 (f), the prompt displayed on the shooting interface by the mobile phone Message 1 can be message 1006, and message 1006 is specifically "Improving image quality, please hold your phone steady". Exemplarily, after the mobile phone completes focusing by the second focusing method, the prompt message 1 displayed on the shooting interface of the mobile phone can automatically disappear; for example, after the prompt message 1 is displayed on the shooting interface of the mobile phone for a preset time ( For example, 1 second or 2 seconds, etc.), the prompt message 1 on the shooting interface can automatically disappear.
在一些实施例中,在通过第二对焦方法对当前场景中的目标对焦主体进行对焦,得到第二图像之后,在第二图像中的目标对焦主体的清晰度小于预设阈值时,在拍摄界面上显示提示信息2,该提示信息2用于提示用户调整拍摄距离。由于手机中的摄像头均有最小对焦距离限制,在手机距离目标物体太近的时候,手机往往难以实现准焦,那么在第二图像中的目标对焦主体的清晰度小于预设阈值时,可以认为手机经过了二次对焦仍然无法实现准焦,因此,可以确定当前手机距离目标物体过近,因而导致手机始终无法实现准焦。因此,在手机确定第二图像中的目标对焦主体的清晰度小于预设阈值时,手机可以在拍摄界面上显示提示信息2,用于提示用户调整拍摄距离。示例性地,如图11中(a)所示,提示信息2可以是拍摄界面上的信息1101,信息1101具体为“当前拍摄距离过近,请移远手机”;示例性地,如图11中(b)所示,提示信息2可以是拍摄界面上的信息1102,信息1102具体为“当前拍摄距离过近,请调整拍摄距离”;如图11中(c)所示,提示信息2可以是拍摄界面上的信息1103,信息1103具体为“当前拍摄距离已小于最小对焦距离”。In some embodiments, after the second focusing method is used to focus the target focused subject in the current scene to obtain the second image, when the sharpness of the target focused subject in the second image is less than a preset threshold, in the shooting interface The prompt message 2 is displayed on the screen, and the prompt message 2 is used to prompt the user to adjust the shooting distance. Since the camera in the mobile phone has a minimum focus distance limit, when the mobile phone is too close to the target object, it is often difficult for the mobile phone to achieve focus. Then when the sharpness of the target focus subject in the second image is less than the preset threshold, it can be considered After the mobile phone has been focused twice, it still cannot achieve quasi-focus. Therefore, it can be determined that the current mobile phone is too close to the target object, so that the mobile phone cannot achieve quasi-focus. Therefore, when the mobile phone determines that the sharpness of the target focus subject in the second image is less than the preset threshold, the mobile phone may display the prompt message 2 on the shooting interface for prompting the user to adjust the shooting distance. Exemplarily, as shown in Figure 11(a), the prompt message 2 may be information 1101 on the shooting interface, and the information 1101 is specifically "The current shooting distance is too close, please move your phone away"; for example, as shown in Figure 11 As shown in (b), the prompt message 2 can be the information 1102 on the shooting interface, and the message 1102 is specifically "The current shooting distance is too close, please adjust the shooting distance"; as shown in Figure 11 (c), the prompt message 2 can be It is the information 1103 on the shooting interface, and the information 1103 is specifically "the current shooting distance is less than the minimum focus distance".
在一些实施例中,在手机配置有多个摄像头的情况下,在手机确定第二图像中的目标对焦主体的清晰度小于预设阈值时,手机还可以在拍摄界面上显示提示信息3,该提示信息3用于提示用户切换摄像头。示例性地,如图12中(a)所示,在手机的拍摄界面上可以显示用于提示用户切换摄像头的提示信息3,提示信息3可以为信息1201,信息1201具体为“当前拍摄距离过近,请切换微距摄像头”;示例性地,如图12中(b)所示,在手机的拍摄界面上显示有摄像头切换控件1202,在手机检测到用户点击摄像头切换控件1202中表示微距摄像头的按键时,手机可以将摄像头切换为微距摄像头来进行对焦;示例性地,如图12中(c)所示,响应于用户点击摄像头切换控件1202中表示微距摄像头的按键,手机将摄像头切换为微距摄像头并且进行了对焦,并且在摄像头切换控件1203上显示当前工作的摄像头为微距摄像头。In some embodiments, when the mobile phone is equipped with multiple cameras, when the mobile phone determines that the sharpness of the target focus subject in the second image is less than the preset threshold, the mobile phone may also display the prompt message 3 on the shooting interface. Prompt message 3 is used to prompt the user to switch cameras. Exemplarily, as shown in Figure 12 (a), a prompt message 3 for prompting the user to switch cameras may be displayed on the shooting interface of the mobile phone. The prompt message 3 may be information 1201, and the information 1201 may specifically be "the current shooting distance is over Close, please switch the macro camera"; for example, as shown in Figure 12(b), the camera switching control 1202 is displayed on the shooting interface of the mobile phone, and the mobile phone detects that the user clicks the camera switching control 1202 to indicate macro When the camera button is pressed, the mobile phone can switch the camera to a macro camera for focusing; for example, as shown in Figure 12(c), in response to the user clicking the button of the camera switch control 1202 that represents the macro camera, the mobile phone will The camera is switched to a macro camera and focused, and the camera switching control 1203 displays that the currently working camera is a macro camera.
在一些实施例中,在手机中的多个摄像头配置有对应的拍摄模式的情况下,例如手机中的广角镜头配置有广角拍摄模式,手机中的微距镜头配置有微距拍摄模式时,该提示信息3还可以用于提示用户切换拍摄模式,这样一来,在用户根据提示信息3切换微距拍摄模式之后,手机可以进入到微距拍摄模式并且切换微距镜头进行拍摄。示例性地,如图12中(d)所示,在手机的拍摄界面上可以显示用于提示用户切换拍摄模式的提示信息3,提示信息3可以为信息1204,信息1204具体为“当前拍摄距离过近,请切换微距拍摄模式”;示例性地,如图12中(e)所示,在手机的拍摄界面上显示有微距拍摄模式切换控件1205,在手机检测到用户点击微距拍摄模式切换控件1205时,手机可以进入微距拍摄模式并且将摄像头切换为微距摄像头来进行对焦;示例性地,如图12中(f)所示,响应于用户点击微距拍摄模式切换控件1205,手机将摄像头切换为微距摄像头并且进行了对焦,并且在拍摄界面上显示微距拍摄模式控件1206,在手机检测到用户点击微距拍摄模式控件1206上的关闭按键之后,手机可以退出微距拍摄模式。In some embodiments, when multiple cameras in the mobile phone are configured with corresponding shooting modes, for example, the wide-angle lens in the mobile phone is configured with a wide-angle shooting mode, and the macro lens in the mobile phone is configured with a macro shooting mode. Information 3 can also be used to prompt the user to switch the shooting mode. In this way, after the user switches the macro shooting mode according to the prompt message 3, the mobile phone can enter the macro shooting mode and switch the macro lens for shooting. Exemplarily, as shown in (d) in Figure 12, a prompt message 3 for prompting the user to switch the shooting mode may be displayed on the shooting interface of the mobile phone. The prompt message 3 may be information 1204, and the information 1204 may specifically be "current shooting distance Too close, please switch the macro shooting mode"; for example, as shown in Figure 12(e), a macro shooting mode switching control 1205 is displayed on the shooting interface of the mobile phone, and it is detected that the user clicks on the macro shooting on the mobile phone When the mode switching control 1205, the mobile phone can enter the macro shooting mode and switch the camera to a macro camera for focusing; for example, as shown in (f) of FIG. 12, in response to the user clicking the macro shooting mode switching control 1205 , The phone switches the camera to a macro camera and focuses, and displays the macro shooting mode control 1206 on the shooting interface. After the phone detects that the user clicks the close button on the macro shooting mode control 1206, the phone can exit the macro Shooting mode.
结合上述实施例及相关附图,本申请实施例提供了一种图像拍摄方法,该方法可以由电子设备(例如手机、平板电脑等终端设备或可部署于终端设备上的电子装置)来实现。如图13所示,该方法可以包括以下步骤:In combination with the above-mentioned embodiments and related drawings, the embodiments of the present application provide an image capturing method, which can be implemented by electronic equipment (such as terminal equipment such as mobile phones and tablet computers or electronic devices that can be deployed on terminal equipment). As shown in Figure 13, the method may include the following steps:
1301、确定当前场景中的目标对焦主体。1301. Determine a target focus subject in the current scene.
响应于用户打开相机应用的操作,启动相机,进入拍摄模式;在进入拍摄模式后,确定当前场景中的目标对焦主体,即确定当前场景中需要获得清晰图像的主体。In response to the user's operation to open the camera application, start the camera and enter the shooting mode; after entering the shooting mode, determine the target focus subject in the current scene, that is, determine the subject in the current scene that needs to obtain a clear image.
1302、通过第一对焦方法对当前场景中的目标对焦主体进行对焦,得到第一图像。1302. Focus on the target focused subject in the current scene by using the first focusing method to obtain a first image.
示例性地,第一对焦方法可以是相位对焦方法或者激光对焦方法。示例性地,电子设备可以在如图2所示的自动对焦模式下通过第一对焦方法进行对焦;示例性地,电子设备也可以是在如图3所示的手动对焦模式下通过第一对焦方法进行对焦;示例性地,电子设备还可以是在如图4所示的AI对焦模式下通过第一对焦方法进行对焦。Exemplarily, the first focusing method may be a phase focusing method or a laser focusing method. Exemplarily, the electronic device may perform focusing by the first focusing method in the auto-focus mode as shown in FIG. 2; for example, the electronic device may also perform focusing by the first focusing method in the manual focus mode as shown in FIG. Method for focusing; for example, the electronic device may also perform focusing by the first focusing method in the AI focusing mode as shown in FIG. 4.
1303、在第一图像中目标对焦主体的清晰度小于预设阈值时,通过第二对焦方法对当前场景中的目标对焦主体进行对焦,得到第二图像,第二图像中的目标对焦主体的清晰度不小于预设阈值;其中,第一对焦方法和第二对焦方法对应的镜头位置不同,第二对焦方法为基于神经网络模型的对焦方法。1303. When the sharpness of the target focused subject in the first image is less than the preset threshold, focus on the target focused subject in the current scene by the second focusing method to obtain a second image, and the target focused subject in the second image is sharp The degree is not less than a preset threshold; wherein, the lens positions corresponding to the first focusing method and the second focusing method are different, and the second focusing method is a focusing method based on a neural network model.
示例性地,电子设备获得第一图像之后,电子设备可以通过上述的神经网络模型来确定第一图像中目标对焦主体的清晰度。示例性地,第一对焦方法可以包括相位对焦方法或者激光对焦方法,第二对焦方法为基于神经网络模型的对焦方法,基于第二对焦方法拍摄得到的第二图像中的目标对焦主体的清晰度不小于预设阈值。Exemplarily, after the electronic device obtains the first image, the electronic device may determine the sharpness of the target focus subject in the first image through the aforementioned neural network model. Exemplarily, the first focusing method may include a phase focusing method or a laser focusing method, and the second focusing method is a focusing method based on a neural network model, and the sharpness of the target focus subject in the second image captured based on the second focusing method Not less than the preset threshold.
在一些实施例中,在第一图像中目标对焦主体的清晰度小于预设阈值时,输出第二图像为目标图像。In some embodiments, when the sharpness of the target focused subject in the first image is less than the preset threshold, the second image is output as the target image.
在一些实施例中,在第一图像中目标对焦主体的清晰度不小于预设阈值时,输出第一图像为目标图像。In some embodiments, when the sharpness of the target focused subject in the first image is not less than the preset threshold, the first image is output as the target image.
示例性地,目标图像可以为拍摄界面上预览区域所显示的预览图像;或者,目标图像还可以是响应于用户的拍照指示,存储至存储介质中的图像。Exemplarily, the target image may be a preview image displayed in the preview area on the shooting interface; or, the target image may also be an image stored in a storage medium in response to a user's photographing instruction.
在一些实施例中,通过第二对焦方法对当前场景中的目标对焦主体进行对焦,包括:In some embodiments, focusing on the target focused subject in the current scene by the second focusing method includes:
将标记有目标对焦主体的第一图像输入神经网络模型,得到神经网络模型的第一输出结果,第一输出结果为第一图像中目标对焦主体的清晰度;根据第一图像中目标对焦主体的清晰度调整镜头位置,得到第二图像。示例性地,在通过第二对焦方法对当前场景中的目标对焦主体进行对焦时,可以将标记有目标对焦主体的第一图像输入至神经网络模型中,基于神经网络模型得到第一图像中目标对焦主体的清晰度,然后根据目标对焦主体的清晰度确定镜头的移动位置,将镜头移动至所确定的位置上,从而完成对焦,得到第二图像。The first image marked with the target focus subject is input into the neural network model, and the first output result of the neural network model is obtained. The first output result is the sharpness of the target focus subject in the first image; according to the target focus subject in the first image Adjust the lens position to obtain the second image. Exemplarily, when the target focused subject in the current scene is focused by the second focusing method, the first image marked with the target focused subject can be input into the neural network model, and the target in the first image can be obtained based on the neural network model. Focusing on the sharpness of the subject, then determining the moving position of the lens according to the sharpness of the target focusing subject, and moving the lens to the determined position, thereby completing focusing and obtaining a second image.
在一些实施例中,根据第一图像中目标对焦主体的清晰度调整镜头位置,包括:根据第一图像中目标对焦主体的清晰度以及全量程确定镜头的移动值,其中,全量程为镜头可移动的最大范围值,移动值为全量程与第一乘积之间的差值,第一乘积为清晰度与全量程的乘积;根据移动值将镜头移动至目标位置。In some embodiments, adjusting the lens position according to the sharpness of the target focus subject in the first image includes: determining the movement value of the lens according to the sharpness of the target focus subject in the first image and the full range, where the full range is the lens can The maximum range value of the movement, the movement value is the difference between the full range and the first product, the first product is the product of the sharpness and the full range; the lens is moved to the target position according to the movement value.
在一些实施例中,在第一图像为多景深图像,且目标对焦主体位于多景深图像中的背景区域时,将目标对焦主体切换为多景深图像中的前景区域内的主体,得到切换后的目标对焦主体;在第一图像中目标对焦主体的清晰度小于预设阈值时,通过第二对焦方法对当前场景中的目标对焦主体进行对焦,得到第二图像,包括:在第一图像中切换后的目标对焦主体的清晰度小于预设阈值时,在当前场景中通过第二对焦方法对切换后的目标对焦主体进行对焦,得到第二图像。In some embodiments, when the first image is a multi-depth image and the target focus subject is located in the background area of the multi-depth image, the target focus subject is switched to the subject in the foreground area of the multi-depth image to obtain the switched The target focus subject; when the clarity of the target focus subject in the first image is less than the preset threshold, the second focus method is used to focus the target focus subject in the current scene to obtain a second image, including: switching in the first image When the sharpness of the subsequent target focused subject is less than the preset threshold, the switched target focused subject is focused by the second focusing method in the current scene to obtain a second image.
在一些实施例中,在当前场景中通过第二对焦方法对切换后的目标对焦主体进行对焦,包括:将标记有切换后的目标对焦主体的第一图像输入神经网络模型,得到神经网络模型的第二输出结果,第二输出结果为第一图像中切换后的目标对焦主体的清晰度;根据第一图像中切换后的目标对焦主体的清晰度调整镜头位置,得到第二图像。In some embodiments, focusing on the switched target focus subject in the current scene by the second focus method includes: inputting the first image marked with the switched target focus subject into the neural network model to obtain the neural network model The second output result is the sharpness of the switched target focus subject in the first image; the lens position is adjusted according to the sharpness of the switched target focus subject in the first image to obtain the second image.
在一些实施例中,神经网络模型是通过标记有对焦主体以及对焦主体的清晰度的图像训练数据训练得到的。In some embodiments, the neural network model is obtained by training image training data marked with the focus subject and the sharpness of the focus subject.
在一些实施例中,在将目标对焦主体切换为多景深图像中的前景区域内的主体,得到切换后的目标对焦主体之后,还可以根据切换后的目标对焦主体在拍摄界面上显示对焦框,对焦框用于标记切换后的目标对焦主体。In some embodiments, after the target focus subject is switched to the subject in the foreground area in the multi-depth image, and the switched target focus subject is obtained, the focus frame may be displayed on the shooting interface according to the switched target focus subject. The focus frame is used to mark the target focus subject after switching.
在一些实施例中,在通过第二对焦方法进行对焦的过程中,可以在拍摄界面上显示提 示信息1,提示信息用1于提示用户切换对焦方法或开启通过第二对焦方法进行对焦的模式。示例性地,该提示信息1可以为如图10中所示的信息1001至信息1006。In some embodiments, during the process of focusing by the second focusing method, a prompt message 1 may be displayed on the shooting interface, and the prompt message 1 is used to prompt the user to switch the focusing method or to turn on the mode of focusing by the second focusing method. Exemplarily, the prompt information 1 may be information 1001 to information 1006 as shown in FIG. 10.
在一些实施例中,在通过第二对焦方法对当前场景中的目标对焦主体进行对焦,得到第二图像之后,在第二图像中的目标对焦主体的清晰度小于预设阈值时,在拍摄界面上显示提示信息2,该提示信息2用于提示用户调整拍摄距离。示例性地,该提示信息2可以为如图11中所示的信息1101至信息1106。In some embodiments, after the second focusing method is used to focus the target focused subject in the current scene to obtain the second image, when the sharpness of the target focused subject in the second image is less than a preset threshold, in the shooting interface The prompt message 2 is displayed on the screen, and the prompt message 2 is used to prompt the user to adjust the shooting distance. Exemplarily, the prompt information 2 may be information 1101 to information 1106 as shown in FIG. 11.
在一些实施例中,在通过第二对焦方法对当前场景中的目标对焦主体进行对焦,得到第二图像之后,在第二图像中的目标对焦主体的清晰度小于预设阈值时,在拍摄界面上显示提示信息3,该提示信息3用于提示用户切换摄像头或者切换拍摄模式。示例性地,该提示信息3可以为如图12中所示的信息1201至信息1206。In some embodiments, after the second focusing method is used to focus the target focused subject in the current scene to obtain the second image, when the sharpness of the target focused subject in the second image is less than a preset threshold, in the shooting interface The prompt message 3 is displayed on the screen, and the prompt message 3 is used to prompt the user to switch the camera or switch the shooting mode. Exemplarily, the prompt information 3 may be information 1201 to information 1206 as shown in FIG. 12.
可以理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件和/或软件模块。结合本文中所公开的实施例描述的各示例的算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以结合实施例对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。It can be understood that, in order to implement the above-mentioned functions, an electronic device includes hardware and/or software modules corresponding to each function. In combination with the algorithm steps of the examples described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Those skilled in the art can use different methods for each specific application in combination with the embodiments to implement the described functions, but such implementation should not be considered as going beyond the scope of the present application.
本实施例可以根据上述方法示例对电子设备进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块可以采用硬件的形式实现。需要说明的是,本实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In this embodiment, the electronic device can be divided into functional modules according to the foregoing method examples. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated modules can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
在采用对应各个功能划分各个功能模块的情况下,图14示出了上述实施例中涉及的电子设备1400的一种可能的组成示意图,如图14所示,该电子设备1400可以包括:处理单元1401和显示单元1402。In the case of dividing each functional module corresponding to each function, FIG. 14 shows a schematic diagram of a possible composition of the electronic device 1400 involved in the foregoing embodiment. As shown in FIG. 14, the electronic device 1400 may include: a processing unit 1401 and display unit 1402.
其中,处理单元1401可以用于支持电子设备1400执行上述步骤1301、步骤1302以及步骤1303,和/或用于本文所描述的技术的其他过程。Wherein, the processing unit 1401 may be used to support the electronic device 1400 to perform the above steps 1301, 1302, and 1303, and/or other processes used in the technology described herein.
显示单元1402可以用于支持电子设备1400执行上述显示对焦框、提示信息1、提示信息2和提示信息3等步骤,和/或用于本文所描述的技术的其他过程。The display unit 1402 may be used to support the electronic device 1400 to perform the steps of displaying the focus frame, prompt information 1, prompt information 2, and prompt information 3, and/or other processes used in the technology described herein.
需要说明的是,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。It should be noted that all relevant content of the steps involved in the foregoing method embodiments can be cited in the functional description of the corresponding functional module, and will not be repeated here.
本实施例提供的电子设备,用于执行上述图像拍摄方法,因此可以达到与上述实现方法相同的效果。The electronic device provided in this embodiment is used to execute the above-mentioned image capturing method, and therefore can achieve the same effect as the above-mentioned implementation method.
在采用集成的单元的情况下,电子设备可以包括处理模块、存储模块和通信模块。其中,处理模块可以用于对电子设备的动作进行控制管理,例如,可以用于支持电子设备执行上述处理单元1401执行的步骤。存储模块可以用于支持电子设备存储程序代码和数据等。通信模块,可以用于支持电子设备与其他设备的通信。In the case of an integrated unit, the electronic device may include a processing module, a storage module, and a communication module. The processing module can be used to control and manage the actions of the electronic device, for example, can be used to support the electronic device to execute the steps performed by the processing unit 1401 described above. The storage module can be used to support the storage of program codes and data in the electronic device. The communication module can be used to support the communication between electronic devices and other devices.
其中,处理模块可以是处理器或控制器。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。处理器也可以是实现计算功能的组合,例如包 含一个或多个微处理器组合,数字信号处理(digital signal processing,DSP)和微处理器的组合等等。存储模块可以是存储器。通信模块具体可以为射频电路、蓝牙芯片、Wi-Fi芯片等与其他电子设备交互的设备。Among them, the processing module may be a processor or a controller. It can implement or execute various exemplary logical blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor may also be a combination of computing functions, for example, a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, and so on. The storage module may be a memory. The communication module may specifically be a radio frequency circuit, a Bluetooth chip, a Wi-Fi chip, and other devices that interact with other electronic devices.
应理解,本申请各实施例的设备还可以基于包括有存储器和处理器的电子装置实现,存储器存储有用于执行本申请各实施例的方法的指令,处理器执行上述指令,使得终端设备执行本申请各实施例的方法。It should be understood that the device of each embodiment of the present application may also be implemented based on an electronic device including a memory and a processor. The memory stores instructions for executing the method of each embodiment of the present application, and the processor executes the foregoing instructions so that the terminal device executes the present application. Apply the method of each embodiment.
可以参阅图15,图15为本申请实施例提供的一种电子装置的结构示意图。本申请实施例提供的一种电子装置1500,包括:处理器1501和存储器1502,存储器1502上存储有计算机指令,处理器1501执行存储器上的计算机指令时用于实现以下步骤:Please refer to FIG. 15, which is a schematic structural diagram of an electronic device according to an embodiment of the application. An electronic device 1500 provided by an embodiment of the present application includes a processor 1501 and a memory 1502. The memory 1502 stores computer instructions. The processor 1501 is used to implement the following steps when executing the computer instructions on the memory:
确定当前场景中的目标对焦主体;Determine the target focus subject in the current scene;
通过第一对焦方法对当前场景中的目标对焦主体进行对焦,得到第一图像;Focusing on the target focused subject in the current scene by the first focusing method to obtain the first image;
在第一图像中目标对焦主体的清晰度小于预设阈值时,通过第二对焦方法对当前场景中的目标对焦主体进行对焦,得到第二图像,第二图像中的目标对焦主体的清晰度不小于预设阈值;其中,第一对焦方法和第二对焦方法对应的镜头位置不同,第二对焦方法为基于神经网络模型的对焦方法。When the sharpness of the target focus subject in the first image is less than the preset threshold, the second focus method is used to focus the target focus subject in the current scene to obtain a second image. The sharpness of the target focus subject in the second image is not Less than a preset threshold; where the first focusing method and the second focusing method correspond to different lens positions, and the second focusing method is a focusing method based on a neural network model.
在一些实施例中,处理器1501在执行存储器上的计算机指令时还用于实现以下步骤:在第一图像中目标对焦主体的清晰度小于预设阈值时,输出第二图像为目标图像。In some embodiments, the processor 1501 is also used to implement the following step when executing the computer instructions on the memory: when the sharpness of the target focus subject in the first image is less than the preset threshold, output the second image as the target image.
在一些实施例中,处理器1501在执行存储器上的计算机指令时还用于实现以下步骤:在第一图像中目标对焦主体的清晰度不小于预设阈值时,输出第一图像为目标图像。In some embodiments, the processor 1501 is also used to implement the following step when executing the computer instructions on the memory: when the sharpness of the target focus subject in the first image is not less than the preset threshold, output the first image as the target image.
在一些实施例中,处理器1501在执行存储器上的计算机指令时还用于实现以下步骤:将标记有目标对焦主体的第一图像输入神经网络模型,得到神经网络模型的第一输出结果,第一输出结果为第一图像中目标对焦主体的清晰度;根据第一图像中目标对焦主体的清晰度调整镜头位置,得到第二图像。In some embodiments, the processor 1501 is also used to implement the following steps when executing the computer instructions on the memory: input the first image marked with the target focus subject into the neural network model to obtain the first output result of the neural network model, An output result is the sharpness of the target focused subject in the first image; the lens position is adjusted according to the sharpness of the target focused subject in the first image to obtain a second image.
在一些实施例中,处理器1501在执行存储器上的计算机指令时还用于实现以下步骤:根据第一图像中目标对焦主体的清晰度以及全量程确定镜头的移动值,其中,全量程为镜头可移动的最大范围值,移动值为全量程与第一乘积之间的差值,第一乘积为清晰度与全量程的乘积;根据移动值将镜头移动至目标位置。In some embodiments, the processor 1501 is also used to implement the following steps when executing the computer instructions on the memory: determining the movement value of the lens according to the sharpness of the target focus subject in the first image and the full range, where the full range is the lens The maximum range value that can be moved, the movement value is the difference between the full range and the first product, and the first product is the product of the sharpness and the full range; the lens is moved to the target position according to the movement value.
在一些实施例中,处理器1501在执行存储器上的计算机指令时还用于实现以下步骤:在第一图像为多景深图像,且目标对焦主体位于多景深图像中的背景区域时,将目标对焦主体切换为多景深图像中的前景区域内的主体,得到切换后的目标对焦主体;在第一图像中切换后的目标对焦主体的清晰度小于预设阈值时,在当前场景中通过第二对焦方法对切换后的目标对焦主体进行对焦,得到第二图像。In some embodiments, the processor 1501 is also used to implement the following steps when executing the computer instructions on the memory: when the first image is a multi-depth image and the target focus subject is located in the background area in the multi-depth image, focus the target The subject is switched to the subject in the foreground area in the multi-depth image, and the switched target focus subject is obtained; when the sharpness of the switched target focus subject in the first image is less than the preset threshold, the second focus is used in the current scene The method focuses on the switched target focus subject to obtain a second image.
在一些实施例中,处理器1501在执行存储器上的计算机指令时还用于实现以下步骤:将标记有切换后的目标对焦主体的第一图像输入神经网络模型,得到神经网络模型的第二输出结果,第二输出结果为第一图像中切换后的目标对焦主体的清晰度;根据第一图像中切换后的目标对焦主体的清晰度调整镜头位置,得到第二图像。In some embodiments, the processor 1501 is also used to implement the following steps when executing the computer instructions on the memory: input the first image marked with the switched target focus subject into the neural network model to obtain the second output of the neural network model As a result, the second output result is the sharpness of the switched target focus subject in the first image; the lens position is adjusted according to the sharpness of the switched target focus subject in the first image to obtain the second image.
在一些实施例中,神经网络模型是通过标记有对焦主体以及对焦主体的清晰度的图像 训练数据训练得到的。In some embodiments, the neural network model is obtained by training the image training data labeled with the focus subject and the sharpness of the focus subject.
在一些实施例中,处理器1501在执行存储器上的计算机指令时还用于实现以下步骤:根据切换后的目标对焦主体在拍摄界面上显示对焦框,对焦框用于标记切换后的目标对焦主体。In some embodiments, the processor 1501 is also used to implement the following steps when executing the computer instructions on the memory: display a focus frame on the shooting interface according to the switched target focus subject, and the focus frame is used to mark the switched target focus subject .
在一些实施例中,处理器1501在执行存储器上的计算机指令时还用于实现以下步骤:In some embodiments, the processor 1501 is further configured to implement the following steps when executing computer instructions on the memory:
向终端设备的显示模块发送第一信号,以使得终端设备在拍摄界面上显示对焦框,该对焦框用于标记切换后的目标对焦主体。The first signal is sent to the display module of the terminal device, so that the terminal device displays a focus frame on the shooting interface, and the focus frame is used to mark the target focus subject after switching.
在一些实施例中,处理器1501在执行存储器上的计算机指令时还用于实现以下步骤:In some embodiments, the processor 1501 is further configured to implement the following steps when executing computer instructions on the memory:
在拍摄界面上显示提示信息,向终端设备的显示模块发送第二信号,以使得终端设备在拍摄界面上显示提示信息,该提示信息2用于提示用户切换对焦方法或开启通过第二对焦方法进行对焦的模式。Display prompt information on the shooting interface, and send a second signal to the display module of the terminal device, so that the terminal device displays prompt information on the shooting interface. The prompt information 2 is used to prompt the user to switch the focus method or enable the second focus method. Focus mode.
应理解,本申请实施例中提及的处理器1501可以包括一个或多个处理单元,例如:处理器1501可以包括应用处理器,调制解调处理器,图形处理器,图像信号处理器,控制器,视频编解码器,数字信号处理器,基带处理器,和/或神经网络处理器等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。It should be understood that the processor 1501 mentioned in the embodiments of the present application may include one or more processing units. For example, the processor 1501 may include an application processor, a modem processor, a graphics processor, an image signal processor, and a control unit. Processor, video codec, digital signal processor, baseband processor, and/or neural network processor, etc. Among them, the different processing units may be independent devices or integrated in one or more processors.
在一些实施例中,处理器1501可以包括一个或多个接口。接口可以包括集成电路(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 1501 may include one or more interfaces. The interface may 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/receiver (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)。在一些实施例中,处理器1501可以包含多组I2C总线。处理器1501可以通过不同的I2C总线接口分别耦合触摸传感器,充电器,闪光灯,摄像头等。例如:处理器1501可以通过I2C接口耦合触摸传感器,使处理器1501与触摸传感器通过I2C总线接口通信,实现终端设备的触摸功能。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 1501 may include multiple sets of I2C buses. The processor 1501 may be respectively coupled to the touch sensor, charger, flash, camera, etc. through different I2C bus interfaces. For example, the processor 1501 may couple the touch sensor through an I2C interface, so that the processor 1501 communicates with the touch sensor through the I2C bus interface, so as to realize the touch function of the terminal device.
MIPI接口可以被用于连接处理器1501与终端设备的显示屏,摄像头等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器1501和摄像头通过CSI接口通信,实现终端设备的拍摄功能。处理器1501和显示屏通过DSI接口通信,实现终端设备的显示功能。The MIPI interface can be used to connect the processor 1501 with peripheral devices such as display screens and cameras of terminal 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 1501 and the camera communicate through a CSI interface to implement the shooting function of the terminal device. The processor 1501 and the display screen communicate through the DSI interface to realize the display function of the terminal device.
可以理解的是,本实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对终端设备的结构限定。在本申请另一些实施例中,终端设备也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules illustrated in this embodiment is merely a schematic description, and does not constitute a structural limitation on the terminal device. In other embodiments of the present application, the terminal device may also adopt different interface connection modes in the foregoing embodiments, or a combination of multiple interface connection modes.
在一些实施例中,存储器1502可以是易失性存储器或非易失性存储器(non-volatilememory),或可包括易失性和非易失性存储器两者。其中,非易失性存储器 可以是只读存储器(read-onlymemory,ROM)、可编程只读存储器(programmableROM,PROM)、可擦除可编程只读存储器(erasablePROM,EPROM)、电可擦除可编程只读存储器(electricallyEPROM,EEPROM)、快闪存储器(flashmemory)、硬盘(harddiskdrive,HDD)或固态硬盘(solid-statedrive,SSD)。易失性存储器可以是随机存取存储器(randomaccessmemory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(staticRAM,SRAM)、动态随机存取存储器(dynamicRAM,DRAM)、同步动态随机存取存储器(synchronousDRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(doubledatarateSDRAM,DDRSDRAM)、增强型同步动态随机存取存储器(enhancedSDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlinkDRAM,SLDRAM)和直接内存总线随机存取存储器(directrambusRAM,DRRAM)。In some embodiments, the memory 1502 may be a volatile memory or a non-volatile memory (non-volatile memory), or may include both volatile and non-volatile memory. Among them, the non-volatile memory can be read-only memory (read-only memory, ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically erasable Programming read-only memory (electrically EPROM, EEPROM), flash memory (flash memory), hard disk drive (HDD) or solid-state drive (solid-state drive, SSD). The volatile memory may be random access memory (RAM), which is used as an external cache. By way of exemplary but not restrictive description, many forms of RAM are available, such as static random access memory (staticRAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (synchronousDRAM, SDRAM), Double data rate synchronous dynamic random access memory (doubledatarateSDRAM, DDRSDRAM), enhanced synchronous dynamic random access memory (enhancedSDRAM, ESDRAM), synchronous connection dynamic random access memory (synchlinkDRAM, SLDRAM) and direct memory bus random access memory (directrambusRAM, DRRAM).
应注意,本实施例中所描述的存储器旨在包括但不限于这些和任意其它适合类型的存储器。It should be noted that the memory described in this embodiment is intended to include, but is not limited to, these and any other suitable types of memory.
可以参阅图16,图16为本申请实施例提供的一种无线通信装置的结构示意图。本申请实施例还提供一种无线通信装置1600,该无线通信装置1600包括:处理器1601以及接口电路1602;其中,该处理器1601通过该接口电路1602与存储器1603耦合,该处理器1601用于执行该存储器1603中的程序代码,以使得无线通信装置执行上述相关方法步骤实现上述实施例中的图像拍摄方法。Refer to FIG. 16, which is a schematic structural diagram of a wireless communication device according to an embodiment of this application. An embodiment of the present application further provides a wireless communication device 1600. The wireless communication device 1600 includes a processor 1601 and an interface circuit 1602; wherein, the processor 1601 is coupled to the memory 1603 through the interface circuit 1602, and the processor 1601 is used for The program code in the memory 1603 is executed, so that the wireless communication device executes the above-mentioned related method steps to implement the image shooting method in the above-mentioned embodiment.
本实施例还提供一种计算机存储介质,该计算机存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法步骤实现上述实施例中的图像拍摄方法。This embodiment also provides a computer storage medium in which computer instructions are stored. When the computer instructions run on an electronic device, the electronic device executes the above-mentioned related method steps to implement the image shooting method in the above-mentioned embodiment.
本实施例还提供了一种计算机程序产品,当该计算机程序产品在电子设备上运行时,使得电子设备执行上述相关步骤,以实现上述实施例中的图像拍摄方法。This embodiment also provides a computer program product, which when the computer program product runs on an electronic device, causes the electronic device to execute the above-mentioned related steps, so as to realize the image shooting 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 image capturing method in the foregoing method embodiments.
其中,本实施例提供的电子设备、计算机存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Among them, the electronic equipment, 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. Those skilled in the art can clearly understand that, for the convenience and conciseness of the description, the specific working process of the above-described system, device, and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device, and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined It can be integrated into another system, 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 components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. 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.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器、随机存取存储器、磁碟或者光盘等各种可以存储程序代码的介质。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 computer readable storage medium. Based on this understanding, the technical solution of this application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium. , Including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory, random access memory, magnetic disk or optical disk and other media that can store program codes.

Claims (25)

  1. 一种图像拍摄方法,其特征在于,包括:An image shooting method, characterized in that it comprises:
    确定当前场景中的目标对焦主体;Determine the target focus subject in the current scene;
    通过第一对焦方法对所述当前场景中的目标对焦主体进行对焦,得到第一图像;Focusing on the target focused subject in the current scene by using the first focusing method to obtain a first image;
    在所述第一图像中所述目标对焦主体的清晰度小于预设阈值时,通过第二对焦方法对所述当前场景中的目标对焦主体进行对焦,得到第二图像,所述第二图像中的所述目标对焦主体的清晰度不小于预设阈值;其中,所述第一对焦方法和所述第二对焦方法对应的镜头位置不同,所述第二对焦方法为基于神经网络模型的对焦方法。When the sharpness of the target focused subject in the first image is less than a preset threshold, the target focused subject in the current scene is focused by a second focusing method to obtain a second image, in the second image The sharpness of the target focusing subject is not less than a preset threshold; wherein the lens positions corresponding to the first focusing method and the second focusing method are different, and the second focusing method is a focusing method based on a neural network model .
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    在所述第一图像中所述目标对焦主体的清晰度小于预设阈值时,输出所述第二图像为目标图像。When the sharpness of the target focused subject in the first image is less than a preset threshold, output the second image as a target image.
  3. 根据权利要求1或2所述的方法,其特征在于,所述方法还包括:The method according to claim 1 or 2, wherein the method further comprises:
    在所述第一图像中所述目标对焦主体的清晰度不小于预设阈值时,输出所述第一图像为目标图像。When the definition of the target focus subject in the first image is not less than a preset threshold, output the first image as the target image.
  4. 根据权利要求1至3任意一项所述的方法,其特征在于,所述通过第二对焦方法对所述当前场景中的目标对焦主体进行对焦,包括:The method according to any one of claims 1 to 3, wherein the focusing on a target focused subject in the current scene by a second focusing method comprises:
    将标记有所述目标对焦主体的第一图像输入所述神经网络模型,得到所述神经网络模型的第一输出结果,所述第一输出结果为所述第一图像中所述目标对焦主体的清晰度;The first image marked with the target focus subject is input into the neural network model to obtain a first output result of the neural network model, and the first output result is the target focus subject in the first image Clarity
    根据所述第一图像中所述目标对焦主体的清晰度调整镜头位置,得到第二图像。The lens position is adjusted according to the definition of the target focus subject in the first image to obtain a second image.
  5. 根据权利要求4所述的方法,其特征在于,所述根据所述第一图像中所述目标对焦主体的清晰度调整镜头位置,包括:The method according to claim 4, wherein the adjusting the lens position according to the sharpness of the target focus subject in the first image comprises:
    根据所述第一图像中所述目标对焦主体的清晰度以及全量程确定所述镜头的移动值,其中,所述全量程为所述镜头可移动的最大范围值,所述移动值为所述全量程与第一乘积之间的差值,所述第一乘积为所述清晰度与所述全量程的乘积;The movement value of the lens is determined according to the definition of the target focus subject in the first image and the full range, wherein the full range is the maximum range value that the lens can move, and the movement value is the The difference between the full range and a first product, where the first product is the product of the sharpness and the full range;
    根据所述移动值将所述镜头移动至目标位置。The lens is moved to the target position according to the movement value.
  6. 根据权利要求1至5任意一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 5, wherein the method further comprises:
    在所述第一图像为多景深图像,且所述目标对焦主体位于所述多景深图像中的背景区域时,将所述目标对焦主体切换为所述多景深图像中的前景区域内的主体,得到切换后的目标对焦主体;When the first image is a multi-depth image and the target focus subject is located in the background area in the multi-depth image, switching the target focus subject to the subject in the foreground area in the multi-depth image, Obtain the switched target focus subject;
    所述在所述第一图像中所述目标对焦主体的清晰度小于预设阈值时,通过第二对焦方法对所述当前场景中的目标对焦主体进行对焦,得到第二图像,包括:When the sharpness of the target focused subject in the first image is less than a preset threshold, focusing on the target focused subject in the current scene by a second focusing method to obtain a second image includes:
    在所述第一图像中所述切换后的目标对焦主体的清晰度小于预设阈值时,在所述当前场景中通过第二对焦方法对所述切换后的目标对焦主体进行对焦,得到第二图像。When the sharpness of the switched target focus subject in the first image is less than a preset threshold, focus the switched target focus subject in the current scene by using a second focus method to obtain a second image.
  7. 根据权利要求6所述的方法,其特征在于,在所述当前场景中通过第二对焦方法对所述切换后的目标对焦主体进行对焦,包括:The method according to claim 6, characterized in that, in the current scene, focusing on the switched target focusing subject by a second focusing method comprises:
    将标记有所述切换后的目标对焦主体的第一图像输入所述神经网络模型,得到所述神经网络模型的第二输出结果,所述第二输出结果为所述第一图像中所述切换后的目标对焦 主体的清晰度;The first image marked with the switched target focus subject is input into the neural network model to obtain a second output result of the neural network model, and the second output result is the switching in the first image The sharpness of the focused subject after the target;
    根据所述第一图像中所述切换后的目标对焦主体的清晰度调整镜头位置,得到第二图像。The lens position is adjusted according to the sharpness of the switched target focus subject in the first image to obtain a second image.
  8. 根据权利要求6或7所述的方法,其特征在于,所述方法还包括:根据所述切换后的目标对焦主体在拍摄界面上显示对焦框,所述对焦框用于标记所述切换后的目标对焦主体。The method according to claim 6 or 7, wherein the method further comprises: displaying a focus frame on the shooting interface according to the switched target focus subject, and the focus frame is used to mark the switched target subject The target focuses on the subject.
  9. 根据权利要求1至8任意一项所述的方法,其特征在于,所述方法还包括:在拍摄界面上显示提示信息,所述提示信息用于提示用户切换对焦方法或开启通过所述第二对焦方法进行对焦的模式。The method according to any one of claims 1 to 8, wherein the method further comprises: displaying prompt information on the shooting interface, the prompt information being used to prompt the user to switch the focus method or enable the second Focus method The mode for focusing.
  10. 根据权利要求1至9任意一项所述的方法,其特征在于,所述神经网络模型是通过标记有对焦主体以及所述对焦主体的清晰度的图像训练数据训练得到的。The method according to any one of claims 1 to 9, wherein the neural network model is obtained through training of image training data marked with a focused subject and the sharpness of the focused subject.
  11. 根据权利要求1至10任意一项所述的方法,其特征在于,所述第一对焦方法包括相位对焦方法或激光对焦方法。The method according to any one of claims 1 to 10, wherein the first focusing method comprises a phase focusing method or a laser focusing method.
  12. 一种电子设备,其特征在于,包括:触摸屏,其中,所述触摸屏包括触敏表面和显示器;摄像头;一个或多个处理器;存储器;多个应用程序;以及一个或多个计算机程序,其中所述一个或多个计算机程序被存储在所述存储器中,所述一个或多个计算机程序包括指令,当所述指令被所述电子设备执行时,使得所述电子设备执行以下步骤:An electronic device, characterized by comprising: a touch screen, wherein the touch screen includes a touch-sensitive surface and a display; 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, and the one or more computer programs include instructions, which when executed by the electronic device, cause the electronic device to perform the following steps:
    确定当前场景中的目标对焦主体;Determine the target focus subject in the current scene;
    通过第一对焦方法对所述当前场景中的目标对焦主体进行对焦,得到第一图像;Focusing on the target focused subject in the current scene by using the first focusing method to obtain a first image;
    在所述第一图像中所述目标对焦主体的清晰度小于预设阈值时,通过第二对焦方法对所述当前场景中的目标对焦主体进行对焦,得到第二图像,所述第二图像中的所述目标对焦主体的清晰度不小于预设阈值;其中,所述第一对焦方法和所述第二对焦方法对应的镜头位置不同,所述第二对焦方法为基于神经网络模型的对焦方法。When the sharpness of the target focused subject in the first image is less than a preset threshold, the target focused subject in the current scene is focused by a second focusing method to obtain a second image, in the second image The sharpness of the target focusing subject is not less than a preset threshold; wherein the lens positions corresponding to the first focusing method and the second focusing method are different, and the second focusing method is a focusing method based on a neural network model .
  13. 根据权利要求12所述的电子设备,其特征在于,当所述指令被所述电子设备执行时,使得所述电子设备执行以下步骤:The electronic device according to claim 12, wherein when the instruction is executed by the electronic device, the electronic device is caused to perform the following steps:
    在所述第一图像中所述目标对焦主体的清晰度小于预设阈值时,输出所述第二图像为目标图像。When the sharpness of the target focused subject in the first image is less than a preset threshold, output the second image as a target image.
  14. 根据权利要求12或13所述的电子设备,其特征在于,当所述指令被所述电子设备执行时,使得所述电子设备执行以下步骤:The electronic device according to claim 12 or 13, wherein when the instruction is executed by the electronic device, the electronic device is caused to perform the following steps:
    在所述第一图像中所述目标对焦主体的清晰度不小于预设阈值时,输出所述第一图像为目标图像。When the definition of the target focus subject in the first image is not less than a preset threshold, output the first image as the target image.
  15. 根据权利要求12至14任意一项所述的电子设备,当所述指令被所述电子设备执行时,使得所述电子设备执行以下步骤:The electronic device according to any one of claims 12 to 14, when the instruction is executed by the electronic device, the electronic device is caused to perform the following steps:
    将标记有所述目标对焦主体的第一图像输入所述神经网络模型,得到所述神经网络模型的第一输出结果,所述第一输出结果为所述第一图像中所述目标对焦主体的清晰度;The first image marked with the target focus subject is input into the neural network model to obtain a first output result of the neural network model, and the first output result is the target focus subject in the first image Clarity
    根据所述第一图像中所述目标对焦主体的清晰度调整镜头位置,得到第二图像。The lens position is adjusted according to the definition of the target focus subject in the first image to obtain a second image.
  16. 根据权利要求15所述的电子设备,当所述指令被所述电子设备执行时,使得所述 电子设备执行以下步骤:The electronic device according to claim 15, when the instruction is executed by the electronic device, the electronic device is caused to perform the following steps:
    根据所述第一图像中所述目标对焦主体的清晰度以及全量程确定所述镜头的移动值,其中,所述全量程为所述镜头可移动的最大范围值,所述移动值为所述全量程与第一乘积之间的差值,所述第一乘积为所述清晰度与所述全量程的乘积;The movement value of the lens is determined according to the definition of the target focus subject in the first image and the full range, wherein the full range is the maximum range value that the lens can move, and the movement value is the The difference between the full range and a first product, where the first product is the product of the sharpness and the full range;
    根据所述移动值将所述镜头移动至目标位置。The lens is moved to the target position according to the movement value.
  17. 根据权利要求12至16任意一项所述的电子设备,其特征在于,当所述指令被所述电子设备执行时,使得所述电子设备执行以下步骤:The electronic device according to any one of claims 12 to 16, wherein when the instruction is executed by the electronic device, the electronic device is caused to perform the following steps:
    在所述第一图像为多景深图像,且所述目标对焦主体位于所述多景深图像中的背景区域时,将所述目标对焦主体切换为所述多景深图像中的前景区域内的主体,得到切换后的目标对焦主体;When the first image is a multi-depth image and the target focus subject is located in a background area in the multi-depth image, switching the target focus subject to a subject in the foreground area in the multi-depth image, Obtain the switched target focus subject;
    在所述第一图像中所述切换后的目标对焦主体的清晰度小于预设阈值时,在所述当前场景中通过第二对焦方法对切换后的目标对焦主体进行对焦,得到第二图像。When the sharpness of the switched target focus subject in the first image is less than a preset threshold, focus the switched target focus subject in the current scene by using a second focus method to obtain a second image.
  18. 根据权利要求17所述的电子设备,其特征在于,当所述指令被所述电子设备执行时,使得所述电子设备执行以下步骤:The electronic device according to claim 17, wherein when the instruction is executed by the electronic device, the electronic device is caused to perform the following steps:
    将标记有所述切换后的目标对焦主体的第一图像输入所述神经网络模型,得到所述神经网络模型的第二输出结果,所述第二输出结果为所述第一图像中所述切换后的目标对焦主体的清晰度;The first image marked with the switched target focus subject is input into the neural network model to obtain a second output result of the neural network model, and the second output result is the switching in the first image The sharpness of the focused subject after the target;
    根据所述第一图像中所述切换后的目标对焦主体的清晰度调整镜头位置,得到第二图像。The lens position is adjusted according to the sharpness of the switched target focus subject in the first image to obtain a second image.
  19. 根据权利要求17或18所述的电子设备,其特征在于,当所述指令被所述电子设备执行时,使得所述电子设备执行以下步骤:The electronic device according to claim 17 or 18, wherein when the instruction is executed by the electronic device, the electronic device is caused to perform the following steps:
    根据所述切换后的目标对焦主体在拍摄界面上显示对焦框,所述对焦框用于标记所述切换后的目标对焦主体。A focus frame is displayed on the shooting interface according to the switched target focus subject, and the focus frame is used to mark the switched target focus subject.
  20. 根据权利要求12至19任意一项所述的电子设备,其特征在于,当所述指令被所述电子设备执行时,使得所述电子设备执行以下步骤:The electronic device according to any one of claims 12 to 19, wherein when the instruction is executed by the electronic device, the electronic device is caused to perform the following steps:
    在拍摄界面上显示提示信息,所述提示信息用于提示用户切换对焦方法或开启通过所述第二对焦方法进行对焦的模式。A prompt message is displayed on the shooting interface, and the prompt message is used to prompt the user to switch the focus method or start the mode for focusing by the second focus method.
  21. 根据权利要求12至20任意一项所述的电子设备,其特征在于,所述神经网络模型是通过标记有对焦主体以及所述对焦主体的清晰度的图像训练数据训练得到的。The electronic device according to any one of claims 12 to 20, wherein the neural network model is obtained through training of image training data marked with a focused subject and the sharpness of the focused subject.
  22. 根据权利要求12至21任意一项所述的电子设备,其特征在于,所述第一对焦方法包括相位对焦方法或激光对焦方法。The electronic device according to any one of claims 12 to 21, wherein the first focusing method comprises a phase focusing method or a laser focusing method.
  23. 一种电子装置,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机指令,其特征在于,所述处理器执行所述计算机指令时实现所述权利要求1-11中任一项所述图像拍摄方法的步骤。An electronic device, comprising a memory, a processor, and computer instructions stored on the memory and capable of running on the processor, wherein the processor implements the claim 1 when the computer instructions are executed -11 Steps of the image shooting method described in any one of them.
  24. 一种计算机存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1-11中任一项所述的图像拍摄方法。A computer storage medium, characterized by comprising computer instructions, which when the computer instructions run on an electronic device, cause the electronic device to execute the image shooting method according to any one of claims 1-11.
  25. 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时, 使得所述计算机执行如权利要求1-11中任一项所述的图像拍摄方法。A computer program product, characterized in that, when the computer program product runs on a computer, the computer is caused to execute the image shooting method according to any one of claims 1-11.
PCT/CN2020/138859 2019-12-31 2020-12-24 Image photographing method and related apparatus WO2021136050A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911426173.9A CN113132620B (en) 2019-12-31 2019-12-31 Image shooting method and related device
CN201911426173.9 2019-12-31

Publications (1)

Publication Number Publication Date
WO2021136050A1 true WO2021136050A1 (en) 2021-07-08

Family

ID=76686476

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/138859 WO2021136050A1 (en) 2019-12-31 2020-12-24 Image photographing method and related apparatus

Country Status (2)

Country Link
CN (1) CN113132620B (en)
WO (1) WO2021136050A1 (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113674258A (en) * 2021-08-26 2021-11-19 展讯通信(上海)有限公司 Image processing method and related equipment
CN113810615A (en) * 2021-09-26 2021-12-17 展讯通信(上海)有限公司 Focusing processing method and device, electronic equipment and storage medium
CN114164790A (en) * 2021-12-27 2022-03-11 哈尔滨职业技术学院 Intelligent pavement ice and snow clearing and compacting equipment and using method thereof
CN114422708A (en) * 2022-03-15 2022-04-29 深圳市海清视讯科技有限公司 Image acquisition method, device, equipment and storage medium
CN114666497A (en) * 2022-02-28 2022-06-24 青岛海信移动通信技术股份有限公司 Imaging method, terminal device, storage medium, and program product
CN114760415A (en) * 2022-04-18 2022-07-15 上海千映智能科技有限公司 Lens focusing method, system, device and medium
CN115278089A (en) * 2022-09-26 2022-11-01 合肥岭雁科技有限公司 Face fuzzy image focusing correction method, device, equipment and storage medium
CN115512166A (en) * 2022-10-18 2022-12-23 湖北华鑫光电有限公司 Intelligent preparation method and system of lens
CN116051368A (en) * 2022-06-29 2023-05-02 荣耀终端有限公司 Image processing method and related device
CN116074624A (en) * 2022-07-22 2023-05-05 荣耀终端有限公司 Focusing method and device
CN116939363A (en) * 2022-03-29 2023-10-24 荣耀终端有限公司 Image processing method and electronic equipment
CN117132646A (en) * 2023-10-26 2023-11-28 湖南自兴智慧医疗科技有限公司 Split-phase automatic focusing system based on deep learning
CN116939363B (en) * 2022-03-29 2024-04-26 荣耀终端有限公司 Image processing method and electronic equipment

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114286064A (en) * 2020-09-17 2022-04-05 深圳光峰科技股份有限公司 Real-time focusing method, device, system and computer readable storage medium
CN114697528A (en) * 2020-12-30 2022-07-01 Oppo广东移动通信有限公司 Image processor, electronic device and focusing control method
CN114092364B (en) * 2021-08-12 2023-10-03 荣耀终端有限公司 Image processing method and related device
CN116935391A (en) * 2022-04-08 2023-10-24 广州视源电子科技股份有限公司 Text recognition method, device, equipment and storage medium based on camera
CN115209057B (en) * 2022-08-19 2023-05-23 荣耀终端有限公司 Shooting focusing method and related electronic equipment
CN116132791A (en) * 2023-03-10 2023-05-16 创视微电子(成都)有限公司 Method and device for acquiring multi-field-depth clear images of multiple moving objects
CN116991298B (en) * 2023-09-27 2023-11-28 子亥科技(成都)有限公司 Virtual lens control method based on antagonistic neural network

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013135459A (en) * 2011-12-27 2013-07-08 Canon Marketing Japan Inc Imaging apparatus and control method and program thereof
CN104079837A (en) * 2014-07-17 2014-10-01 广东欧珀移动通信有限公司 Focusing method and device based on image sensor
US9615016B2 (en) * 2013-02-07 2017-04-04 Canon Kabushiki Kaisha Image processing apparatus, image capturing apparatus, control method and recording medium, where each subject is focused in a reconstructed image
CN106713750A (en) * 2016-12-19 2017-05-24 广东欧珀移动通信有限公司 Focusing control method and apparatus, electronic device and terminal equipment
CN107483825A (en) * 2017-09-08 2017-12-15 上海创功通讯技术有限公司 A kind of method and apparatus of automatic focus adjustable
CN109561257A (en) * 2019-01-18 2019-04-02 深圳看到科技有限公司 Picture focusing method, device, terminal and corresponding storage medium
CN109698901A (en) * 2017-10-23 2019-04-30 广东顺德工业设计研究院(广东顺德创新设计研究院) Atomatic focusing method, device, storage medium and computer equipment

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7280149B2 (en) * 2001-12-21 2007-10-09 Flextronics Sales & Marketing (A-P) Ltd. Method and apparatus for detecting optimum lens focus position
US8600186B2 (en) * 2010-04-26 2013-12-03 City University Of Hong Kong Well focused catadioptric image acquisition
US20120019703A1 (en) * 2010-07-22 2012-01-26 Thorn Karl Ola Camera system and method of displaying photos
US8659697B2 (en) * 2010-11-11 2014-02-25 DigitalOptics Corporation Europe Limited Rapid auto-focus using classifier chains, MEMS and/or multiple object focusing
US8648959B2 (en) * 2010-11-11 2014-02-11 DigitalOptics Corporation Europe Limited Rapid auto-focus using classifier chains, MEMS and/or multiple object focusing
CN104601879A (en) * 2014-11-29 2015-05-06 深圳市金立通信设备有限公司 Focusing method
US9715721B2 (en) * 2015-12-18 2017-07-25 Sony Corporation Focus detection
CN105629631B (en) * 2016-02-29 2020-01-10 Oppo广东移动通信有限公司 Control method, control device and electronic device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013135459A (en) * 2011-12-27 2013-07-08 Canon Marketing Japan Inc Imaging apparatus and control method and program thereof
US9615016B2 (en) * 2013-02-07 2017-04-04 Canon Kabushiki Kaisha Image processing apparatus, image capturing apparatus, control method and recording medium, where each subject is focused in a reconstructed image
CN104079837A (en) * 2014-07-17 2014-10-01 广东欧珀移动通信有限公司 Focusing method and device based on image sensor
CN106713750A (en) * 2016-12-19 2017-05-24 广东欧珀移动通信有限公司 Focusing control method and apparatus, electronic device and terminal equipment
CN107483825A (en) * 2017-09-08 2017-12-15 上海创功通讯技术有限公司 A kind of method and apparatus of automatic focus adjustable
CN109698901A (en) * 2017-10-23 2019-04-30 广东顺德工业设计研究院(广东顺德创新设计研究院) Atomatic focusing method, device, storage medium and computer equipment
CN109561257A (en) * 2019-01-18 2019-04-02 深圳看到科技有限公司 Picture focusing method, device, terminal and corresponding storage medium

Cited By (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113674258B (en) * 2021-08-26 2022-09-23 展讯通信(上海)有限公司 Image processing method and related equipment
CN113674258A (en) * 2021-08-26 2021-11-19 展讯通信(上海)有限公司 Image processing method and related equipment
CN113810615A (en) * 2021-09-26 2021-12-17 展讯通信(上海)有限公司 Focusing processing method and device, electronic equipment and storage medium
CN114164790A (en) * 2021-12-27 2022-03-11 哈尔滨职业技术学院 Intelligent pavement ice and snow clearing and compacting equipment and using method thereof
CN114164790B (en) * 2021-12-27 2022-05-10 哈尔滨职业技术学院 Intelligent pavement ice and snow clearing and compacting equipment and using method thereof
CN114666497B (en) * 2022-02-28 2024-03-15 青岛海信移动通信技术有限公司 Imaging method, terminal device and storage medium
CN114666497A (en) * 2022-02-28 2022-06-24 青岛海信移动通信技术股份有限公司 Imaging method, terminal device, storage medium, and program product
CN114422708B (en) * 2022-03-15 2022-06-24 深圳市海清视讯科技有限公司 Image acquisition method, device, equipment and storage medium
CN114422708A (en) * 2022-03-15 2022-04-29 深圳市海清视讯科技有限公司 Image acquisition method, device, equipment and storage medium
CN116939363B (en) * 2022-03-29 2024-04-26 荣耀终端有限公司 Image processing method and electronic equipment
CN116939363A (en) * 2022-03-29 2023-10-24 荣耀终端有限公司 Image processing method and electronic equipment
CN114760415A (en) * 2022-04-18 2022-07-15 上海千映智能科技有限公司 Lens focusing method, system, device and medium
CN114760415B (en) * 2022-04-18 2024-02-02 上海千映智能科技有限公司 Lens focusing method, system, equipment and medium
CN116051368B (en) * 2022-06-29 2023-10-20 荣耀终端有限公司 Image processing method and related device
CN116051368A (en) * 2022-06-29 2023-05-02 荣耀终端有限公司 Image processing method and related device
CN116074624A (en) * 2022-07-22 2023-05-05 荣耀终端有限公司 Focusing method and device
CN116074624B (en) * 2022-07-22 2023-11-10 荣耀终端有限公司 Focusing method and device
CN115278089B (en) * 2022-09-26 2022-12-02 合肥岭雁科技有限公司 Face fuzzy image focusing correction method, device, equipment and storage medium
CN115278089A (en) * 2022-09-26 2022-11-01 合肥岭雁科技有限公司 Face fuzzy image focusing correction method, device, equipment and storage medium
CN115512166B (en) * 2022-10-18 2023-05-16 湖北华鑫光电有限公司 Intelligent preparation method and system of lens
CN115512166A (en) * 2022-10-18 2022-12-23 湖北华鑫光电有限公司 Intelligent preparation method and system of lens
CN117132646A (en) * 2023-10-26 2023-11-28 湖南自兴智慧医疗科技有限公司 Split-phase automatic focusing system based on deep learning
CN117132646B (en) * 2023-10-26 2024-01-05 湖南自兴智慧医疗科技有限公司 Split-phase automatic focusing system based on deep learning

Also Published As

Publication number Publication date
CN113132620B (en) 2022-10-11
CN113132620A (en) 2021-07-16

Similar Documents

Publication Publication Date Title
WO2021136050A1 (en) Image photographing method and related apparatus
WO2020168956A1 (en) Method for photographing the moon and electronic device
WO2021093793A1 (en) Capturing method and electronic device
WO2021052232A1 (en) Time-lapse photography method and device
KR102535607B1 (en) Methods and electronic devices for displaying images during picture taking
WO2020073959A1 (en) Image capturing method, and electronic device
WO2021129198A1 (en) Method for photography in long-focal-length scenario, and terminal
EP4020967B1 (en) Photographic method in long focal length scenario, and mobile terminal
JP2022522453A (en) Recording frame rate control method and related equipment
WO2021052111A1 (en) Image processing method and electronic device
WO2021078001A1 (en) Image enhancement method and apparatus
CN114650363B (en) Image display method and electronic equipment
CN112887583A (en) Shooting method and electronic equipment
CN113542580B (en) Method and device for removing light spots of glasses and electronic equipment
CN113810603B (en) Point light source image detection method and electronic equipment
CN113452898A (en) Photographing method and device
CN110138999B (en) Certificate scanning method and device for mobile terminal
WO2023273323A1 (en) Focusing method and electronic device
WO2022156473A1 (en) Video playing method and electronic device
WO2021238740A1 (en) Screen capture method and electronic device
CN115967851A (en) Quick photographing method, electronic device and computer readable storage medium
WO2022033344A1 (en) Video stabilization method, and terminal device and computer-readable storage medium
CN115880198B (en) Image processing method and device
CN116709018B (en) Zoom bar segmentation method and electronic equipment
CN116708751B (en) Method and device for determining photographing duration and electronic equipment

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: 20909973

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: 20909973

Country of ref document: EP

Kind code of ref document: A1