WO2023077939A1 - Camera switching method and apparatus, and electronic device and storage medium - Google Patents

Camera switching method and apparatus, and electronic device and storage medium Download PDF

Info

Publication number
WO2023077939A1
WO2023077939A1 PCT/CN2022/116759 CN2022116759W WO2023077939A1 WO 2023077939 A1 WO2023077939 A1 WO 2023077939A1 CN 2022116759 W CN2022116759 W CN 2022116759W WO 2023077939 A1 WO2023077939 A1 WO 2023077939A1
Authority
WO
WIPO (PCT)
Prior art keywords
camera
data
raw data
image signal
video
Prior art date
Application number
PCT/CN2022/116759
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 WO2023077939A1 publication Critical patent/WO2023077939A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72448User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions
    • H04M1/72454User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions according to context-related or environment-related conditions
    • 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/667Camera operation mode switching, e.g. between still and video, sport and normal or high- and low-resolution modes
    • 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
    • H04N5/00Details of television systems
    • H04N5/04Synchronising

Definitions

  • the present application relates to the technical field of terminals, and in particular to a camera switching method, electronic equipment, and a storage medium.
  • Some electronic devices are configured with multiple cameras, and different cameras in the multiple cameras have different shooting capabilities. For example, different cameras have different viewing angles, and the electronic device can collect video data with different viewing angles through different cameras.
  • multiple cameras include a primary camera and a secondary camera.
  • the primary camera and the secondary camera may need to be switched. For example, by default, after the camera application is launched, the electronic device shoots video through the main camera. If a focus adjustment operation is detected and the focus adjustment value exceeds the field of view range of the main camera, the electronic device switches from the main camera to the auxiliary camera, and then the electronic device shoots a video through the auxiliary camera.
  • the present application provides a camera switching method, device, electronic equipment and storage medium, which solves the problem in the prior art that there is a large difference in video images before and after switching when switching from one camera to another.
  • a camera switching method is provided, the electronic device includes a first camera and a second camera, and the method includes:
  • the video frame output is performed according to the third original data, and the third original data is the original video data of the second camera whose parameters are synchronized.
  • the difference between the video picture of the second camera and the video picture of the first camera after switching can be small, that is, to solve It solves the problem of large difference in video images before and after switching, thus realizing smooth switching between cameras.
  • the parameter synchronization of the second camera and the first camera according to the first raw data and the second raw data of the second camera includes:
  • the parameters of the second camera are adjusted, so as to synchronize the parameters of the second camera with the first camera.
  • the parameters of the first camera and the second camera are synchronized, so that the difference between the video picture after switching and the video picture before switching is small.
  • the first imaging information includes first exposure data, first autofocus AF, first automatic white balance AWB, and first field of view FOV
  • the second imaging information includes second exposure data , 2nd AF, 2nd AWB, 2nd FOV.
  • the exposure data, AF, AWB, and FOV parameters are adjusted synchronously, that is, multiple indicators that affect the effect of the video image are considered, so that the visual difference of the video image before and after switching is as much as possible small.
  • the method also includes:
  • pre-noise reduction processing is performed through the first target model corresponding to the second camera, the first target model can perform noise reduction processing based on any raw data, and all pre-noise reduction processing
  • the first target model is used to perform noise reduction processing on the third raw data after the focusing operation satisfies the camera switching condition.
  • pre-noise reduction processing based on the second original data before switching can make the noise reduction effect of the first target model closer to the noise reduction effect of the third target model, so that after subsequent switching, the noise reduction effect of the first target model
  • the image difference between the processed video frame and the output video frame before switching is small.
  • the pre-noise reduction processing is performed through the first target model corresponding to the second camera based on the second raw data, including:
  • the fourth original data is input into the first object model to perform pre-noise reduction processing on the first object model.
  • the first objective can be improved. model performance.
  • starting the second camera includes:
  • the difference between the focus value corresponding to the focus operation and the target focus value corresponding to the camera switching condition is less than or equal to the preset value, it means that the user may focus to meet the camera switching condition with a high probability, so the second camera, which can improve the timeliness and effectiveness of starting the second camera.
  • the electronic device includes a first image signal processing module and a second image signal processing module
  • the video frame output according to the first raw data of the first camera includes:
  • the image sensor of the first camera outputs the first raw data
  • the first image signal processing module acquires the first raw data
  • the first image signal processing module copies the first original data to obtain fifth original data
  • the first image signal processing module performs image enhancement processing on the first raw data to obtain video enhancement data
  • the first image signal processing module sends the video enhancement data and the fifth original data to the second image signal processing module;
  • the second image signal processing module outputs video frames based on the video enhancement data and the fifth original data.
  • image enhancement processing is performed by the first image signal processing module, and the first image signal processing module also provides the second image signal processing module with fifth raw data that can be used to adjust exposure parameters, so that the second image signal can
  • the processing module can determine a clear video frame, which solves the problem that the second image signal processing module cannot adopt a complex multi-frame enhancement processing algorithm similar to taking pictures, so that the display effect of the video picture is often significantly worse than that of the captured image.
  • the first raw data includes long exposure data and short exposure data collected in the same time period
  • the first image signal processing module performs image enhancement processing on the first raw data, including:
  • the first image signal processing module fuses the long exposure data and the short exposure data to obtain fused original data
  • the first image signal processing module performs noise reduction processing on the fused original data to obtain the enhanced video data.
  • the long-exposure data and the short-exposure data within the same time period can be fused subsequently to output high dynamic video frames.
  • the first image signal processing module fuses the long exposure data and the short exposure data, including:
  • the first image signal processing module inputs the long-exposure data and the short-exposure data into a second object model, and performs fusion processing by the second object model, and the second object model can Exposure data and short exposure data are fused. In this way, the fusion process can be improved by using the second target model.
  • the first image signal processing module performs noise reduction processing on the fused raw data, including:
  • the first image signal processing module inputs the fused raw data into a third object model corresponding to the first camera, and performs noise reduction processing by the third object model, and the third object model can perform any The original data is subjected to noise reduction processing. In this way, noise reduction efficiency can be improved by using the third target model to perform noise reduction processing.
  • the first image signal processing module includes a plurality of third object models corresponding to the first camera, and each third object model in the plurality of third object models corresponds to an exposure range of values; the method also includes:
  • the first image signal processing module receives target exposure data, the target exposure data is determined by the second image signal processing module based on the first exposure data, and the first exposure data is determined by the second image signal processing module
  • the module obtains exposure data statistics based on the fifth raw data, and the target exposure data is used to adjust the exposure parameters of the first camera;
  • the first image signal processing module selects a third target model from the plurality of third target models according to the target exposure data and the exposure value range corresponding to each third target model, and the selected third target model A three-objective model is used for noise reduction processing.
  • a third target model for the next noise reduction process is selected from a plurality of third target models, so that a reasonable noise reduction process can be performed on the next video data , thereby improving the noise reduction effect.
  • the second image signal processing module performs video frame output based on the video enhancement data and the fifth original data, including:
  • the second image signal processing module performs format conversion processing on the video enhancement data to obtain a YUV image
  • the second image signal processing module determines target data based on the fifth raw data, and the target data is used to adjust the image quality of the YUV image;
  • the second image signal processing module adjusts the YUV image based on the target data, and outputs the adjusted YUV image as the video frame.
  • the format conversion process is performed on the video enhancement data through the second image signal processing module, and the target data is determined based on the second raw data, and the YUV image obtained after the format conversion process is optimized according to the target data, so as to obtain a clear picture video frame.
  • the second image signal processing module includes an ISP integrated in a system-on-a-chip (SOC), and the first image signal processing module includes an ISP outside the SOC.
  • SOC system-on-a-chip
  • the image sensor of the first camera outputs the first raw data, including:
  • a night scene video shooting instruction is detected through the camera application in the electronic device, and the night scene video shooting instruction is used to indicate video recording in night scene mode;
  • the image sensor In response to the night scene video shooting instruction, the image sensor outputs the first raw data.
  • the electronic device acquires the first raw data, and processes the first raw data collected by the camera through the method provided in this application, so that the highlighted area of the obtained video frame will not be overexposed and the darkened area will not be overexposed. Not too dark, resulting in a clear video frame.
  • a camera switching device configured in an electronic device, and the electronic device includes a first camera and a second camera; the device includes an image sensor node, a first image signal processing module, and a second Image signal processing module;
  • the first image signal processing module and the second image signal processing module are configured to output video frames according to the first raw data of the first camera
  • the image sensor node is used to start the second camera before the camera switching condition is met if a focusing operation is detected during the video frame output process;
  • the first image signal processing module and the second image signal processing module are configured to, according to the first raw data and the second raw data of the second camera, combine the second camera with the first The camera performs parameter synchronization;
  • the first image signal processing module and the second image signal processing module are configured to output video frames according to third raw data when the focusing operation satisfies the camera switching condition, and the third raw data is the raw video data of the second camera after parameter synchronization.
  • the first image signal processing module and the second image signal processing module are configured to:
  • the parameters of the second camera are adjusted, so as to synchronize the parameters of the second camera with the first camera.
  • the first imaging information includes first exposure data, first autofocus AF, first automatic white balance AWB, and first field of view FOV
  • the second imaging information includes second exposure data , 2nd AF, 2nd AWB, 2nd FOV.
  • the first image signal processing module is used for:
  • pre-noise reduction processing is performed on the first target model corresponding to the second camera, the first target model can perform noise reduction processing on any raw data, and all pre-noise reduction processing
  • the first target model is used to perform noise reduction processing on the third raw data after the focusing operation satisfies the camera switching condition.
  • the first image signal processing module is used for:
  • the fourth original data is input into the first object model to perform pre-noise reduction processing on the first object model.
  • the image sensor node is used for:
  • the image sensor of the first camera outputs the first raw data
  • the first image signal processing module is configured to acquire the first raw data
  • the first image signal processing module is configured to copy the first original data to obtain fifth original data
  • the first image signal processing module is configured to perform image enhancement processing on the first raw data to obtain video enhancement data
  • the first image signal processing module is configured to send the video enhancement data and the fifth original data to the second image signal processing module;
  • the second image signal processing module is configured to output video frames based on the video enhancement data and the fifth original data.
  • the first raw data includes long exposure data and short exposure data collected in the same time period
  • the first image signal processing module is used for:
  • Noise reduction processing is performed on the fused original data to obtain the enhanced video data.
  • the first image signal processing module is used for:
  • the first image signal processing module is used for:
  • the fused original data is input into a third object model corresponding to the first camera, and the third object model performs noise reduction processing, and the third object model can perform noise reduction processing on any original data.
  • the first image signal processing module includes a plurality of third object models corresponding to the first camera, and each third object model in the plurality of third object models corresponds to an exposure range of values;
  • the first image signal processing module is also used for:
  • the target exposure data is determined by the second image signal processing module based on the first exposure data
  • the first exposure data is determined by the second image signal processing module based on the fifth raw data Obtained by performing exposure data statistics
  • the target exposure data is used to adjust the exposure parameters of the first camera
  • the target exposure data and the exposure value range corresponding to each third target model select a third target model from the plurality of third target models, and the selected third target model is used for noise reduction processing .
  • the second image signal processing module is used for:
  • the target data is used to adjust the image quality of the YUV image
  • the second image signal processing module includes an ISP integrated in a system-on-a-chip (SOC), and the first image signal processing module includes an ISP outside the SOC.
  • SOC system-on-a-chip
  • the image sensor node is used for:
  • a night scene video shooting instruction is detected through the camera application in the electronic device, and the night scene video shooting instruction is used to indicate video recording in night scene mode;
  • the first raw data is output.
  • an electronic device in the third aspect, includes a processor and a memory, and the memory is used to store a program that supports the electronic device to execute the method described in any one of the above-mentioned first aspects, and to store a program for The data involved in implementing the method described in any one of the above first aspects; the processor is configured to execute the program stored in the memory.
  • the electronic device may also include a communication bus for establishing a connection between the processor and the memory.
  • a computer-readable storage medium wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer is made to execute the method described in any one of the above-mentioned first aspects.
  • a computer program product containing instructions, which, when run on a computer, causes the computer to execute the method described in the first aspect above.
  • FIG. 1 is a schematic layout diagram of a camera provided in an embodiment of the present application
  • FIG. 2 is a schematic diagram of a hardware structure of an electronic device provided in an embodiment of the present application.
  • FIG. 3 is a schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application.
  • FIG. 4 is an interactive schematic diagram of an application scenario provided by an embodiment of the present application.
  • FIG. 5 is an interactive schematic diagram of another application scenario provided by the embodiment of the present application.
  • FIG. 6 is an interactive schematic diagram of another application scenario provided by the embodiment of the present application.
  • FIG. 7 is a schematic flowchart of a video frame output method provided by an embodiment of the present application.
  • FIG. 8 is a schematic flowchart of a camera switching method provided in an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a hardware architecture provided by an embodiment of the present application.
  • references to "one embodiment” or “some embodiments” or the like in the specification of the present application means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application.
  • appearances of the phrases “in one embodiment,” “in some embodiments,” “in other embodiments,” “in other embodiments,” etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean “one or more but not all embodiments” unless specifically stated otherwise.
  • the terms “including”, “comprising”, “having” and variations thereof mean “including but not limited to”, unless specifically stated otherwise.
  • Exposure According to the length of exposure time, it can be divided into long exposure and short exposure. The longer the exposure time, the greater the amount of light entering the aperture. Conversely, the shorter the exposure time, the smaller the amount of light entering the aperture.
  • 3A statistical algorithm including automatic exposure (automatic exposure, AE) algorithm, automatic focus (automatic focus, AF) algorithm, and automatic white balance (automatic white balance, AWB) algorithm.
  • AE refers to the camera automatically determines the exposure according to the lighting conditions.
  • the imaging system generally has an AE function, which is directly related to the brightness and image quality of the image screen, that is, it will determine the brightness and darkness of the image.
  • AF It means that the camera automatically adjusts the focus distance of the camera according to the distance of the subject, that is, the lens in the camera is adjusted to form the focus through distance measurement, so that the image in the camera is clear.
  • AWB Mainly used to solve the problem of image color cast. If there is a color cast in the image, it can be corrected by the AWB algorithm.
  • Field of view (field angle, FOV), refers to the range that the camera can cover. The larger the FOV, the more scenes the camera can accommodate. It is not difficult to understand that if the subject is not within the FOV of the camera, it will not be captured by the camera.
  • Image sensor (Sensor): It is the core component of the camera, and its function is to convert optical signals into electrical signals for subsequent processing and storage. The working principle is that the photosensitive element generates charge under the condition of light, and the charge transfer generates a current, and the current is rectified and amplified, and converted into a digital signal to form a digital signal.
  • Image sensors generally include two types: charge coupled device (CCD) and complementary metal oxide semiconductor (complementary metal oxide semiconductor, CMOS).
  • RAW data also referred to as raw data in this embodiment of the application, refers to the raw data that the CCD or CMOS image sensor in the camera converts the captured light source signal into a data signal. That is to say, it can be understood as unprocessed data, which can be used to describe the intensity of various lights received by the image sensor.
  • the method provided in the embodiment of the present application may be executed by an electronic device having a shooting function.
  • the electronic device is configured with multiple cameras, and different cameras in the multiple cameras have different shooting capabilities.
  • multiple cameras may include, but not limited to, a wide-angle camera, a telephoto camera (such as a periscope telephoto camera), a black and white camera, and an ultra-wide-angle camera.
  • multiple cameras include a main camera and at least one auxiliary camera.
  • Figure 1 The spatial position distribution of multiple cameras can be shown in Figure 1 (a), or, the spatial distribution of multiple cameras
  • the location distribution can also be shown in (b) in FIG. 1, the plurality of cameras are respectively camera 00, camera 01, camera 02, and camera 03.
  • camera 00 is the main camera, and the others are auxiliary cameras.
  • the electronic device After starting the camera application, the electronic device usually shoots through the main camera by default. After the camera is switched, the electronic device selects a suitable auxiliary camera from at least one auxiliary camera according to the switching requirement, and shoots through the selected auxiliary camera. For example, please refer to Figure 1. By default, camera 00 is used to shoot, and after the camera is switched to wide-angle, camera 01 is used to shoot.
  • an electronic device may be, but not limited to, a mobile phone action camera (GoPro), digital camera, tablet computer, desktop, laptop, handheld computer, notebook computer, vehicle-mounted device, ultra-mobile personal computer (ultra-mobile personal computer, UMPC), netbook, cellular phone, personal digital assistant (personal digital assistant, PDA), augmented reality (augmented reality, AR) ⁇ virtual reality (virtual reality, VR) equipment, mobile phone, etc. Not limited.
  • GoPro mobile phone action camera
  • digital camera tablet computer
  • desktop laptop
  • handheld computer notebook computer
  • vehicle-mounted device ultra-mobile personal computer (ultra-mobile personal computer, UMPC), netbook, cellular phone, personal digital assistant (personal digital assistant, PDA), augmented reality (augmented reality, AR) ⁇ virtual reality (virtual reality, VR) equipment, mobile phone, etc.
  • PDA personal digital assistant
  • AR augmented reality
  • VR virtual reality
  • FIG. 2 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 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, button 190, ISP 191, indicator 192, camera 193, display screen 194, and A subscriber identification module (subscriber identification module, SIM) card interface 195 and the like.
  • the number of ISPs 191 included in the electronic device is multiple, and only one is exemplarily shown in FIG. 2 .
  • the structure shown in this embodiment does not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or fewer components than shown, or combine certain components, or separate certain components, or arrange different components.
  • the illustrated components can be realized in hardware, software or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU) wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • 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
  • baseband processor baseband processor
  • neural network processor neural-network processing unit, NPU
  • the controller may be the nerve center and command center of the electronic device 100 .
  • the controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is a cache memory.
  • the memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated access is avoided, and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
  • 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, a universal asynchronous transmitter (universal asynchronous receiver/transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input and output (general-purpose input/output, GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and /or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input and output
  • subscriber identity module subscriber identity module
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (serial data line, SDA) and a serial clock line (derail clock line, SCL).
  • SDA serial data line
  • SCL serial clock line
  • the interface connection relationship between the modules shown in this embodiment is only for schematic illustration, and does not constitute a structural limitation of the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the charging management module 140 is configured to receive a charging input from a charger.
  • the charger may be a wireless charger or a wired charger.
  • the charging management module 140 can receive charging input from the wired charger through the USB interface 130 .
  • the charging management module 140 may receive a wireless charging input through a wireless charging coil of the electronic device 100 . While the charging management module 140 is charging the battery 142 , it can also supply power to the electronic device 100 through the power management module 141 .
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives the input from the battery 142 and/or the charging management module 140 to provide power for 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 disposed in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be set in the same device.
  • the wireless communication function of the electronic device 100 can be realized by the antenna 1 , the antenna 2 , the mobile communication module 150 , the wireless communication module 160 , a modem processor, a baseband processor, and the like.
  • the electronic device 100 realizes the display function through the GPU, the display screen 194 , and the application processor.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • 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 be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (quantum dot light emitting diodes, QLED), etc.
  • the electronic device 100 may include 1 or N display screens 194 , where N is a positive integer greater than 1.
  • the electronic device 100 can realize the shooting function through the ISP 191, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
  • the ISP 191 is used for processing the data fed back by the camera 193. For example, when taking a picture, open the shutter, the light is transmitted to the photosensitive element of the camera through the lens, and the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP 191 for processing, and converts it into an image visible to the naked eye.
  • ISP 191 can also optimize the algorithm for image noise, brightness, and skin tone. ISP 191 can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP 191 may include a built-in ISP integrated in the SOC and an external ISP arranged outside the SOC.
  • the internal structure of the external ISP is similar or the same as that of the built-in ISP.
  • the difference is ,
  • the external ISP and the built-in ISP have different processing tasks for video data.
  • the external ISP mainly has two functions: on the one hand, it is used to fuse and enhance the original RAW data collected by the camera during the process of video recording by the electronic device 100 through the camera, so as to provide Built-in ISP provides enhanced video data.
  • the original RAW data collected by the camera is routed to provide a copy of the original RAW data for the built-in ISP, so that the built-in ISP can accurately determine the current exposure data, and then the built-in ISP can dynamically adjust the exposure of the camera according to the exposure data parameter.
  • the external ISP is used to respond to the focus operation, start another camera in advance, and synchronize the parameters of the other camera with the camera before switching, so as to achieve smooth switching.
  • Camera 193 is used to capture still images or video.
  • the object generates an optical image through the lens and projects it 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 light signal into an electrical signal, and then transmits the electrical signal to the ISP 191 for conversion into a digital image signal.
  • ISP 191 outputs the digital image signal to DSP for processing.
  • DSP converts digital image signals into standard RGB (red green blue red green blue), YUV and other image signals.
  • the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
  • 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.
  • the electronic device 100 can play or record videos in various encoding formats, for example: moving picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
  • MPEG moving picture experts group
  • the NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • Applications such as intelligent cognition of the electronic device 100 can be realized through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, so as 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 implement a data storage function. Such as saving music, video and other files in the external memory card.
  • the internal memory 121 may be used to store computer-executable program codes including instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by executing instructions stored in the internal memory 121 .
  • the internal memory 121 may include an area for storing programs and an area for storing data.
  • the stored program area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.) and the like.
  • the storage data area can store data created during the use of the electronic device 100 (such as audio data, phonebook, etc.) and the like.
  • 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, flash memory device, universal flash storage (universal flash storage, UFS) and the like.
  • 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. Such as music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal.
  • the audio module 170 may also be used to encode and decode audio signals.
  • the audio module 170 may be set in the processor 110 , or some functional modules of the audio module 170 may be set in the processor 110 .
  • the earphone interface 170D is used for connecting wired earphones.
  • the earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile terminal platform (open mobile terminal platform, OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the keys 190 include a power key, a volume key and the like.
  • the key 190 may be a mechanical key. It can also be a touch button.
  • the electronic device 100 can receive key input and generate key signal input related to user settings and function control of the electronic device 100 .
  • the indicator 192 can be an indicator light, and can be used to indicate charging status, power change, and can also be used to indicate messages, missed calls, notifications, and the like.
  • the SIM card interface 195 is used for connecting a SIM card.
  • the SIM card can be connected and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 .
  • the electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card etc.
  • the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture.
  • the software structure of the electronic device 100 is exemplarily described by taking an Android system with a layered architecture as an example.
  • FIG. 3 is a block diagram of the software structure of the electronic device 100 provided by the 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. Layers communicate through software interfaces.
  • the Android system is respectively an application program layer, a hardware abstract layer (Hardware Abstract Layer, HAL), a kernel layer, and a hardware layer from top to bottom.
  • an application framework layer (Application Framework) (not shown in FIG. 3 ) is also included between the application layer and the HAL, which is not highlighted in this embodiment of the present application.
  • the application layer can consist of a series of application packages. As shown in Figure 3, the application package may include application programs such as a camera and a gallery.
  • the camera application supports a super night video mode, and the electronic device can shoot clear, bright and dark videos in night scenes in the super night video mode.
  • the application layer also provides pre-loaded external ISP services.
  • the internal memory of the external ISP is usually random access memory (Random Access Memory, RAM), according to the characteristics of RAM, RAM cannot save data in the case of power failure, so the external ISP is usually stored during operation.
  • the required data such as external ISP SDK and models (for example, including the first target model, the second target model, and the third target model described below) are stored in the system memory.
  • the application layer starts the preloaded external ISP service, and the external ISP driver controls the external ISP to be powered on in advance by preloading the external ISP service, so that the data required during the operation of the external ISP It is loaded from the system memory to the internal RAM of the external ISP, so that the external ISP can perform corresponding functions (such as data fusion, noise reduction processing, etc.) in the ultra-night video mode.
  • the external ISP driver controls the external ISP to be powered on in advance by preloading the external ISP service, so that the data required during the operation of the external ISP It is loaded from the system memory to the internal RAM of the external ISP, so that the external ISP can perform corresponding functions (such as data fusion, noise reduction processing, etc.) in the ultra-night video mode.
  • the video recorded by the camera can be provided in the gallery application, so that the user can view the recorded video from the gallery application.
  • the HAL layer mainly includes a video module, which is used to obtain RAW data through the image sensor of the camera, and perform fusion, enhancement, optimization and other processing on the RAW data through the external ISP and the built-in ISP respectively to obtain video with enhanced clarity and noise reduction effect frame.
  • the resulting video frames are then sent to the display for display.
  • the video module also saves the recorded video to the gallery application for easy viewing by users.
  • the video module is also used to start the camera to be started in advance when the camera needs to be switched, and before the camera is switched, the parameters of the camera that is started in advance are synchronized with the camera before the switch, so that Achieve smooth switching.
  • the video module includes an image sensor node, a built-in ISP node, and an external ISP node.
  • Each node can be understood as an encapsulation of the functions performed by the underlying hardware, which can be perceived and invoked by the upper layer (application layer).
  • the image sensor node encapsulates the function of the image sensor in the bottom camera;
  • the built-in ISP node encapsulates the function of the bottom built-in ISP;
  • the external ISP node encapsulates the function of the bottom external ISP.
  • the video module implements corresponding functions through the interaction between the image sensor node, the built-in ISP node, and the external ISP node.
  • the interior of the external ISP node may include multiple submodules, such as a routing submodule, a first preprocessing submodule, and an enhancement submodule.
  • each of the multiple sub-modules can be understood as encapsulating the functions of different hardware in the bottom-level external ISP.
  • the routing sub-module is the function of the routing unit in the bottom-level external ISP.
  • the first preprocessing sub-module is the encapsulation of one or more IFE functions in the bottom external ISP
  • the enhancement sub-module is the function of the neural network processing unit (NPU) in the bottom external ISP package.
  • the external ISP node implements corresponding functions through the interaction between multiple sub-modules.
  • the interior of the built-in ISP node includes a plurality of submodules, for example, a second preprocessing submodule and an optimization processing submodule.
  • Each of the multiple sub-modules can be understood as encapsulating the functions of different hardware in the underlying built-in ISP.
  • the second preprocessing sub-module is to process one or more images in the underlying built-in ISP Encapsulation of the functions of the front-end engine (image front end, IFE);
  • the optimization processing sub-module is the encapsulation of the functions of the image processing engine (IPE) in the underlying built-in ISP.
  • the built-in ISP node realizes the corresponding functions through the interaction of multiple sub-modules.
  • the HAL layer also includes an external ISP software development kit (software development kit, SDK), which is used to establish the interaction between multiple sub-modules inside the external ISP node.
  • SDK software development kit
  • the kernel layer is the layer between hardware and software.
  • the kernel layer includes but not limited to camera driver, built-in ISP driver, and external ISP driver.
  • the hardware layer includes but not limited to camera, built-in ISP, external ISP, display.
  • the camera application detects that video shooting is enabled in the super night video mode, it sends a night scene video shooting request to the video module of the HAL layer.
  • the video module receives the night scene video shooting request, it establishes a framework for processing the night scene video.
  • the video module notifies the camera driver to control the main camera to be powered on according to the night scene video shooting request, and notifies the built-in ISP driver to control the built-in ISP to be powered on.
  • the camera driver drives the main camera. After the main camera is loaded, the camera driver is notified to notify the video module that the main camera has been loaded through the camera driver.
  • the built-in ISP driver drives the built-in ISP, and notifies the built-in ISP driver after the built-in ISP is loaded, so as to notify the video module that the built-in ISP has been loaded through the built-in ISP driver.
  • the video module determines that the main camera, built-in ISP and external ISP (for example, the loading time is after the camera application is started)
  • the interaction between the image sensor node, the built-in ISP node and the external ISP node is established. .
  • the video data can be collected and optimized by calling the video module, and then the optimized video data collected by the main camera can be output to the display screen for display.
  • the camera application if the camera application detects the user's focusing operation, before the camera switching condition is met, the camera application sends a camera pre-start instruction to the video module of the HAL layer.
  • the camera pre-start instruction carries a target camera identifier, and the target camera identifier is used to indicate the auxiliary camera to be started.
  • the video module After receiving the camera pre-start instruction, the video module notifies the camera driver to control the power-on of the auxiliary camera according to the camera pre-start instruction, so as to start the auxiliary camera in advance for video data collection before switching, and then, according to the video data collected by the auxiliary camera and the main camera The video data of the main camera and the auxiliary camera are synchronized.
  • the video module optimizes the video data collected by the auxiliary camera after parameter synchronization, and then outputs the optimized video data collected by the auxiliary camera for display on the display screen.
  • the video module optimizes the video data collected by the auxiliary camera after parameter synchronization, and then outputs the optimized video data collected by the auxiliary camera for display on the display screen.
  • the application scenarios involved in the embodiments of the present application will be introduced next by taking the electronic device as a mobile phone including multiple rear cameras as an example.
  • a camera application program in the mobile phone please refer to (a) figure in Figure 4, in one embodiment, the user wants to take night scene video by mobile phone, at this moment, the user can click the application icon of the camera application program in the mobile phone.
  • the mobile phone starts the main camera in the rear camera, and displays the first interface as shown in (b) in FIG. 4 for the user.
  • a "night scene” option 41 is provided in the first interface, the user can trigger the "night scene” option 41, and in response to the user's trigger operation on the "night scene” option 41, the mobile phone displays the operation interface in the night scene mode ( referred to as the second interface), for example, the second interface is shown in (c) in FIG. 4 .
  • the second interface provides a first switching option 42 and a second switching option 43, wherein the first switching option 43 is used to switch between the front camera and the rear camera.
  • the second switch option 43 is used to switch between the camera mode and the video capture mode.
  • the second switch option 43 can be triggered, and in response to the trigger operation of the second switch option 43 by the user, the mobile phone switches from the camera mode to the video capture mode.
  • the mobile phone after entering the night scene mode, that is, after switching from (b) in Figure 4 to (c) in Figure 4, can also be in the video shooting mode by default, in this case , if the user wants to take a night scene image, the second switch option 43 can be triggered, and in response to the trigger operation of the second switch option 43 by the user, the mobile phone switches from the video shooting mode to the camera mode.
  • a shooting option 44 is also provided in the second interface, and the user can trigger the shooting option 44 .
  • the mobile phone records a video through a camera (such as a main camera).
  • a camera such as a main camera
  • the video recording interface is shown in (d) in FIG. 4 .
  • the mobile phone processes the video data collected by the camera through the method provided in the present application, so that a clear video frame can be captured finally.
  • the clarity of the picture mentioned here means that the highlighted areas will not be overexposed, and the dark areas will not be too dark.
  • a pause option 45 is provided in the video recording interface.
  • the pause option 45 can be triggered, and in response to the user's trigger operation on the pause option 45, the mobile phone pauses the video recording.
  • a snapshot option 46 is provided in the video recording interface.
  • the capture option 46 can be triggered.
  • the mobile phone performs a capture operation and stores the captured video frame.
  • a "more” option 51 in the first interface there is a "more” option 51 in the first interface.
  • the "more” option 51 can be triggered.
  • the mobile phone displays a third interface, for example, the third interface is shown in (b) of FIG. 5 .
  • a "night scene recording” option 52 is provided in the third interface, and the "night scene recording” option 52 is used to trigger the video recording function under the night scene scene, that is, compared to the example shown in FIG. 4, Here you can also set up an option for shooting night scene videos separately.
  • the option 52 of "night scene recording” can be triggered.
  • the mobile phone displays an operation interface (called the fourth interface) in the night scene mode.
  • the fourth interface is shown in (c) in FIG. 5 .
  • a shooting option 53 is provided on the fourth interface, and the user can trigger the shooting option 53 .
  • the mobile phone records a video through a camera (such as a main camera).
  • a camera such as a main camera
  • the video recording interface is shown in (d) in FIG. 5 .
  • a first switching option 54 may also be provided in the fourth interface, and the first switching option 54 is used to switch between the front camera and the rear camera.
  • the second switching option in the fourth interface that is, the “night scene recording” option 52 for triggering night scene video recording is provided separately under the “more” option.
  • the video recording interface provides a focusing item 47 for focusing.
  • the focus adjustment item 47 can be triggered, such as adjusting from 1x focus to telephoto, such as adjusting to multi-fold focus (such as 2x focus), or from 1x focus to wide-angle Adjustment, such as adjusting to 0.8 times focus.
  • the mobile phone focuses on the main camera, or switches to other auxiliary cameras for video collection.
  • the mobile phone when the user adjusts from 1x focus to nx focus, when n is greater than 1 and less than 2, the mobile phone will focus on the main camera, and when n is greater than or equal to 2, the mobile phone will switch from the main camera to the telephoto camera.
  • the mobile phone when the user adjusts from 1x focus to wide-angle, the mobile phone switches from the main camera to the wide-angle camera.
  • the mobile phone displays the current focusing result. For example, please refer to (b) in Figure 6. Take the user’s adjustment to the telephoto as an example.
  • the current focusing result is displayed near item 47, and the display effect is shown as 61 in FIG. 6 .
  • the mobile phone when the mobile phone is shooting video through the auxiliary camera, when a user's focusing operation is detected based on the focusing item 47, the mobile phone switches from the auxiliary camera to the main camera.
  • the mobile phone when the mobile phone is shooting video with the telephoto camera, when the user's focusing operation is detected based on the focusing item 47, and the focusing result is 1x focus, the telephoto camera is switched back to the main camera.
  • the method provided by the embodiment of the present application can also be applied to a conventional video recording scene.
  • the electronic device can still use the method provided by the embodiment of the present application to switch between cameras and optimize the collected video data.
  • the method can also be applied to the camera preview scene, that is, when the electronic device starts the camera and enters the preview state, it can switch the camera and process the preview image using the method provided in the embodiment of the present application.
  • the implementation process of the camera switching method provided by the embodiment of the present application will be introduced in detail.
  • the method is applied to an electronic device, and the electronic device is implemented through the interaction between various nodes shown in FIG. 3 .
  • switching from the primary camera to the secondary camera is taken as an example for illustration.
  • Figure 7 firstly introduce the processing flow of the video data of the main camera by the electronic device, which may specifically include the following implementation steps:
  • the image sensor node acquires first RAW data.
  • the first RAW data is the RAW data output by the image sensor of the main camera.
  • the camera application detects a trigger operation of video shooting in the super night video mode, in response to the trigger operation, the camera application sends a night scene video shooting request to the video module.
  • the video module receives the night scene video shooting request, it establishes a framework for processing the night scene video, and the specific implementation can be referred to above.
  • the image sensor node collects and captures the light source signal through the image sensor in the main camera, and converts the captured light source signal into a data signal to obtain the first RAW data.
  • the first RAW data is 4K60 interlaced high dynamic range (staggered high dynamic range, SHDR) data, where 4K60 means that the resolution is 4K and the frame rate is 60 frames per second.
  • the first RAW data includes long exposure data and short exposure data
  • the long exposure data refers to the data collected by the image sensor through the long exposure method
  • the short exposure data refers to the data collected by the image sensor through the short exposure method . That is, two exposures are performed within one exposure time to obtain the first RAW data.
  • the main camera exposes twice within each 33ms, thus obtaining 60 frames of video data.
  • Short exposures are used to prevent overexposure in highlighted areas, and long exposures are used to brighten dark areas to prevent underexposure.
  • the image sensor node sends the first RAW data to the external ISP node.
  • the image sensor node sends the 4K60 SHDR data to the external ISP node for processing such as fusion and enhancement through the external ISP node.
  • the first RAW data first arrives at the routing submodule in the external ISP node.
  • the routing submodule performs copying and routing processing on the first RAW data.
  • an electronic device When an electronic device shoots a video in a night scene, in order to obtain a clear video frame, on the one hand, it can perform processing such as enhancement on the first RAW data; on the other hand, it can calculate the exposure data according to the first RAW data to obtain the first exposure data, and then dynamically adjust the exposure parameters of the main camera according to the first exposure data.
  • the routing sub-module in the external ISP node performs copying and routing processing on the first RAW data.
  • the routing submodule copies the first RAW data to obtain another copy of RAW data, which is called fifth RAW data here.
  • routing processing is performed on the first RAW data and the fifth RAW data.
  • the routing submodule transmits a piece of RAW data (such as the first RAW data) in the first RAW data and the fifth RAW data to the first preset
  • the processing sub-module performs processing, and another piece of RAW data (for example, the fifth RAW data) is used for subsequent built-in ISP nodes to count the first exposure data.
  • first RAW data may also be transmitted to the built-in ISP node
  • fifth RAW data may be transmitted to the first preprocessing submodule, which is not limited in this embodiment.
  • the routing sub-module transmits the first RAW data to the first pre-processing sub-module, and transmits the fifth RAW data to the built-in ISP node for the purpose of counting the first exposure data as an example.
  • the first preprocessing submodule performs preprocessing on the first RAW data.
  • the first preprocessing submodule Before performing fusion and noise reduction processing on the RAW data, the first preprocessing submodule first preprocesses the first RAW data, so as to correct the first RAW data.
  • preprocessing includes but is not limited to lens shading correction (LSC) processing, black level compensation (black level compensation, BLC) processing, bad pixel correction (bad pixel correction, BPC processing), color interpolation At least one of the processing.
  • LSC lens shading correction
  • BLC black level compensation
  • BPC bad pixel correction
  • color interpolation At least one of the processing.
  • the first preprocessing submodule sends the preprocessed first RAW data to the enhancement submodule.
  • the first preprocessing submodule sends the preprocessed 4K60 SHDR data to the enhancement submodule.
  • the enhancement submodule performs fusion and noise reduction processing on the preprocessed first RAW data.
  • the specific implementation of performing fusion processing on the preprocessed first RAW data may include: inputting the preprocessed first RAW data into the second target model for processing, and outputting the fusion RAW data.
  • the second target model can perform fusion processing on arbitrary long-exposure data and short-exposure data.
  • the preprocessed first RAW data is 4K60 SHDR data
  • the 4K60 SHDR data is input into the second target model
  • the fused RAW data obtained after fusion processing is 4K30 data. That is to say, when the second target model performs fusion processing, it fuses the long-exposure data and short-exposure data obtained through two consecutive exposures in the same period of time, so the 60 frames of data before fusion become 30 frames. In this way, the signal-to-noise ratio and dynamic range of video data can be improved through fusion processing.
  • the second target model may be a pre-trained fusion network model.
  • the second target model may be obtained after training the second network model based on the exposure sample data.
  • the second network model may include, but is not limited to, HDRnet.
  • the implementation of denoising the fused RAW data may include: inputting the fused RAW data into a third object model corresponding to the main camera for processing, and outputting the noise-reduced video data.
  • the third target model can perform noise reduction processing on arbitrary video data.
  • the third target model may be a pre-trained denoising network model.
  • the third target model may be obtained after training the third network model based on the RAW sample data.
  • the third network model may include, but is not limited to, Unet.
  • the external ISP node preprocesses the first RAW data through the first preprocessing submodule.
  • the first RAW may also be directly sent to the enhancement submodule, by The enhancement sub-module performs fusion and noise reduction processing on the first RAW data.
  • the enhancement submodule outputs the video data after noise reduction processing, and the routing submodule outputs fifth RAW data.
  • the enhancement submodule sends the noise-reduced video data to the built-in ISP node, and the routing submodule also sends the fifth RAW data to the built-in ISP node.
  • the built-in ISP node receives the video data and the fifth RAW data through the second preprocessing submodule. It is not difficult to understand that the video data output by the enhancement sub-module is 4K30 data, which is used for browsing and recording; the fifth RAW data output by the routing sub-module is 4K60 data, which is used for calculating 3A and possible camera needs.
  • the external ISP node performs fusion and noise reduction processing on the first RAW data of the main camera, there is generally a gap between the video data output by the external ISP node and the first RAW data output by the main camera. There is a certain delay. For example, there is a delay of one frame. For example, if the main camera outputs the first RAW data at time t, the external ISP node outputs video data at time t-1 at the same time.
  • the external ISP node controls the synchronous output of the enhancement sub-module and the routing sub-module, that is, the noise-reduced video data and the fifth RAW data are synchronously transmitted to the second pre-processing sub-module.
  • the second preprocessing submodule processes the video data output by the enhancement submodule, and calculates the first exposure data based on the fifth RAW data, and adjusts the exposure parameters.
  • the processing of the video data output by the enhancement submodule by the second preprocessing submodule includes: performing preprocessing again on the video data output by the enhancement submodule, such as but not limited to LSC processing, BLC processing, At least one of BPC processing and color interpolation processing to further reduce the noise of the video data. Afterwards, RGB conversion is performed on the preprocessed video data again, and the video image obtained after the RGB conversion is compressed to obtain a YUV image.
  • preprocessing again on the video data output by the enhancement submodule such as but not limited to LSC processing, BLC processing, At least one of BPC processing and color interpolation processing to further reduce the noise of the video data.
  • RGB conversion is performed on the preprocessed video data again, and the video image obtained after the RGB conversion is compressed to obtain a YUV image.
  • the second preprocessing submodule described in the embodiment of the present application preprocess the video data output by the enhancement submodule again.
  • the second preprocessing submodule also The RGB conversion may be performed directly based on the video data output by the enhancement sub-module, which is not limited in this embodiment of the present application.
  • the second preprocessing sub-module determines the first exposure data based on the fifth RAW data, and determines whether the current exposure level is reasonable according to the first exposure data, and then adjusts the exposure parameters of the main camera if it is not reasonable.
  • the value range of the first exposure data is (0, 255).
  • the second preprocessing submodule compares the first exposure data with the exposure threshold, and if the difference between the first exposure data and the exposure threshold is greater than the threshold range, gradually adjusts the first Exposure data to obtain target exposure data.
  • the second preprocessing sub-module sends the target exposure data to the main camera, so that the main camera adjusts the exposure parameters of the image sensor.
  • the ultimate goal is to make the exposure data calculated according to the fifth RAW data output by the main camera close to or same.
  • the adjustment step size may be set according to actual requirements.
  • the exposure threshold can be set according to actual needs.
  • the threshold range can also be set according to actual needs.
  • the exposure threshold is 128, the threshold range is [0,5], and the adjustment step is 4. If the first exposure data is 86, it means that the exposure parameter needs to be increased. At this time, the first exposure data can be adjusted according to the adjustment step to obtain a target exposure data of 90.
  • the second preprocessing sub-module sends the target exposure data 90 to the main camera, so that the main camera adjusts the exposure parameter of the image sensor to 90.
  • the exposure data is again counted according to the fifth RAW data received next time, and the exposure parameters of the image sensor are adjusted according to the above method until the counted exposure data is close to or equal to 128.
  • the exposure changes of the video frames can be smoothly transitioned.
  • the second preprocessing submodule may also count the first AWB, the first AF and the first FOV based on the fifth RAW data.
  • the second preprocessing submodule sends the first AWB to the optimization processing submodule, so that the optimization processing submodule can perform white balance adjustment during image optimization processing.
  • the second preprocessing sub-module sends the first AF to the main camera, so that the main camera performs adjustment processing according to the first AF.
  • the first AWB, the first exposure data, the first AF, and the first FOV are used as the first imaging information, and the first imaging information may be used for subsequent parameter synchronization during camera switching.
  • the second preprocessing submodule sends the YUV image and target exposure data to the optimization processing submodule.
  • the target exposure data is determined according to the first exposure data. For example, if the first exposure data is 100, and the second preprocessing submodule determines that the exposure parameter of the main camera needs to be adjusted to 200, then the target exposure data is 200.
  • the second preprocessing submodule adjusts the exposure parameters of the main camera, the gain of the video data obtained through the main camera subsequently changes.
  • the YUV image obtained is reasonably de-noised.
  • the second pre-processing sub-module adjusts the exposure parameters of the main camera and sends the target exposure data to the optimization processing sub-module, which is convenient for the optimization processing sub-module to determine the noise reduction parameters.
  • the noise reduction parameter performs reasonable noise reduction processing on the next received YUV image.
  • the external ISP node includes multiple third target models corresponding to the main camera, each third target model in the multiple third target models corresponds to an exposure value range, and each third target The number of exposure value ranges corresponding to the model may be one or more.
  • the third target model can be used for noise reduction processing.
  • the second preprocessing sub-module can also send the target exposure data to external Set the ISP node so that the external ISP node can determine the exposure value range to which the target exposure data fed back by the second preprocessing sub-module belongs, so that according to the determined exposure value range, the corresponding third target model can be selected from multiple third target models.
  • the target model, the selected third target model is used for the next noise reduction process.
  • the optimization processing submodule performs image optimization processing based on the received data.
  • the optimization processing sub-module optimizes the YUV image according to the target exposure data, such as performing noise reduction processing on the YUV image, so as to obtain a clear and bright video frame.
  • the optimization processing submodule sends the obtained video frame to display.
  • the optimization processing sub-module sends the video frames obtained after the image optimization processing to the display screen for display.
  • the video data is fused and image enhanced through the external ISP, the processed video data is sent to the built-in ISP, and the original video data is provided for the built-in ISP.
  • the built-in ISP can generate clear video frames based on the video data provided by the external ISP, which reduces the operating burden of the built-in ISP, thereby reducing the power consumption of the SOC.
  • the electronic device processes the video data of the main camera according to the procedures of the above embodiments, and outputs high-definition video frames.
  • the electronic device detects a focusing operation, it performs the following operations:
  • the image sensor node starts the auxiliary camera according to the camera pre-start instruction.
  • the camera pre-start instruction is issued by the camera application program.
  • the camera application detects a focus operation, because in a possible situation, the focus operation may be adjusted to the field of view of the secondary camera, that is, it needs to switch from the primary camera to the secondary camera for shooting. Therefore, in order to avoid the stuck problem when the camera is switched, the camera application program sends a camera pre-start command to the video module before the camera switching condition is met, so as to notify the video module to start the auxiliary camera in advance.
  • the camera pre-start instruction carries a target camera identifier, and the target camera identifier is used to uniquely identify an auxiliary camera. After the video module receives the camera pre-start instruction, it can start the auxiliary camera through the image sensor node. The specific process of starting the auxiliary camera by the image sensor node can be referred to above, and will not be repeated here.
  • the camera switching condition may be determined according to the field of view angle of the main camera and/or the field of view angle of the auxiliary camera.
  • the camera switching condition may mean that the focus value corresponding to the focus operation exceeds the target focus value, and the field of view corresponding to the target focus value exceeds the field of view of the main camera but is smaller than the field of view of the auxiliary camera.
  • the secondary camera is activated.
  • the preset value can be set according to actual needs.
  • the auxiliary camera is a telephoto camera
  • the target focus value is 3x focus, that is, when the focus value corresponding to the focus operation reaches 3x focus, it will automatically switch from the main camera to the telephoto camera.
  • the preset value is 0.3, when the focus value corresponding to the focus operation reaches 2.7 times focus, the telephoto camera starts to be activated.
  • auxiliary cameras when there are multiple auxiliary cameras, since the field of view angles corresponding to different auxiliary cameras in the multiple auxiliary cameras are different, different auxiliary cameras correspond to a camera switching condition, or in other words, different auxiliary cameras correspond to a target Focus value.
  • the image sensor node acquires second RAW data.
  • the second RAW data is output through the image sensor of the auxiliary camera. That is, after the electronic device starts the auxiliary camera, the auxiliary camera starts to collect video data, and the image sensing node obtains the video data collected by the auxiliary camera to obtain the second RAW data.
  • the second RAW data may be SHDR data, and in another example, the second RAW data may also be SDR data.
  • the second RAW data includes long exposure data and short exposure data. That is to say, the image sensor of the auxiliary camera can expose twice in each exposure time period, one long exposure and one short exposure, for example, a CMOS image sensor can be used to expose twice in the same time period. In this way, the long-exposure data and the short-exposure data in the same time period can be fused subsequently to output high dynamic video frames.
  • the second RAW data as 4K60 SHDR data as an example
  • the auxiliary camera exposes twice in every 33ms, so as to obtain video data of 60 frames per second.
  • the second RAW data may also be 4K30 video data, that is, the secondary camera exposes once in each exposure time period, and outputs video data at 30 frames per second. In this case, subsequent fusion processing is not required.
  • step 701 the electronic device still continues to execute the above step 701 to step 711 .
  • the image sensor node sends the second RAW data to the external ISP node.
  • the external ISP node replicates the second RAW data.
  • the external ISP node copies the second RAW data through the routing sub-module to obtain the sixth RAW data, and the sixth RAW data is used to count the current exposure data of the secondary camera and other information.
  • the external ISP node performs resolution reduction processing and frame rate reduction processing on the second RAW data to obtain fourth RAW data.
  • the external ISP node transmits the second RAW data to the first preprocessing submodule, and the first preprocessing submodule performs resolution reduction and frame rate reduction processing on the second RAW data, thereby obtaining Fourth RAW data with small resolution and low frame rate.
  • the first preprocessing submodule may perform resolution reduction processing on the second RAW data according to a first preset ratio, and then perform frame reduction processing on the second RAW data after resolution reduction processing according to a second preset ratio rate processing.
  • the first preset ratio and the second preset ratio can be set according to actual needs.
  • the external ISP node performs pre-noise reduction processing based on the fourth RAW data.
  • the first preprocessing submodule in the external ISP node sends the fourth RAW data to the enhancement submodule.
  • the enhancement sub-module performs fusion processing on the fourth RAW data, for example, through the fusion of the second target model, and outputs a small-resolution, low-frame-rate Fusion data.
  • the enhancement sub-module performs noise reduction processing based on the obtained fusion data with small resolution and low frame rate. Fusion data for pre-noise reduction.
  • pre-noise reduction processing based on the video data collected by the auxiliary camera before switching can make the noise reduction effect of the first object model closer to that of the third object model, so that after subsequent switching The image difference between the video frame after the noise reduction processing of the first target model and the output video frame before switching is small.
  • the first target model may be a pre-trained denoising network model.
  • the first target model may be obtained after training the first network model based on RAW sample data.
  • the first network model may include but not limited to Unet.
  • the first preprocessing submodule before the first preprocessing submodule sends the fourth RAW data to the enhancement submodule, it can also preprocess the fourth RAW data.
  • the preprocessing can include but not limited to LSC processing, BLC processing, At least one of BPC processing and color interpolation processing.
  • the first preprocessing submodule may also perform preprocessing on the second RAW data before performing processing on the second RAW data to reduce resolution and frame rate. The embodiment of the present application does not limit the timing of preprocessing.
  • the external ISP node outputs the sixth RAW data to the internal ISP node.
  • the built-in ISP node receives the sixth RAW data through the second preprocessing submodule.
  • the timing for the routing submodule to output the sixth RAW data may occur after the copy operation, that is, there is no strict execution sequence between step 807 and step 804 .
  • the built-in ISP node collects statistics on the second camera information based on the sixth RAW data.
  • the second imaging information includes second exposure data, second AF, second AWB and second FOV.
  • the built-in ISP node collects statistics of the second camera information based on the sixth RAW data through the second preprocessing submodule.
  • the built-in ISP node adjusts the second camera information based on the first camera information.
  • the ISP node adjusts each parameter in the second camera information to be the same as or close to the corresponding parameter in the first camera information through the second preprocessing submodule, so as to perform information synchronization. For example, information synchronization between the first exposure data and the second exposure data, information synchronization between the first AF and the second AF, information synchronization between the first AWB and the second AWB, and information synchronization between the first FOV and the second FOV Information synchronization.
  • the built-in ISP node adjusts parameters of the auxiliary camera based on the adjusted second camera information.
  • the built-in ISP node sends the adjusted second camera information to the auxiliary camera through the second preprocessing submodule, and instructs the auxiliary camera to adjust parameters according to the second camera information.
  • the external ISP node processes the third RAW data output by the auxiliary camera whose parameters have been synchronized as foreground data.
  • the external ISP node when the camera application detects that the focus operation meets the camera switching condition, for example, when the focus value corresponding to the focus operation reaches the target focus value, the external ISP node is notified.
  • the external ISP node processes the third RAW data output by the auxiliary camera according to the execution manner of steps 701 to 711 above, that is, processes the third RAW data output by the auxiliary camera as foreground data at this time.
  • the external ISP node sends the third RAW data to the first pre-processing sub-module through the routing sub-module for pre-processing, and then the first pre-processing
  • the sub-module sends the preprocessed third RAW data to the enhancement sub-module for fusion processing, and inputs the RAW data obtained after fusion processing to the first target model for noise reduction processing.
  • the routing submodule copies the third RAW data.
  • the external ISP node sends the processed video data to the built-in ISP node.
  • the external ISP node outputs the noise-reduced video data to the built-in ISP, and outputs the RAW data copied from the third RAW to the built-in ISP node.
  • the built-in ISP node processes the received video data through the second preprocessing submodule according to the processing method for the first RAW data, and outputs video frames with higher definition after optimized processing by the optimization processing submodule.
  • the main camera after switching from the main camera to the auxiliary camera, the main camera may be controlled to be powered off. In another possible implementation manner, after switching from the main camera to the auxiliary camera, the main camera may also be controlled to be in a power-on state. In yet another possible implementation, after switching from the main camera to the auxiliary camera, the main camera can also be controlled to be in the power-on state within a certain duration threshold, if the auxiliary camera is not switched back to the main camera within the duration threshold, then Control the power off of the main camera. Wherein, the duration threshold may be set according to actual requirements.
  • the external ISP stores a plurality of first object models corresponding to the auxiliary camera, and each first object model in the plurality of first object models corresponds to an exposure value range.
  • the second preprocessing sub-module of the built-in ISP synchronously processes the second exposure data, it feeds back the synchronized second exposure data to the external ISP.
  • the external ISP determines the exposure value range to which the synchronized second exposure data belongs, and then selects the first target model corresponding to the determined exposure value range from a plurality of first target models, and the selected first target model is used for for the next pre-noise reduction process.
  • the camera to be started is started in advance, compared with direct switching, it can avoid the jamming problem caused by the spatial position difference between the cameras.
  • the auxiliary camera after starting, synchronize the parameters of the auxiliary camera with the main camera, so that after switching, the picture effect of the video frame captured by the secondary camera is close to the picture effect of the video frame collected by the main camera, avoiding the large difference in the video picture before and after switching problem, achieved smooth switching between cameras.
  • the hardware involved in this embodiment of the present application mainly includes multiple cameras (for example, including a main camera and a secondary camera), a SOC, an external ISP, and a built-in ISP.
  • the external ISP includes multiple interfaces, a routing unit, a first external ISP front-end unit, a second external ISP front-end unit, and an external ISP back-end unit.
  • the routing unit is connected to the first external ISP front-end unit and the second external The ISP front-end unit is connected, the first external ISP front-end unit is connected with the external ISP back-end unit, and the second external ISP front-end unit is connected with the external ISP back-end unit.
  • the routing unit is used to perform the function of the routing submodule in each of the above-mentioned embodiments
  • the first external ISP front-end unit and the second external ISP front-end unit are used to perform the function of the first preprocessing sub-module in the above-mentioned various embodiments
  • the external The ISP back-end unit is used to implement the functions of the enhanced sub-modules in each of the above embodiments.
  • the first external ISP front-end unit is IFE0 in the external ISP
  • the second external ISP front-end unit is IFE1 in the external ISP
  • the external ISP back-end unit is an NPU in the external ISP.
  • the built-in ISP includes a first built-in ISP front-end unit, a second built-in ISP front-end unit, a third built-in ISP front-end unit and a built-in ISP back-end unit.
  • the first built-in ISP front-end unit is connected to the built-in ISP back-end unit
  • the second built-in ISP front-end unit is connected to the built-in ISP back-end unit.
  • the first built-in ISP front-end unit, the second built-in ISP front-end unit and the third built-in ISP front-end unit are used to execute the function of the second preprocessing submodule in each of the above-mentioned embodiments, and the built-in ISP back-end unit is used to execute the above-mentioned each embodiment Optimize the function of processing submodules in .
  • the first built-in ISP front-end unit is IFE0 in the built-in ISP
  • the second built-in ISP front-end unit is IFE1 in the built-in ISP
  • the third built-in ISP front-end unit is IFE2 in the built-in ISP
  • the built-in ISP back-end unit is Built-in IPE in ISP.
  • the foregoing is only an exemplary illustration of the multiple units included in the external ISP and the internal ISP, but does not constitute a limitation to the structural components thereof.
  • the external ISP or the internal ISP may further include other units, which is not limited in this embodiment of the present application.
  • the external ISP receives the first RAW data.
  • the first RAW data is from a main camera of the electronic device, specifically, an image sensor of the main camera outputs the first RAW data to an external ISP.
  • the external ISP receives the first RAW data from the main camera through a mobile industry processor interface (mobile industry processor interface, Mipi)0.
  • a mobile industry processor interface mobile industry processor interface, Mipi0.
  • the external ISP copies and routes the first RAW data through the routing unit.
  • the external ISP first copies the first RAW data through the routing unit to obtain the fifth RAW data.
  • the routing unit performs routing processing on the two sets of RAW data.
  • the first RAW data is transmitted to the first external ISP front-end unit, and the first external ISP front-end unit performs preprocessing based on the first RAW data.
  • the external ISP back-end unit outputs the video data after noise reduction processing, and outputs the fifth RAW data through the routing unit.
  • the external ISP back-end unit sends the noise-reduced video data to the built-in ISP through the Mipi0 interface of the external ISP, and the routing unit sends the fifth RAW data to the built-in ISP through the Mipi1 interface of the external ISP.
  • the external ISP processes the first RAW data of the main camera through the first branch 1 .
  • the built-in ISP receives the video data output by the external ISP back-end unit, and the fifth RAW data output by the routing unit.
  • the built-in ISP receives the video data output by the external ISP back-end unit through the first built-in ISP front-end unit, and then the first built-in ISP front-end unit processes the video data, such as preprocessing again, and then performing RGB Convert and compress the converted RGB image to obtain a YUV image. Then transmit the YUV image to the built-in ISP back-end unit for processing.
  • the built-in ISP receives the fifth RAW data output by the routing unit through the second built-in ISP front-end unit. After that, the second built-in ISP front-end unit determines the first exposure data based on the fifth RAW data, and determines whether the current exposure level is reasonable according to the first exposure data, and if not, determines the target exposure data, and adjusts the camera according to the target exposure data exposure parameters. In one example, the second built-in ISP front-end unit adjusts the exposure data of the camera through the I2C interface.
  • the second built-in ISP front-end unit also counts AWB, color and other data based on the fifth RAW data.
  • the second built-in ISP front-end unit transmits data such as 3A, color, etc. to the built-in ISP back-end unit, so that the built-in ISP back-end unit can optimize the YUV image according to the data transmitted by the second built-in ISP front-end unit, such as denoising the YUV image processing, so as to obtain a clear and clear video frame.
  • the second built-in ISP front-end unit can also send the target exposure data to the external ISP through the peripheral interface, for example, to the external ISP back-end unit, so that the external ISP back-end unit can use the target exposure data from A third target model is selected from a plurality of third target models used for noise reduction processing, so that next video data is subjected to noise reduction processing according to the selected third target model.
  • the peripheral interface may be a secure digital input and output (secure digital input and output, SDIO) interface.
  • the second built-in ISP front-end unit determines the first AF, the first AWB, and the first FOV based on the fifth RAW data, so as to obtain the first imaging information.
  • the second built-in ISP front-end unit determines the first AF, the first AWB, and the first FOV based on the fifth RAW data, so as to obtain the first imaging information.
  • the built-in ISP outputs optimized video frames through the built-in ISP back-end unit, and displays the video frames on the display screen.
  • the electronic device outputs the video frames of the main camera according to the above process.
  • the user adjusts the focus, perform the following switching operations:
  • the auxiliary camera is activated. Afterwards, the electronic device collects video data through the auxiliary camera to obtain second RAW data.
  • the auxiliary camera starts to collect video data to obtain the second RAW data.
  • the video data of the main camera is still output, that is, the second RAW data collected by the auxiliary camera is not output.
  • the processing process of the second RAW data please refer to the following steps.
  • the external ISP receives the second RAW data.
  • the external ISP receives the second RAW data through the Mipi1 interface.
  • the external ISP copies and routes the second RAW data through the routing unit.
  • the routing unit copies the second RAW data to obtain sixth RAW data.
  • the routing unit sends the second RAW data to the second external ISP front-end unit, and sends the sixth RAW data to the built-in ISP through the Mipi2 interface.
  • the external ISP performs resolution reduction and frame rate reduction processing on the second RAW data through the second external ISP front-end unit to obtain fourth RAW data.
  • the second external ISP front-end unit before the second external ISP front-end unit reduces the resolution and frame rate of the second RAW data, it may also perform preprocessing on the second RAW data, which is not limited in this embodiment of the present application.
  • the second external ISP front-end unit sends the fourth RAW data to the external ISP back-end unit.
  • the external ISP back-end unit performs pre-noise reduction processing based on the fourth RAW data.
  • the second RAW data of the auxiliary camera is processed through the second branch 2 .
  • the built-in ISP receives sixth RAW data through the third built-in ISP front-end unit.
  • the third built-in ISP front-end unit determines second camera information based on the sixth RAW data.
  • the third built-in ISP front-end unit performs information synchronization on the first camera information and the second camera information.
  • the third built-in ISP front-end unit obtains the first camera information from the second built-in ISP front-end unit of the built-in ISP, and then adjusts the second camera information according to the first camera information, so as to combine the second camera information with the Information synchronization is performed on the first camera information.
  • the built-in ISP controls the secondary camera to adjust parameters according to the synchronized second camera information.
  • the third built-in ISP front-end unit controls the camera through the I2C interface to adjust parameters according to the synchronized second camera information.
  • the built-in ISP synchronously processes the second exposure data, and feeds back the synchronized second exposure data to the external ISP, for example , can be fed back to the external ISP back-end unit.
  • the external ISP back-end unit determines the exposure value range to which the synchronized second exposure data belongs, and then selects the first target model corresponding to the determined exposure value range from a plurality of first target models, and the selected first The target model is used for the next pre-noise reduction processing on the video data collected by the auxiliary camera.
  • the external ISP uses the third RAW data as data to be output.
  • the third RAW data is RAW data output by the secondary camera after parameter synchronization.
  • the external ISP copies the third RAW data through the routing unit.
  • the routing unit sends the third RAW data to the first external ISP front-end unit, which is preprocessed by the first external ISP front-end unit, and then sent to the external ISP back-end unit, which is fused by the external ISP back-end unit
  • noise reduction processing the video data after noise reduction processing is output to the built-in ISP through the Mipi0 interface for subsequent optimization processing.
  • the external ISP sends the RAW data copied from the third RAW data to the built-in ISP through the routing unit, and the front-end unit of the third built-in ISP in the built-in ISP determines the exposure data.
  • the external ISP processes the third RAW data of the secondary camera through the first branch 1 .
  • the present application provides a camera switching method according to another embodiment, and the method may be applied to the above-mentioned electronic device, where the electronic device includes at least a first camera and a second camera.
  • the electronic device includes a first image signal processing module and a second image signal processing module, for example, the second image signal processing module is an ISP integrated in the SOC (abbreviation: built-in ISP), and the first image signal processing module includes The ISP outside the SOC (referred to as: external ISP).
  • the method may include the following implementation steps:
  • Step 1001 Output video frames according to the first RAW data of the first camera, where the first RAW data is original video data.
  • the first camera may be the main camera. In another example, the first camera may also be an auxiliary camera.
  • step 1001 may include: the image sensor of the first camera outputs first RAW data, and the first image signal processing module acquires the first RAW data.
  • the first image signal processing module copies the first RAW data to obtain fifth RAW data.
  • the first image signal processing module performs image enhancement processing on the first RAW data to obtain video enhancement data.
  • the first image signal processing module sends the video enhancement data and the fifth RAW data to the second image signal processing module.
  • the second image signal processing module outputs video frames based on the video enhancement data and the fifth RAW data.
  • the specific implementation of outputting the first RAW data by the image sensor of the first camera may include: detecting a night scene video shooting instruction through the camera application in the electronic device, and the night scene video shooting instruction is used to indicate that in the night scene mode Make a video recording.
  • the image sensor outputs first RAW data.
  • the first RAW data includes long exposure data and short exposure data collected in the same time period
  • the first image signal processing module performs image enhancement processing on the first RAW data, including: the first image signal processing module
  • the long-exposure data and short-exposure data are fused to obtain fused RAW data.
  • the first image signal processing module performs noise reduction processing on the fused RAW data to obtain video enhancement data.
  • the first image signal processing module fuses the long exposure data and the short exposure data, including: the first image signal processing module inputs the long exposure data and the short exposure data into the second target model, and the The second target model performs fusion processing, and the second target model can perform fusion processing on arbitrary long exposure data and short exposure data.
  • the first image signal processing module performs noise reduction processing on the fused RAW data, including: the first image signal processing module inputs the fused RAW data into the third target model corresponding to the first camera, and the third The target model performs noise reduction processing, and the third target model can perform noise reduction processing on arbitrary RAW data.
  • the first image signal processing module includes multiple third target models corresponding to the first camera, and each third target model in the multiple third target models corresponds to an exposure value range.
  • the first image signal processing module receives target exposure data, the target exposure data is determined by the second image signal processing module based on the first exposure data, and the first exposure data is determined by the second image signal processing module based on the fifth
  • the RAW data is obtained through exposure data statistics, and the target exposure data is used to adjust the exposure parameters of the first camera.
  • the first image signal processing module selects a third target model from a plurality of third target models according to the target exposure data and the exposure value range corresponding to each third target model, and the selected third target model is used for noise reduction processing .
  • the second image signal processing module performs format conversion processing on the video enhancement data to obtain a YUV image.
  • the specific implementation may include: the second image signal processing module determines the target data based on the fifth RAW data, and the target data uses Used to adjust the image quality of YUV images.
  • the second image signal processing module adjusts the YUV image based on the target data, and outputs the adjusted YUV image as a video frame.
  • Step 1002 During the process of video frame output, if a focus operation is detected, start the second camera before the camera switching condition is not met.
  • Step 1003 according to the first RAW data and the second RAW data of the second camera, synchronize the parameters of the second camera with the first camera.
  • the second camera can be a secondary camera. In another example, the second camera can also be the main camera. The second camera is different from the first camera.
  • step 1003 may include: determining first imaging information according to the first RAW data. Based on the second RAW data, second imaging information is determined. According to the first imaging information, the second imaging information is adjusted to synchronize the second imaging information with the first imaging information. According to the adjusted second camera information, the parameters of the second camera are adjusted, so as to synchronize the parameters of the second camera with the first camera.
  • the first imaging information includes the first exposure data, the first autofocus AF, the first automatic white balance AWB, and the first field of view FOV
  • the second imaging information includes the second exposure data, the second AF, the second AWB, second FOV.
  • the electronic device may also perform pre-noise reduction processing on the first target model corresponding to the second camera based on the second RAW data.
  • the first target model can perform noise reduction processing based on arbitrary RAW data.
  • the noise-processed first target model is used to perform noise reduction processing on the third RAW data after the focusing operation meets the camera switching condition.
  • the specific implementation of performing pre-noise reduction processing through the first target model corresponding to the second camera may include: performing resolution reduction processing on the second RAW data according to a first preset ratio , and perform frame rate reduction processing on the second RAW data after the resolution reduction processing according to the second preset ratio to obtain the fourth RAW data, and input the fourth RAW data into the first target model, so that the first target model Perform pre-noise reduction processing.
  • Both the first preset ratio and the second preset ratio can be set according to actual needs.
  • the second RAW data may be subjected to frame rate reduction processing according to the second preset ratio, and then the resolution processing may be performed on the second RAW data after the frame rate reduction processing according to the first preset ratio.
  • Step 1004 when the focusing operation satisfies the camera switching condition, output the video frame according to the third RAW data, the third RAW data is the raw video data of the second camera whose parameters have been synchronized.
  • the video frame output is performed according to the first RAW data of the first camera.
  • the second camera is started before the camera switching condition is met.
  • the parameters of the second camera are synchronized with the first camera.
  • video frame output is performed according to the third RAW data, and the third RAW data is the raw video data of the second camera whose parameters have been synchronized.
  • the difference between the video picture of the second camera and the video picture of the first camera after switching can be small, that is, to solve It solves the problem of large difference in video images before and after switching, thus realizing smooth switching between cameras.
  • the disclosed devices and methods may be implemented in other ways.
  • the system embodiments described above are only illustrative.
  • the division of the modules or units is only a logical function division.
  • multiple units or components can be Incorporation may either be integrated into another system, or some features may be omitted, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
  • the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the procedures in the methods of the above embodiments in the present application can be completed by instructing related hardware through computer programs, and the computer programs can be stored in a computer-readable storage medium.
  • the computer program When executed by a processor, the steps in the above-mentioned various method embodiments can be realized.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form.
  • the computer readable medium may include at least: any entity or means capable of carrying computer program codes to electronic equipment, recording media, computer memory, ROM, RAM, electrical carrier signals, telecommunication signals, and software distribution media. Such as U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunication signals under legislation and patent practice.

Abstract

The present application relates to the technical field of terminals, and provides a camera switching method and apparatus, and an electronic device and a storage medium. The method comprises: performing video frame output according to first raw data of a first camera, and in the video frame output process, if a focusing operation is detected, starting a second camera before a camera switching condition is satisfied; and according to the first raw data and second raw data of the second camera, performing parameter synchronization on the second camera and the first camera, and when the focusing operation satisfies the camera switching condition, performing video frame output according to third raw data, the third raw data being raw video data of the second camera subjected to parameter synchronization. A camera to be started is started in advance, and parameter synchronization is performed after the camera is started, such that a picture effect after switching is close to a picture effect before switching, thereby avoiding the problem of a large video picture difference before and after switching and achieving smooth switching between cameras.

Description

摄像头的切换方法、装置、电子设备及存储介质Camera switching method, device, electronic equipment and storage medium
本申请要求于2021年11月5日提交到国家知识产权局、申请号为202111310300.6、申请名称为“摄像头的切换方法、装置、电子设备及存储介质”的中国专利申请的优先权,以及要求于2022年3月10日提交到国家知识产权局、申请号为202210248963.8、申请名称为“摄像头的切换方法、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application submitted to the State Intellectual Property Office on November 5, 2021, with the application number 202111310300.6, and the application name is "Camera Switching Method, Device, Electronic Equipment, and Storage Medium", and claims to be filed in The priority of a Chinese patent application filed with the State Intellectual Property Office on March 10, 2022, with application number 202210248963.8 and titled "Camera switching method, electronic device, and storage medium", the entire contents of which are incorporated by reference in this application middle.
技术领域technical field
本申请涉及终端技术领域,尤其涉及一种摄像头的切换方法、电子设备及存储介质。The present application relates to the technical field of terminals, and in particular to a camera switching method, electronic equipment, and a storage medium.
背景技术Background technique
随着终端技术的快速发展,诸如手机之类的电子设备的拍摄能力逐渐提高。一些电子设备配置有多个摄像头,多个摄像头中的不同摄像头具有不同的拍摄能力。譬如不同摄像头的视场角不同,电子设备通过不同摄像头可以采集不同视场角的视频数据。With the rapid development of terminal technology, the shooting capabilities of electronic devices such as mobile phones are gradually improving. Some electronic devices are configured with multiple cameras, and different cameras in the multiple cameras have different shooting capabilities. For example, different cameras have different viewing angles, and the electronic device can collect video data with different viewing angles through different cameras.
通常情况下,多个摄像头包括主摄像头和辅摄像头,在通过摄像头录制视频的过程中,若检测到用户的调焦操作,主摄像头与辅摄像头之间可能需要切换。譬如,在默认情况下,相机应用启动后,电子设备通过主摄像头拍摄视频。若检测到调焦操作且调焦值超出主摄像头的视场角范围,电子设备从主摄像头切换至辅摄像头,之后,电子设备通过辅摄像头拍摄视频。Usually, multiple cameras include a primary camera and a secondary camera. During video recording through the cameras, if a user's focus operation is detected, the primary camera and the secondary camera may need to be switched. For example, by default, after the camera application is launched, the electronic device shoots video through the main camera. If a focus adjustment operation is detected and the focus adjustment value exceeds the field of view range of the main camera, the electronic device switches from the main camera to the auxiliary camera, and then the electronic device shoots a video through the auxiliary camera.
然而变焦时,在从一个摄像头切换至另一个摄像头的情况下,由于两个摄像头之间存在性能差异,所以可能导致切换前后视频画面有较大差异。However, when zooming, in the case of switching from one camera to another, due to the performance difference between the two cameras, there may be a large difference in the video picture before and after the switch.
发明内容Contents of the invention
本申请提供了一种摄像头的切换方法、装置、电子设备及存储介质,解决了现有技术中从一个摄像头切换至另一个摄像头时存在切换前后视频画面有较大差异的问题。The present application provides a camera switching method, device, electronic equipment and storage medium, which solves the problem in the prior art that there is a large difference in video images before and after switching when switching from one camera to another.
为达到上述目的,本申请采用如下技术方案:In order to achieve the above object, the application adopts the following technical solutions:
第一方面,提供一种摄像头的切换方法,所述电子设备包括第一摄像头和第二摄像头,所述方法包括:In a first aspect, a camera switching method is provided, the electronic device includes a first camera and a second camera, and the method includes:
根据所述第一摄像头的第一原始数据进行视频帧输出;performing video frame output according to the first raw data of the first camera;
在视频帧输出的过程中,若检测到调焦操作,则在未满足摄像头切换条件之前,启动所述第二摄像头;In the process of video frame output, if a focusing operation is detected, before the camera switching condition is not met, start the second camera;
根据所述第一原始数据、所述第二摄像头的第二原始数据,将所述第二摄像头与所述第一摄像头进行参数同步;Synchronize parameters of the second camera with the first camera according to the first raw data and the second raw data of the second camera;
当所述调焦操作满足所述摄像头切换条件时,根据第三原始数据进行视频帧输出,所述第三原始数据是经参数同步后的所述第二摄像头的原始视频数据。When the focusing operation satisfies the camera switching condition, the video frame output is performed according to the third original data, and the third original data is the original video data of the second camera whose parameters are synchronized.
如此,通过提前启动第二摄像头,并在启动后将第二摄像头与第一摄像头进行参数同步,可以使得切换后第二摄像头的视频画面与第一摄像头的视频画面差异较小, 也即,解决了切换前后视频画面差异较大的问题,从而实现了摄像头之间的平滑切换。In this way, by starting the second camera in advance and synchronizing the parameters of the second camera with the first camera after starting, the difference between the video picture of the second camera and the video picture of the first camera after switching can be small, that is, to solve It solves the problem of large difference in video images before and after switching, thus realizing smooth switching between cameras.
作为本申请的一个示例,所述根据所述第一原始数据、所述第二摄像头的第二原始数据,将所述第二摄像头与所述第一摄像头进行参数同步,包括:As an example of the present application, the parameter synchronization of the second camera and the first camera according to the first raw data and the second raw data of the second camera includes:
根据所述第一原始数据,确定第一摄像信息;determining first imaging information according to the first raw data;
根据所述第二原始数据,确定第二摄像信息;determining second imaging information according to the second raw data;
根据所述第一摄像信息,调整所述第二摄像信息,以将所述第二摄像信息与所述第一摄像信息同步;adjusting the second imaging information according to the first imaging information to synchronize the second imaging information with the first imaging information;
根据调整后的所述第二摄像信息,对所述第二摄像头进行参数调整,以将所述第二摄像头与所述第一摄像头进行参数同步。According to the adjusted second camera information, the parameters of the second camera are adjusted, so as to synchronize the parameters of the second camera with the first camera.
如此,通过将第一摄像信息和第二摄像信息同步使得第一摄像头和第二摄像头参数同步,从而便于后续使得切换后的视频画面与切换前的视频画面差异较小。In this way, by synchronizing the first camera information with the second camera information, the parameters of the first camera and the second camera are synchronized, so that the difference between the video picture after switching and the video picture before switching is small.
作为本申请的一个示例,所述第一摄像信息包括第一曝光数据、第一自动对焦AF、第一自动白平衡AWB、第一视场角FOV,所述第二摄像信息包括第二曝光数据、第二AF、第二AWB、第二FOV。As an example of the present application, the first imaging information includes first exposure data, first autofocus AF, first automatic white balance AWB, and first field of view FOV, and the second imaging information includes second exposure data , 2nd AF, 2nd AWB, 2nd FOV.
如此,在进行摄像头参数同步时,通过将曝光数据、AF、AWB、FOV参数进行同步调整,也即从影响视频画面效果的多个指标进行考虑,从而使得切换前后的视频画面的视觉差异尽可能的小。In this way, when synchronizing camera parameters, the exposure data, AF, AWB, and FOV parameters are adjusted synchronously, that is, multiple indicators that affect the effect of the video image are considered, so that the visual difference of the video image before and after switching is as much as possible small.
作为本申请的一个示例,所述方法还包括:As an example of the present application, the method also includes:
基于所述第二原始数据,通过所述第二摄像头对应的第一目标模型进行预降噪处理,所述第一目标模型能够基于任意的原始数据进行降噪处理,预降噪处理后的所述第一目标模型用于在所述调焦操作满足所述摄像头切换条件后对所述第三原始数据进行降噪处理。Based on the second raw data, pre-noise reduction processing is performed through the first target model corresponding to the second camera, the first target model can perform noise reduction processing based on any raw data, and all pre-noise reduction processing The first target model is used to perform noise reduction processing on the third raw data after the focusing operation satisfies the camera switching condition.
如此,在切换前基于第二原始数据进行预降噪处理,可以使得第一目标模型的降噪效果与第三目标模型的降噪效果较接近,从而使得后续切换后经过第一目标模型降噪处理后的视频帧与切换前输出的视频帧的画面差异较小。In this way, pre-noise reduction processing based on the second original data before switching can make the noise reduction effect of the first target model closer to the noise reduction effect of the third target model, so that after subsequent switching, the noise reduction effect of the first target model The image difference between the processed video frame and the output video frame before switching is small.
作为本申请的一个示例,所述基于所述第二原始数据,通过所述第二摄像头对应的第一目标模型进行预降噪处理,包括:As an example of the present application, the pre-noise reduction processing is performed through the first target model corresponding to the second camera based on the second raw data, including:
按照第一预设比例对所述第二原始数据进行降分辨率处理,以及按照第二预设比例对降分辨率处理后的所述第二原始数据进行降帧率处理,得到第四原始数据;Performing resolution reduction processing on the second original data according to a first preset ratio, and performing frame rate reduction processing on the second original data after resolution reduction processing according to a second preset ratio, to obtain fourth original data ;
将所述第四原始数据输入至所述第一目标模型中,以对所述第一目标模型进行预降噪处理。The fourth original data is input into the first object model to perform pre-noise reduction processing on the first object model.
如此,通过对第二原始数据进行降分辨率处理和降帧率处理,输出小分辨率、低帧率的第四原始数据,然后基于第四原始数据进行预降噪处理,可以提高第一目标模型的运行效率。In this way, by performing resolution reduction processing and frame rate reduction processing on the second original data, outputting the fourth original data with small resolution and low frame rate, and then performing pre-noise reduction processing based on the fourth original data, the first objective can be improved. model performance.
作为本申请的一个示例,所述在视频帧输出的过程中,若检测到调焦操作,则在未满足摄像头切换条件之前,启动所述第二摄像头,包括:As an example of the present application, in the process of video frame output, if a focusing operation is detected, before the camera switching condition is not met, starting the second camera includes:
在视频帧输出的过程中,若检测到调焦操作,则在未达到所述摄像头切换条件之前,当所述调焦操作对应的调焦值与所述摄像头切换条件对应的目标调焦值之间的差值小于或等于预设数值时,启动所述第二摄像头。In the process of video frame output, if a focusing operation is detected, before the camera switch condition is reached, when the focus value corresponding to the focus operation is between the target focus value corresponding to the camera switch condition When the difference between them is less than or equal to the preset value, start the second camera.
若调焦操作对应的调焦值与摄像头切换条件对应的目标调焦值之间的差值小于或等于预设数值,说明用户可能大概率会调焦至满足摄像头切换条件,因此可以启动第二摄像头,可以提高启动第二摄像头的及时性和有效性。If the difference between the focus value corresponding to the focus operation and the target focus value corresponding to the camera switching condition is less than or equal to the preset value, it means that the user may focus to meet the camera switching condition with a high probability, so the second camera, which can improve the timeliness and effectiveness of starting the second camera.
作为本申请的一个示例,所述电子设备包括第一图像信号处理模块以及第二图像信号处理模块;As an example of the present application, the electronic device includes a first image signal processing module and a second image signal processing module;
所述根据所述第一摄像头的第一原始数据进行视频帧输出,包括:The video frame output according to the first raw data of the first camera includes:
所述第一摄像头的图像感应器输出所述第一原始数据;The image sensor of the first camera outputs the first raw data;
所述第一图像信号处理模块获取所述第一原始数据;The first image signal processing module acquires the first raw data;
所述第一图像信号处理模块复制所述第一原始数据,得到第五原始数据;The first image signal processing module copies the first original data to obtain fifth original data;
所述第一图像信号处理模块对所述第一原始数据进行图像增强处理,得到视频增强数据;The first image signal processing module performs image enhancement processing on the first raw data to obtain video enhancement data;
所述第一图像信号处理模块将所述视频增强数据以及所述第五原始数据发送给所述第二图像信号处理模块;The first image signal processing module sends the video enhancement data and the fifth original data to the second image signal processing module;
所述第二图像信号处理模块基于所述视频增强数据和所述第五原始数据进行视频帧输出。The second image signal processing module outputs video frames based on the video enhancement data and the fifth original data.
如此,通过第一图像信号处理模块进行图像增强处理,且第一图像信号处理模块为第二图像信号处理模块还提供了可以用于调整曝光参数的第五原始数据,如此可以使得第二图像信号处理模块能够确定清晰的视频帧,解决了第二图像信号处理模块无法采用类似拍照的复杂多帧类增强处理算法导致视频画面的显示效果往往明显差于拍摄图像的问题。In this way, image enhancement processing is performed by the first image signal processing module, and the first image signal processing module also provides the second image signal processing module with fifth raw data that can be used to adjust exposure parameters, so that the second image signal can The processing module can determine a clear video frame, which solves the problem that the second image signal processing module cannot adopt a complex multi-frame enhancement processing algorithm similar to taking pictures, so that the display effect of the video picture is often significantly worse than that of the captured image.
作为本申请的一个示例,所述第一原始数据包括同一时间段内采集的长曝光数据和短曝光数据,所述第一图像信号处理模块对所述第一原始数据进行图像增强处理,包括:As an example of the present application, the first raw data includes long exposure data and short exposure data collected in the same time period, and the first image signal processing module performs image enhancement processing on the first raw data, including:
所述第一图像信号处理模块将所述长曝光数据和所述短曝光数据进行融合处理,得到融合原始数据;The first image signal processing module fuses the long exposure data and the short exposure data to obtain fused original data;
所述第一图像信号处理模块对所述融合原始数据进行降噪处理,得到所述视频增强数据。The first image signal processing module performs noise reduction processing on the fused original data to obtain the enhanced video data.
如此,可以使得后续将同一时间段内的长曝光数据和短曝光数据进行融合后输出高动态视频帧。In this way, the long-exposure data and the short-exposure data within the same time period can be fused subsequently to output high dynamic video frames.
作为本申请的一个示例,所述第一图像信号处理模块将所述长曝光数据和所述短曝光数据进行融合处理,包括:As an example of the present application, the first image signal processing module fuses the long exposure data and the short exposure data, including:
所述第一图像信号处理模块将所述长曝光数据和所述短曝光数据输入至第二目标模型中,由所述第二目标模型进行融合处理,所述第二目标模型能够对任意的长曝光数据和短曝光数据进行融合处理。如此,通过第二目标模型进行融合处理,可以提高融合效率。The first image signal processing module inputs the long-exposure data and the short-exposure data into a second object model, and performs fusion processing by the second object model, and the second object model can Exposure data and short exposure data are fused. In this way, the fusion process can be improved by using the second target model.
作为本申请的一个示例,所述第一图像信号处理模块对所述融合原始数据进行降噪处理,包括:As an example of the present application, the first image signal processing module performs noise reduction processing on the fused raw data, including:
所述第一图像信号处理模块将所述融合原始数据输入至所述第一摄像头对应的第三目标模型中,由所述第三目标模型进行降噪处理,所述第三目标模型能够对任意的 原始数据进行降噪处理。如此,通过第三目标模型进行降噪处理,可以提高降噪效率。The first image signal processing module inputs the fused raw data into a third object model corresponding to the first camera, and performs noise reduction processing by the third object model, and the third object model can perform any The original data is subjected to noise reduction processing. In this way, noise reduction efficiency can be improved by using the third target model to perform noise reduction processing.
作为本申请的一个示例,所述第一图像信号处理模块中包括所述第一摄像头对应的多个第三目标模型,所述多个第三目标模型中的每个第三目标模型对应有曝光数值范围;所述方法还包括:As an example of the present application, the first image signal processing module includes a plurality of third object models corresponding to the first camera, and each third object model in the plurality of third object models corresponds to an exposure range of values; the method also includes:
所述第一图像信号处理模块接收目标曝光数据,所述目标曝光数据是由所述第二图像信号处理模块基于第一曝光数据确定,所述第一曝光数据是由所述第二图像信号处理模块基于所述第五原始数据进行曝光数据统计得到,所述目标曝光数据用于调整所述第一摄像头的曝光参数;The first image signal processing module receives target exposure data, the target exposure data is determined by the second image signal processing module based on the first exposure data, and the first exposure data is determined by the second image signal processing module The module obtains exposure data statistics based on the fifth raw data, and the target exposure data is used to adjust the exposure parameters of the first camera;
所述第一图像信号处理模块根据所述目标曝光数据、以及所述每个第三目标模型对应的曝光数值范围,从所述多个第三目标模型中选择一个第三目标模型,选择的第三目标模型用于降噪处理。The first image signal processing module selects a third target model from the plurality of third target models according to the target exposure data and the exposure value range corresponding to each third target model, and the selected third target model A three-objective model is used for noise reduction processing.
如此,根据目标曝光数据所属的曝光数值范围,从多个第三目标模型中选择用于下一次的降噪处理的第三目标模型,从而可以能够对下一次的视频数据进行合理的降噪处理,进而提高降噪效果。In this way, according to the exposure value range to which the target exposure data belongs, a third target model for the next noise reduction process is selected from a plurality of third target models, so that a reasonable noise reduction process can be performed on the next video data , thereby improving the noise reduction effect.
作为本申请的一个示例,所述第二图像信号处理模块基于所述视频增强数据和所述第五原始数据进行视频帧输出,包括:As an example of the present application, the second image signal processing module performs video frame output based on the video enhancement data and the fifth original data, including:
所述第二图像信号处理模块对所述视频增强数据进行格式转换处理,得到YUV图像;The second image signal processing module performs format conversion processing on the video enhancement data to obtain a YUV image;
所述第二图像信号处理模块基于所述第五原始数据,确定目标数据,所述目标数据用于调整所述YUV图像的图像质量;The second image signal processing module determines target data based on the fifth raw data, and the target data is used to adjust the image quality of the YUV image;
所述第二图像信号处理模块基于所述目标数据调整所述YUV图像,并将调整后的所述YUV图像作为所述视频帧输出。The second image signal processing module adjusts the YUV image based on the target data, and outputs the adjusted YUV image as the video frame.
如此,通过第二图像信号处理模块对视频增强数据进行格式转换处理,以及基于第二原始数据确定目标数据,并根据目标数据对经格式转换处理后得到的YUV图像进行优化,从而得到画面清晰的视频帧。In this way, the format conversion process is performed on the video enhancement data through the second image signal processing module, and the target data is determined based on the second raw data, and the YUV image obtained after the format conversion process is optimized according to the target data, so as to obtain a clear picture video frame.
作为本申请的一个示例,所述第二图像信号处理模块包括芯片级系统SOC中集成的ISP,第一图像信号处理模块包括所述SOC外部的ISP。As an example of the present application, the second image signal processing module includes an ISP integrated in a system-on-a-chip (SOC), and the first image signal processing module includes an ISP outside the SOC.
如此,通过外置ISP来分担对视频帧的处理任务,可以减小SOC中内置ISP的负担,从而实现对视频帧的实时处理,以便于能够得到满足需求的视频画面。In this way, by sharing the task of processing video frames through an external ISP, the burden of the built-in ISP in the SOC can be reduced, thereby realizing real-time processing of video frames, so that video images that meet the requirements can be obtained.
作为本申请的一个示例,所述第一摄像头的图像感应器输出所述第一原始数据,包括:As an example of the present application, the image sensor of the first camera outputs the first raw data, including:
通过所述电子设备中的相机应用检测到夜景视频拍摄指令,所述夜景视频拍摄指令用于指示在夜景模式下进行视频录制;A night scene video shooting instruction is detected through the camera application in the electronic device, and the night scene video shooting instruction is used to indicate video recording in night scene mode;
响应于所述夜景视频拍摄指令,所述图像感应器输出所述第一原始数据。In response to the night scene video shooting instruction, the image sensor outputs the first raw data.
如此,在夜景场景下,电子设备获取第一原始数据,通过本申请提供的方法对摄像头采集的第一原始数据进行处理,以使得得到的视频帧的高亮区域不会过于曝光且暗调区域不会过暗,从而得到画面清晰的视频帧。In this way, in the night scene, the electronic device acquires the first raw data, and processes the first raw data collected by the camera through the method provided in this application, so that the highlighted area of the obtained video frame will not be overexposed and the darkened area will not be overexposed. Not too dark, resulting in a clear video frame.
第二方面,提供了一种摄像头的切换装置,配置于电子设备中,所述电子设备包括第一摄像头和第二摄像头;所述装置包括图像感应器节点、第一图像信号处理模块 以及第二图像信号处理模块;In a second aspect, a camera switching device is provided, which is configured in an electronic device, and the electronic device includes a first camera and a second camera; the device includes an image sensor node, a first image signal processing module, and a second Image signal processing module;
所述第一图像信号处理模块和所述第二图像信号处理模块,用于根据所述第一摄像头的第一原始数据进行视频帧输出;The first image signal processing module and the second image signal processing module are configured to output video frames according to the first raw data of the first camera;
所述图像感应器节点,用于在视频帧输出的过程中,若检测到调焦操作,则在未满足摄像头切换条件之前,启动所述第二摄像头;The image sensor node is used to start the second camera before the camera switching condition is met if a focusing operation is detected during the video frame output process;
所述第一图像信号处理模块和所述第二图像信号处理模块,用于根据所述第一原始数据、所述第二摄像头的第二原始数据,将所述第二摄像头与所述第一摄像头进行参数同步;The first image signal processing module and the second image signal processing module are configured to, according to the first raw data and the second raw data of the second camera, combine the second camera with the first The camera performs parameter synchronization;
所述第一图像信号处理模块和所述第二图像信号处理模块,用于当所述调焦操作满足所述摄像头切换条件时,根据第三原始数据进行视频帧输出,所述第三原始数据是经参数同步后的所述第二摄像头的原始视频数据。The first image signal processing module and the second image signal processing module are configured to output video frames according to third raw data when the focusing operation satisfies the camera switching condition, and the third raw data is the raw video data of the second camera after parameter synchronization.
作为本申请的一个示例,所述第一图像信号处理模块和所述第二图像信号处理模块,用于:As an example of the present application, the first image signal processing module and the second image signal processing module are configured to:
根据所述第一原始数据,确定第一摄像信息;determining first imaging information according to the first raw data;
根据所述第二原始数据,确定第二摄像信息;determining second imaging information according to the second raw data;
根据所述第一摄像信息,调整所述第二摄像信息,以将所述第二摄像信息与所述第一摄像信息同步;adjusting the second imaging information according to the first imaging information to synchronize the second imaging information with the first imaging information;
根据调整后的所述第二摄像信息,对所述第二摄像头进行参数调整,以将所述第二摄像头与所述第一摄像头进行参数同步。According to the adjusted second camera information, the parameters of the second camera are adjusted, so as to synchronize the parameters of the second camera with the first camera.
作为本申请的一个示例,所述第一摄像信息包括第一曝光数据、第一自动对焦AF、第一自动白平衡AWB、第一视场角FOV,所述第二摄像信息包括第二曝光数据、第二AF、第二AWB、第二FOV。As an example of the present application, the first imaging information includes first exposure data, first autofocus AF, first automatic white balance AWB, and first field of view FOV, and the second imaging information includes second exposure data , 2nd AF, 2nd AWB, 2nd FOV.
作为本申请的一个示例,所述第一图像信号处理模块用于:As an example of the present application, the first image signal processing module is used for:
基于所述第二原始数据,对所述第二摄像头对应的第一目标模型进行预降噪处理,所述第一目标模型能够对任意的原始数据进行降噪处理,预降噪处理后的所述第一目标模型用于在所述调焦操作满足所述摄像头切换条件后对所述第三原始数据进行降噪处理。Based on the second raw data, pre-noise reduction processing is performed on the first target model corresponding to the second camera, the first target model can perform noise reduction processing on any raw data, and all pre-noise reduction processing The first target model is used to perform noise reduction processing on the third raw data after the focusing operation satisfies the camera switching condition.
作为本申请的一个示例,所述第一图像信号处理模块用于:As an example of the present application, the first image signal processing module is used for:
按照第一预设比例对所述第二原始数据进行降分辨率处理,以及按照第二预设比例对降分辨率处理后的所述第二原始数据进行降帧率处理,得到第四原始数据;Performing resolution reduction processing on the second original data according to a first preset ratio, and performing frame rate reduction processing on the second original data after resolution reduction processing according to a second preset ratio, to obtain fourth original data ;
将所述第四原始数据输入至所述第一目标模型中,以对所述第一目标模型进行预降噪处理。The fourth original data is input into the first object model to perform pre-noise reduction processing on the first object model.
作为本申请的一个示例,所述图像感应器节点用于:As an example of the present application, the image sensor node is used for:
在视频帧输出的过程中,若检测到调焦操作,则在未达到所述摄像头切换条件之前,当所述调焦操作对应的调焦值与所述摄像头切换条件对应的目标调焦值之间的差值小于或等于预设数值时,启动所述第二摄像头。In the process of video frame output, if a focusing operation is detected, before the camera switch condition is reached, when the focus value corresponding to the focus operation is between the target focus value corresponding to the camera switch condition When the difference between them is less than or equal to the preset value, start the second camera.
作为本申请的一个示例;As an example of this application;
所述第一摄像头的图像感应器输出所述第一原始数据;The image sensor of the first camera outputs the first raw data;
所述第一图像信号处理模块,用于获取所述第一原始数据;The first image signal processing module is configured to acquire the first raw data;
所述第一图像信号处理模块,用于复制所述第一原始数据,得到第五原始数据;The first image signal processing module is configured to copy the first original data to obtain fifth original data;
所述第一图像信号处理模块,用于对所述第一原始数据进行图像增强处理,得到视频增强数据;The first image signal processing module is configured to perform image enhancement processing on the first raw data to obtain video enhancement data;
所述第一图像信号处理模块,用于将所述视频增强数据以及所述第五原始数据发送给所述第二图像信号处理模块;The first image signal processing module is configured to send the video enhancement data and the fifth original data to the second image signal processing module;
所述第二图像信号处理模块,用于基于所述视频增强数据和所述第五原始数据进行视频帧输出。The second image signal processing module is configured to output video frames based on the video enhancement data and the fifth original data.
作为本申请的一个示例,所述第一原始数据包括同一时间段内采集的长曝光数据和短曝光数据,所述第一图像信号处理模块用于:As an example of the present application, the first raw data includes long exposure data and short exposure data collected in the same time period, and the first image signal processing module is used for:
将所述长曝光数据和所述短曝光数据进行融合处理,得到融合原始数据;performing fusion processing on the long exposure data and the short exposure data to obtain fusion original data;
对所述融合原始数据进行降噪处理,得到所述视频增强数据。Noise reduction processing is performed on the fused original data to obtain the enhanced video data.
作为本申请的一个示例,所述第一图像信号处理模块用于:As an example of the present application, the first image signal processing module is used for:
将所述长曝光数据和所述短曝光数据输入至第二目标模型中,由所述第二目标模型进行融合处理,所述第二目标模型能够对任意的长曝光数据和短曝光数据进行融合处理。Input the long exposure data and the short exposure data into a second target model, and perform fusion processing by the second target model, and the second target model can fuse any long exposure data and short exposure data deal with.
作为本申请的一个示例,所述第一图像信号处理模块用于:As an example of the present application, the first image signal processing module is used for:
将所述融合原始数据输入至所述第一摄像头对应的第三目标模型中,由所述第三目标模型进行降噪处理,所述第三目标模型能够对任意的原始数据进行降噪处理。The fused original data is input into a third object model corresponding to the first camera, and the third object model performs noise reduction processing, and the third object model can perform noise reduction processing on any original data.
作为本申请的一个示例,所述第一图像信号处理模块中包括所述第一摄像头对应的多个第三目标模型,所述多个第三目标模型中的每个第三目标模型对应有曝光数值范围;As an example of the present application, the first image signal processing module includes a plurality of third object models corresponding to the first camera, and each third object model in the plurality of third object models corresponds to an exposure range of values;
所述第一图像信号处理模块还用于:The first image signal processing module is also used for:
接收目标曝光数据,所述目标曝光数据是由所述第二图像信号处理模块基于第一曝光数据确定,所述第一曝光数据是由所述第二图像信号处理模块基于所述第五原始数据进行曝光数据统计得到,所述目标曝光数据用于调整所述第一摄像头的曝光参数;receiving target exposure data, the target exposure data is determined by the second image signal processing module based on the first exposure data, the first exposure data is determined by the second image signal processing module based on the fifth raw data Obtained by performing exposure data statistics, the target exposure data is used to adjust the exposure parameters of the first camera;
根据所述目标曝光数据、以及所述每个第三目标模型对应的曝光数值范围,从所述多个第三目标模型中选择一个第三目标模型,选择的第三目标模型用于降噪处理。According to the target exposure data and the exposure value range corresponding to each third target model, select a third target model from the plurality of third target models, and the selected third target model is used for noise reduction processing .
作为本申请的一个示例,所述第二图像信号处理模块用于:As an example of the present application, the second image signal processing module is used for:
对所述视频增强数据进行格式转换处理,得到YUV图像;Perform format conversion processing on the video enhancement data to obtain a YUV image;
基于所述第五原始数据,确定目标数据,所述目标数据用于调整所述YUV图像的图像质量;determining target data based on the fifth raw data, the target data is used to adjust the image quality of the YUV image;
基于所述目标数据调整所述YUV图像,并将调整后的所述YUV图像作为所述视频帧输出。adjusting the YUV image based on the target data, and outputting the adjusted YUV image as the video frame.
作为本申请的一个示例,所述第二图像信号处理模块包括芯片级系统SOC中集成的ISP,第一图像信号处理模块包括所述SOC外部的ISP。As an example of the present application, the second image signal processing module includes an ISP integrated in a system-on-a-chip (SOC), and the first image signal processing module includes an ISP outside the SOC.
作为本申请的一个示例,所述图像感应器节点用于:As an example of the present application, the image sensor node is used for:
通过所述电子设备中的相机应用检测到夜景视频拍摄指令,所述夜景视频拍摄指令用于指示在夜景模式下进行视频录制;A night scene video shooting instruction is detected through the camera application in the electronic device, and the night scene video shooting instruction is used to indicate video recording in night scene mode;
响应于所述夜景视频拍摄指令,输出所述第一原始数据。In response to the night scene video shooting instruction, the first raw data is output.
第三方面,提供一种电子设备,所述电子设备的结构中包括处理器和存储器,所述存储器用于存储支持电子设备执行上述第一方面任一所述的方法的程序,以及存储用于实现上述第一方面任一所述的方法所涉及的数据;所述处理器被配置为用于执行所述存储器中存储的程序。所述电子设备还可以包括通信总线,所述通信总线用于在所述处理器与所述存储器之间建立连接。In the third aspect, an electronic device is provided, the structure of the electronic device includes a processor and a memory, and the memory is used to store a program that supports the electronic device to execute the method described in any one of the above-mentioned first aspects, and to store a program for The data involved in implementing the method described in any one of the above first aspects; the processor is configured to execute the program stored in the memory. The electronic device may also include a communication bus for establishing a connection between the processor and the memory.
第四方面,提供一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行如上述第一方面任意一项所述的方法。In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer is made to execute the method described in any one of the above-mentioned first aspects.
第五方面,提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面所述的方法。According to a fifth aspect, there is provided a computer program product containing instructions, which, when run on a computer, causes the computer to execute the method described in the first aspect above.
上述第二方面、第三方面、第四方面和第五方面所获得的技术效果与上述第一方面中对应的技术手段获得的技术效果近似,在这里不再赘述。The technical effects obtained by the above-mentioned second aspect, third aspect, fourth aspect and fifth aspect are similar to those obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here.
附图说明Description of drawings
图1为本申请实施例提供的一种摄像头的布局示意图;FIG. 1 is a schematic layout diagram of a camera provided in an embodiment of the present application;
图2为本申请实施例提供的一种电子设备的硬件结构示意图;FIG. 2 is a schematic diagram of a hardware structure of an electronic device provided in an embodiment of the present application;
图3为本申请实施例提供的一种电子设备的软件架构示意图;FIG. 3 is a schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;
图4为本申请实施例提供的一种应用场景的交互示意图;FIG. 4 is an interactive schematic diagram of an application scenario provided by an embodiment of the present application;
图5为本申请实施例提供的另一种应用场景的交互示意图;FIG. 5 is an interactive schematic diagram of another application scenario provided by the embodiment of the present application;
图6为本申请实施例提供的另一种应用场景的交互示意图;FIG. 6 is an interactive schematic diagram of another application scenario provided by the embodiment of the present application;
图7为本申请实施例提供的一种视频帧的输出方法的流程示意图;FIG. 7 is a schematic flowchart of a video frame output method provided by an embodiment of the present application;
图8为本申请实施例提供的一种摄像头的切换方法的流程示意图;FIG. 8 is a schematic flowchart of a camera switching method provided in an embodiment of the present application;
图9为本申请实施例提供的一种硬件架构示意。FIG. 9 is a schematic diagram of a hardware architecture provided by an embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请的实施方式作进一步地详细描述。In order to make the purpose, technical solution and advantages of the present application clearer, the implementation manner of the present application will be further described in detail below in conjunction with the accompanying drawings.
应当理解的是,本申请提及的“多个”是指两个或两个以上。在本申请的描述中,除非另有说明,“/”表示或的意思,比如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,比如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,为了便于清楚描述本申请的技术方案,采用了“第一”、“第二”等字样对功能和作用基本相同的相同项或相似项进行区分。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定,并且“第一”、“第二”等字样也并不限定一定不同。It should be understood that the "plurality" mentioned in this application means two or more. In the description of this application, unless otherwise specified, "/" means or means, for example, A/B can mean A or B; "and/or" in this article is just a description of the relationship between associated objects, It means that there can be three kinds of relationships, for example, A and/or B, which can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in order to clearly describe the technical solution of the present application, words such as "first" and "second" are used to distinguish the same or similar items with basically the same function and effect. Those skilled in the art can understand that words such as "first" and "second" do not limit the number and execution order, and words such as "first" and "second" do not necessarily limit the difference.
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。Reference to "one embodiment" or "some embodiments" or the like in the specification of the present application means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in other embodiments," etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean "one or more but not all embodiments" unless specifically stated otherwise. The terms "including", "comprising", "having" and variations thereof mean "including but not limited to", unless specifically stated otherwise.
在对本申请实施例提供的方法进行详细介绍之前,先对本申请实施例涉及的名词和执行主体进行介绍。Before introducing the method provided by the embodiment of the present application in detail, the nouns and execution subjects involved in the embodiment of the present application are firstly introduced.
首先,对本申请实施例涉及的名词进行介绍。First, the nouns involved in the embodiments of the present application are introduced.
曝光:根据曝光时间的长短可以分为长曝光和短曝光。曝光时间越长,光圈的进光量越大。反之,曝光时间越短,光圈的进光量越小。Exposure: According to the length of exposure time, it can be divided into long exposure and short exposure. The longer the exposure time, the greater the amount of light entering the aperture. Conversely, the shorter the exposure time, the smaller the amount of light entering the aperture.
3A统计算法:包括自动曝光(automatic exposure,AE)算法自动对焦(automatic focus,AF)算法、和自动白平衡(automatic white balance,AWB)算法。3A statistical algorithm: including automatic exposure (automatic exposure, AE) algorithm, automatic focus (automatic focus, AF) algorithm, and automatic white balance (automatic white balance, AWB) algorithm.
AE:是指相机根据光线条件自动确定曝光量。成像系统中一般都会有AE功能,该功能直接关系到图像画面的亮度和图像质量,也即会决定图像的明暗。AE: refers to the camera automatically determines the exposure according to the lighting conditions. The imaging system generally has an AE function, which is directly related to the brightness and image quality of the image screen, that is, it will determine the brightness and darkness of the image.
AF:是指由相机根据被摄体距离的远近,自动地调节摄像头的对焦距离,也即通过测距来调整摄像头中镜片形成焦点,从而使得相机内的影像清晰。AF: It means that the camera automatically adjusts the focus distance of the camera according to the distance of the subject, that is, the lens in the camera is adjusted to form the focus through distance measurement, so that the image in the camera is clear.
AWB:主要用于解决图像偏色的问题。如果图像存在偏色情况,则可以通过AWB算法进行矫正。AWB: Mainly used to solve the problem of image color cast. If there is a color cast in the image, it can be corrected by the AWB algorithm.
视场角:(field angle,FOV),是指摄像头所能覆盖的范围。FOV越大,摄像头能够容纳的景物越多,不难理解,若被摄体没有位于摄像头的FOV内就不会被摄像头拍摄到。Field of view: (field angle, FOV), refers to the range that the camera can cover. The larger the FOV, the more scenes the camera can accommodate. It is not difficult to understand that if the subject is not within the FOV of the camera, it will not be captured by the camera.
图像感应器(Sensor):是相机的核心部件,作用是将光信号转换成电信号,以便于后续处理和存储。工作原理是通过光敏元件在光照的条件下产生电荷,电荷转移产生电流,电流经过整流放大、模数转换形成数字信号。图像感应器一般包括两类:电荷耦合器件(charge coupled device,CCD)和互补金属氧化物半导体(complementary metal oxide semiconductor,CMOS)。Image sensor (Sensor): It is the core component of the camera, and its function is to convert optical signals into electrical signals for subsequent processing and storage. The working principle is that the photosensitive element generates charge under the condition of light, and the charge transfer generates a current, and the current is rectified and amplified, and converted into a digital signal to form a digital signal. Image sensors generally include two types: charge coupled device (CCD) and complementary metal oxide semiconductor (complementary metal oxide semiconductor, CMOS).
RAW数据:在本申请实施例中也称为原始数据,是指相机中的CCD或者CMOS图像感应器将捕捉到的光源信号转化为数据信号的原始数据。也即可以理解为是未经过加工的数据,能够用于描述图像感应器接受到的各种光的强度。RAW data: also referred to as raw data in this embodiment of the application, refers to the raw data that the CCD or CMOS image sensor in the camera converts the captured light source signal into a data signal. That is to say, it can be understood as unprocessed data, which can be used to describe the intensity of various lights received by the image sensor.
接下来对本申请实施例涉及的执行主体进行介绍。Next, the execution subject involved in the embodiment of the present application will be introduced.
本申请实施例提供的方法可以由具有拍摄功能的电子设备执行,电子设备配置有多个摄像头,多个摄像头中的不同摄像头具有不同的拍摄能力。譬如,多个摄像头可以包括但不限于广角摄像头、长焦摄像头(比如潜望式长焦摄像头)、黑白摄像头、超广角摄像头。通常情况下,多个摄像头包括一个主摄像头和至少一个辅摄像头,譬如请参考图1,多个摄像头的空间位置分布可以如图1中的(a)图所示,或者,多个摄像头的空间位置分布也可以如图1中的(b)图所示,该多个摄像头分别为摄像头00、摄像头01、摄像头02、摄像头03,示例性地,摄像头00为主摄像头,其他为辅摄像头。电子设备在启动相机应用后通常默认通过主摄像头拍摄,在相机切换后,电子设备根据切换需求从至少一个辅摄像头中选择合适的辅摄像头,并通过选择的辅摄像头进行拍摄。譬如请参考图1,在默认情况下通过摄像头00拍摄,在相机切换至广角后,通过摄像头01拍摄。作为示例而非限定,电子设备可以是但不限于手机运动相机(GoPro)、数码相机、平板电脑、桌面型、膝上型、手持计算机、笔记本电脑、车载设备、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、蜂 窝电话、个人数字助理(personal digital assistant,PDA)、增强现实(augmented reality,AR)\虚拟现实(virtual reality,VR)设备、手机等,本申请实施例对此不作限定。The method provided in the embodiment of the present application may be executed by an electronic device having a shooting function. The electronic device is configured with multiple cameras, and different cameras in the multiple cameras have different shooting capabilities. For example, multiple cameras may include, but not limited to, a wide-angle camera, a telephoto camera (such as a periscope telephoto camera), a black and white camera, and an ultra-wide-angle camera. Usually, multiple cameras include a main camera and at least one auxiliary camera. For example, please refer to Figure 1. The spatial position distribution of multiple cameras can be shown in Figure 1 (a), or, the spatial distribution of multiple cameras The location distribution can also be shown in (b) in FIG. 1, the plurality of cameras are respectively camera 00, camera 01, camera 02, and camera 03. Exemplarily, camera 00 is the main camera, and the others are auxiliary cameras. After starting the camera application, the electronic device usually shoots through the main camera by default. After the camera is switched, the electronic device selects a suitable auxiliary camera from at least one auxiliary camera according to the switching requirement, and shoots through the selected auxiliary camera. For example, please refer to Figure 1. By default, camera 00 is used to shoot, and after the camera is switched to wide-angle, camera 01 is used to shoot. By way of example and not limitation, an electronic device may be, but not limited to, a mobile phone action camera (GoPro), digital camera, tablet computer, desktop, laptop, handheld computer, notebook computer, vehicle-mounted device, ultra-mobile personal computer (ultra-mobile personal computer, UMPC), netbook, cellular phone, personal digital assistant (personal digital assistant, PDA), augmented reality (augmented reality, AR)\virtual reality (virtual reality, VR) equipment, mobile phone, etc. Not limited.
请参阅图2,图2是本申请实施例提供的一种电子设备的结构示意图。Please refer to FIG. 2 . FIG. 2 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,ISP 191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。在一个示例中,电子设备中包括的ISP 191的数量是多个,图2中仅示例性地示出了一个。The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 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, button 190, ISP 191, indicator 192, camera 193, display screen 194, and A subscriber identification module (subscriber identification module, SIM) card interface 195 and the like. In one example, the number of ISPs 191 included in the electronic device is multiple, and only one is exemplarily shown in FIG. 2 .
可以理解的是,本实施例示意的结构并不构成对电子设备100的具体限定。在另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structure shown in this embodiment does not constitute a specific limitation on the electronic device 100 . In other embodiments, the electronic device 100 may include more or fewer components than shown, or combine certain components, or separate certain components, or arrange different components. The illustrated components can be realized 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 (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), 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 processor (neural-network processing unit, NPU) wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。Wherein, the controller may be the nerve center and command center of the electronic device 100 . The controller can generate an operation control signal according to the instruction opcode and timing signal, and complete the control of fetching and executing the instruction.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. The memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated access is avoided, and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
在一些实施例中,处理器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, 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, a universal asynchronous transmitter (universal asynchronous receiver/transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), general-purpose input and output (general-purpose input/output, GPIO) interface, subscriber identity module (subscriber identity module, SIM) interface, and /or universal serial bus (universal serial bus, USB) interface, etc.
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。The I2C interface is a bidirectional synchronous serial bus, including a serial data line (serial data line, SDA) and a serial clock line (derail clock line, SCL).
可以理解的是,本实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules shown in this embodiment is only for schematic illustration, 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 manners in the foregoing embodiments, or a combination of multiple interface connection manners.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器, 也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备100供电。The charging management module 140 is configured to receive a charging input from a charger. Wherein, the charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger through the USB interface 130 . In some wireless charging embodiments, the charging management module 140 may receive a wireless charging input through a wireless charging coil of the electronic device 100 . While the charging management module 140 is charging the battery 142 , it can also supply power to the electronic device 100 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 for connecting the battery 142 , the charging management module 140 and the processor 110 . The power management module 141 receives the input from the battery 142 and/or the charging management module 140 to provide power for 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 disposed in the processor 110 . In some other embodiments, the power management module 141 and the charging management module 140 may also be set in the same device.
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be realized by the antenna 1 , the antenna 2 , the mobile communication module 150 , the wireless communication module 160 , a modem processor, a baseband processor, and the like.
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 realizes the display function through the GPU, the display screen 194 , and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. 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 be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (quantum dot light emitting diodes, QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194 , where N is a positive integer greater than 1.
电子设备100可以通过ISP 191,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can realize the shooting function through the ISP 191, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
ISP 191用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP 191处理,转化为肉眼可见的图像。ISP 191还可以对图像的噪点,亮度,肤色进行算法优化。ISP 191还可以对拍摄场景的曝光,色温等参数优化。The ISP 191 is used for processing the data fed back by the camera 193. For example, when taking a picture, open the shutter, the light is transmitted to the photosensitive element of the camera through the lens, and the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP 191 for processing, and converts it into an image visible to the naked eye. ISP 191 can also optimize the algorithm for image noise, brightness, and skin tone. ISP 191 can also optimize the exposure, color temperature and other parameters of the shooting scene.
在一个实施例中,ISP 191可以包括SOC中集成的内置ISP和设置于SOC外部的外置ISP,相比较而言,外置ISP的内部结构与内置ISP的内部结构类似或相同,不同的是,外置ISP与内置ISP对视频数据的处理任务不同。作为本申请的一个示例,外置ISP主要有两方面作用:一方面,用于在电子设备100通过摄像头录制视频的过程中,对摄像头采集的原始的RAW数据进行融合、增强等处理,从而为内置ISP提供增强后的视频数据。另外,对摄像头采集的原始的RAW数据进行路由,以为内置ISP提供一份原始的RAW数据,从而便于内置ISP能够准确地确定当前的曝光数据,进而便于内置ISP根据曝光数据动态地调整摄像头的曝光参数。另一方面,外置ISP用于响应于调焦操作,提前启动另一个摄像头,并将另一个摄像头与切换前的摄像头进行参数同步,以便于实现平滑切换,其具体实现可以参见下文中的各个实施例。In one embodiment, the ISP 191 may include a built-in ISP integrated in the SOC and an external ISP arranged outside the SOC. In comparison, the internal structure of the external ISP is similar or the same as that of the built-in ISP. The difference is , The external ISP and the built-in ISP have different processing tasks for video data. As an example of this application, the external ISP mainly has two functions: on the one hand, it is used to fuse and enhance the original RAW data collected by the camera during the process of video recording by the electronic device 100 through the camera, so as to provide Built-in ISP provides enhanced video data. In addition, the original RAW data collected by the camera is routed to provide a copy of the original RAW data for the built-in ISP, so that the built-in ISP can accurately determine the current exposure data, and then the built-in ISP can dynamically adjust the exposure of the camera according to the exposure data parameter. On the other hand, the external ISP is used to respond to the focus operation, start another camera in advance, and synchronize the parameters of the other camera with the camera before switching, so as to achieve smooth switching. For the specific implementation, please refer to each of the following Example.
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP 191转换成数字图像信号。ISP 191将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB(red green blue红色绿色蓝色),YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。Camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects it 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 light signal into an electrical signal, and then transmits the electrical signal to the ISP 191 for conversion into a digital image signal. ISP 191 outputs the digital image signal to DSP for processing. DSP converts digital image signals into standard RGB (red green blue red green blue), YUV and other image signals. In some embodiments, the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备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 various encoding formats, for example: moving picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。The NPU is a neural-network (NN) computing processor. By referring to the structure of biological neural networks, such as the transfer mode between neurons in the human brain, it can quickly process input information and continuously learn by itself. Applications such as intelligent cognition of the electronic device 100 can be realized through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, so as 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 implement a data storage function. Such as saving music, video and other files in the 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 codes including instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by executing instructions stored in the internal memory 121 . The internal memory 121 may include an area for storing programs and an area for storing data. Wherein, the stored program area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.) and the like. The storage data area can store data created during the use of the electronic device 100 (such as audio data, phonebook, etc.) and the like. 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, flash memory device, universal flash storage (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. Such as music playback, recording, etc.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be set in the processor 110 , or some functional modules of the audio module 170 may be set in the processor 110 .
耳机接口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 for connecting wired earphones. The earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile terminal platform (open mobile terminal platform, OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。The keys 190 include a power key, a volume key and the like. The key 190 may be a mechanical key. It can also be a touch button. The electronic device 100 can receive key input and generate key signal input related to user settings and function control of the electronic device 100 . The indicator 192 can be an indicator light, and can be used to indicate charging status, power change, and can also be used to indicate messages, missed calls, notifications, and the like. The SIM card interface 195 is used for connecting a SIM card. The SIM card can be connected and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 . The electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1. SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card etc.
在一个实施例中,电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本发明实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。In one embodiment, the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present invention, the software structure of the electronic device 100 is exemplarily described by taking an Android system with a layered architecture as an example.
图3是本申请实施例提供的电子设备100的软件结构框图。FIG. 3 is a block diagram of the software structure of the electronic device 100 provided by the embodiment of the present application.
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,Android系统从上至下分别为应用程序层,硬件抽象层(Hardware Abstract Layer,HAL)、内核层、硬件层。另外,在应用程序层与HAL之间还包括应用程序框架层(Application Framework)(图3中未示出),本申请实施例不做重点介绍。The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate through software interfaces. In some embodiments, the Android system is respectively an application program layer, a hardware abstract layer (Hardware Abstract Layer, HAL), a kernel layer, and a hardware layer from top to bottom. In addition, an application framework layer (Application Framework) (not shown in FIG. 3 ) is also included between the application layer and the HAL, which is not highlighted in this embodiment of the present application.
应用程序层可以包括一系列应用程序包。如图3所示,应用程序包可以包括相机,图库等应用程序。The application layer can consist of a series of application packages. As shown in Figure 3, the application package may include application programs such as a camera and a gallery.
作为本申请的一个示例,相机应用程序支持超夜视频模式,电子设备在超夜视频模式下能够在夜景中拍摄出清晰、亮暗分明的视频。As an example of the present application, the camera application supports a super night video mode, and the electronic device can shoot clear, bright and dark videos in night scenes in the super night video mode.
作为本申请的一个示例,应用程序层还提供有预加载外置ISP服务。由于外置ISP内部的存储器通常是随机存取存储器(Random Access Memory,RAM),根据RAM的特性可知,在断电的情况下RAM无法保存数据,所以,通常会将外置ISP在运行过程中所需使用的诸如外置ISP SDK、模型(譬如包括下文所述的第一目标模型、第二目标模型、第三目标模型)之类的数据存储在系统内存中。在启动相机应用程序时,应用程序层开启预加载外置ISP服务,通过预加载外置ISP服务使得外置ISP驱动控制外置ISP提前上电,以将外置ISP运行过程中所需的数据从系统内存中加载至外置ISP内部的RAM中,进而便于外置ISP能够在超夜视频模式下执行对应的功能(譬如进行数据融合、降噪处理等)。As an example of this application, the application layer also provides pre-loaded external ISP services. Since the internal memory of the external ISP is usually random access memory (Random Access Memory, RAM), according to the characteristics of RAM, RAM cannot save data in the case of power failure, so the external ISP is usually stored during operation. The required data such as external ISP SDK and models (for example, including the first target model, the second target model, and the third target model described below) are stored in the system memory. When the camera application is started, the application layer starts the preloaded external ISP service, and the external ISP driver controls the external ISP to be powered on in advance by preloading the external ISP service, so that the data required during the operation of the external ISP It is loaded from the system memory to the internal RAM of the external ISP, so that the external ISP can perform corresponding functions (such as data fusion, noise reduction processing, etc.) in the ultra-night video mode.
作为本申请的一个示例,图库应用程序中可以提供由摄像头录制的视频,如此用户可以从图库应用程序中查看所录制的视频。As an example of this application, the video recorded by the camera can be provided in the gallery application, so that the user can view the recorded video from the gallery application.
HAL层主要包括视频模块,用于通过摄像头的图像感知器获取RAW数据,并分别通过外置ISP、内置ISP对RAW数据进行融合、增强、优化等处理,得到增强清晰度和降噪效果的视频帧。之后将得到的视频帧发送至显示屏进行显示。另外,视频模块还将录制的视频存至图库应用程序中,以便于用户查看。The HAL layer mainly includes a video module, which is used to obtain RAW data through the image sensor of the camera, and perform fusion, enhancement, optimization and other processing on the RAW data through the external ISP and the built-in ISP respectively to obtain video with enhanced clarity and noise reduction effect frame. The resulting video frames are then sent to the display for display. In addition, the video module also saves the recorded video to the gallery application for easy viewing by users.
作为本申请的一个示例,视频模块还用于在需要进行摄像头切换的情况下,提前启动待启动的摄像头,并在摄像头切换之前,将提前启动的摄像头与切换前的摄像头进行参数同步,以便于实现平滑切换。As an example of this application, the video module is also used to start the camera to be started in advance when the camera needs to be switched, and before the camera is switched, the parameters of the camera that is started in advance are synchronized with the camera before the switch, so that Achieve smooth switching.
在一个示例中,视频模块包括图像感应器节点、内置ISP节点、外置ISP节点。 各个节点可以理解为是对底层硬件执行的功能的封装,可供上层(应用程序层)感知和调用。示例性地,图像感应器节点是对底层摄像头中的图像感应器的功能的封装;内置ISP节点是对底层内置ISP的功能的封装;外置ISP节点是对底层外置ISP的功能的封装。在实施中,视频模块通过图像感应器节点、内置ISP节点、外置ISP节点之间的交互实现对应的功能。In one example, the video module includes an image sensor node, a built-in ISP node, and an external ISP node. Each node can be understood as an encapsulation of the functions performed by the underlying hardware, which can be perceived and invoked by the upper layer (application layer). Exemplarily, the image sensor node encapsulates the function of the image sensor in the bottom camera; the built-in ISP node encapsulates the function of the bottom built-in ISP; the external ISP node encapsulates the function of the bottom external ISP. In implementation, the video module implements corresponding functions through the interaction between the image sensor node, the built-in ISP node, and the external ISP node.
外置ISP节点的内部可以包括多个子模块,譬如包括路由子模块、第一预处理子模块、增强子模块。同理,多个子模块中的各个子模块可以理解为分别是对底层外置ISP中不同硬件的功能的封装,作为本申请的一个示例,路由子模块是对底层外置ISP中路由单元的功能的封装,第一预处理子模块是对底层外置ISP中一个或者多个IFE的功能的封装,增强子模块是对底层外置ISP中神经网络处理器(neural network processing unit,NPU)的功能的封装。在实施中,外置ISP节点通过多个子模块之间的交互实现对应的功能。The interior of the external ISP node may include multiple submodules, such as a routing submodule, a first preprocessing submodule, and an enhancement submodule. Similarly, each of the multiple sub-modules can be understood as encapsulating the functions of different hardware in the bottom-level external ISP. As an example of this application, the routing sub-module is the function of the routing unit in the bottom-level external ISP. Encapsulation, the first preprocessing sub-module is the encapsulation of one or more IFE functions in the bottom external ISP, and the enhancement sub-module is the function of the neural network processing unit (NPU) in the bottom external ISP package. In implementation, the external ISP node implements corresponding functions through the interaction between multiple sub-modules.
内置ISP节点的内部包括多个子模块,譬如包括第二预处理子模块以及优化处理子模块。多个子模块中的各个子模块可以理解为分别是对底层内置ISP中不同硬件的功能的封装,作为本申请的一个示例,第二预处理子模块是对底层内置ISP中的一个或者多个图像前端引擎(image front end,IFE)的功能的封装;优化处理子模块是对底层内置ISP中的图像处理器(image processing engine,IPE)的功能的封装。在实施中,内置ISP节点通过多个子模块的交互实现对应的功能。The interior of the built-in ISP node includes a plurality of submodules, for example, a second preprocessing submodule and an optimization processing submodule. Each of the multiple sub-modules can be understood as encapsulating the functions of different hardware in the underlying built-in ISP. As an example of this application, the second preprocessing sub-module is to process one or more images in the underlying built-in ISP Encapsulation of the functions of the front-end engine (image front end, IFE); the optimization processing sub-module is the encapsulation of the functions of the image processing engine (IPE) in the underlying built-in ISP. In implementation, the built-in ISP node realizes the corresponding functions through the interaction of multiple sub-modules.
另外,HAL层还包括外置ISP软件开发包(software development kit,SDK),用于建立起外置ISP节点内部的多个子模块之间的交互。In addition, the HAL layer also includes an external ISP software development kit (software development kit, SDK), which is used to establish the interaction between multiple sub-modules inside the external ISP node.
内核层是硬件和软件之间的层。内核层包括但不限于摄像头驱动,内置ISP驱动,外置ISP驱动。The kernel layer is the layer between hardware and software. The kernel layer includes but not limited to camera driver, built-in ISP driver, and external ISP driver.
硬件层包括但不限于摄像头、内置ISP、外置ISP、显示屏。The hardware layer includes but not limited to camera, built-in ISP, external ISP, display.
下面结合夜景中录制视频,示例性说明电子设备100软件以及硬件的工作流程。In the following, the workflow of the software and hardware of the electronic device 100 will be exemplarily described in conjunction with video recording in the night scene.
在一个实施例中,若相机应用程序检测到在超夜视频模式下开启了视频拍摄,则向HAL层的视频模块下发夜景视频拍摄请求。视频模块接收到夜景视频拍摄请求后,建立起用于处理夜景视频的框架。示例性地,视频模块根据夜景视频拍摄请求通知摄像头驱动控制主摄像头上电,以及通知内置ISP驱动控制内置ISP上电。相应的,摄像头驱动对主摄像头进行驱动。主摄像头加载完成后通知摄像头驱动,以通过摄像头驱动通知视频模块主摄像头已完成加载。另外,内置ISP驱动对内置ISP进行驱动,内置ISP加载完成后通知内置ISP驱动,以通过内置ISP驱动通知视频模块内置ISP已完成加载。视频模块在确定主摄像头、内置ISP和外置ISP(譬如,加载时机是在相机应用程序启动后)均加载完成后,建立起图像感应器节点、内置ISP节点以及外置ISP节点之间的交互。如此,就可以通过调用视频模块采集视频数据并进行优化处理,之后,输出经优化处理后的主摄像头采集的视频数据给显示屏进行显示。In one embodiment, if the camera application detects that video shooting is enabled in the super night video mode, it sends a night scene video shooting request to the video module of the HAL layer. After the video module receives the night scene video shooting request, it establishes a framework for processing the night scene video. Exemplarily, the video module notifies the camera driver to control the main camera to be powered on according to the night scene video shooting request, and notifies the built-in ISP driver to control the built-in ISP to be powered on. Correspondingly, the camera driver drives the main camera. After the main camera is loaded, the camera driver is notified to notify the video module that the main camera has been loaded through the camera driver. In addition, the built-in ISP driver drives the built-in ISP, and notifies the built-in ISP driver after the built-in ISP is loaded, so as to notify the video module that the built-in ISP has been loaded through the built-in ISP driver. After the video module determines that the main camera, built-in ISP and external ISP (for example, the loading time is after the camera application is started), the interaction between the image sensor node, the built-in ISP node and the external ISP node is established. . In this way, the video data can be collected and optimized by calling the video module, and then the optimized video data collected by the main camera can be output to the display screen for display.
作为本申请的一个示例,若相机应用程序检测到用户的调焦操作,则在未满足摄像头切换条件之前,相机应用程序向HAL层的视频模块下发摄像头预启动指令。在一个示例中,摄像头预启动指令中携带目标摄像头标识,目标摄像头标识用于指示待启动的辅摄像头。视频模块接收摄像头预启动指令后,根据摄像头预启动指令通知摄像 头驱动控制辅摄像头上电,以在切换之前提前启动辅摄像头进行视频数据采集,之后,根据辅摄像头采集的视频数据、以及主摄像头采集的视频数据,对主摄像头和辅摄像头进行参数同步。当满足摄像头切换条件时,视频模块对经过参数同步后的辅摄像头采集的视频数据进行优化处理,之后,输出辅摄像头采集的且经过优化处理后的视频数据给显示屏进行显示。具体实现可以参见下文所述的各个实施例。As an example of the present application, if the camera application detects the user's focusing operation, before the camera switching condition is met, the camera application sends a camera pre-start instruction to the video module of the HAL layer. In an example, the camera pre-start instruction carries a target camera identifier, and the target camera identifier is used to indicate the auxiliary camera to be started. After receiving the camera pre-start instruction, the video module notifies the camera driver to control the power-on of the auxiliary camera according to the camera pre-start instruction, so as to start the auxiliary camera in advance for video data collection before switching, and then, according to the video data collected by the auxiliary camera and the main camera The video data of the main camera and the auxiliary camera are synchronized. When the camera switching condition is satisfied, the video module optimizes the video data collected by the auxiliary camera after parameter synchronization, and then outputs the optimized video data collected by the auxiliary camera for display on the display screen. For specific implementation, reference may be made to the various embodiments described below.
在介绍完本申请实施例涉及的名词和执行主体后,接下来以电子设备是包括多个后置摄像头的手机为例,对本申请实施例涉及的应用场景进行介绍。After introducing the nouns and execution subjects involved in the embodiments of the present application, the application scenarios involved in the embodiments of the present application will be introduced next by taking the electronic device as a mobile phone including multiple rear cameras as an example.
手机中存在相机应用程序,请参考图4中的(a)图,在一个实施例中,用户想要通过手机拍摄夜景视频,此时,用户可以点击手机中的相机应用程序的应用图标。响应于用户对相机应用程序的应用图标的触发操作,手机启动后置摄像头中的主摄像头,并为用户展示如图4中的(b)图所示的第一界面。There is a camera application program in the mobile phone, please refer to (a) figure in Figure 4, in one embodiment, the user wants to take night scene video by mobile phone, at this moment, the user can click the application icon of the camera application program in the mobile phone. In response to the user's trigger operation on the application icon of the camera application, the mobile phone starts the main camera in the rear camera, and displays the first interface as shown in (b) in FIG. 4 for the user.
作为本申请的一个示例,第一界面中提供有“夜景”选项41,用户可以触发“夜景”选项41,响应于用户对“夜景”选项41的触发操作,手机展示夜景模式下的操作界面(称为第二界面),示例性地,第二界面如图4中的(c)图所示。第二界面中提供有第一切换选项42和第二切换选项43,其中,第一切换选项43用于在前置摄像头和后置摄像头之间进行切换。第二切换选项43用于在拍照模式和视频拍摄模式之间进行切换。As an example of the present application, a "night scene" option 41 is provided in the first interface, the user can trigger the "night scene" option 41, and in response to the user's trigger operation on the "night scene" option 41, the mobile phone displays the operation interface in the night scene mode ( referred to as the second interface), for example, the second interface is shown in (c) in FIG. 4 . The second interface provides a first switching option 42 and a second switching option 43, wherein the first switching option 43 is used to switch between the front camera and the rear camera. The second switch option 43 is used to switch between the camera mode and the video capture mode.
在一个示例中,在进入夜景模式后,也即在从图4中的(b)图切换到图4中的(c)图后,手机默认处于拍照模式(本申请实施例以该种模式为例进行说明),当用户想要拍摄夜景视频时,可以触发第二切换选项43,响应于用户对第二切换选项43的触发操作,手机从拍照模式切换至视频拍摄模式。In one example, after entering the night scene mode, that is, after switching from (b) in FIG. 4 to (c) in FIG. Example), when the user wants to shoot a night scene video, the second switch option 43 can be triggered, and in response to the trigger operation of the second switch option 43 by the user, the mobile phone switches from the camera mode to the video capture mode.
在另一个示例中,在进入夜景模式后,也即在从图4中的(b)图切换到图4中的(c)图后,手机也可以默认处于视频拍摄模式,在该种情况下,若用户想要拍摄夜景图像,可以触发第二切换选项43,响应于用户对第二切换选项43的触发操作,手机从视频拍摄模式切换至拍照模式。In another example, after entering the night scene mode, that is, after switching from (b) in Figure 4 to (c) in Figure 4, the mobile phone can also be in the video shooting mode by default, in this case , if the user wants to take a night scene image, the second switch option 43 can be triggered, and in response to the trigger operation of the second switch option 43 by the user, the mobile phone switches from the video shooting mode to the camera mode.
在一个实施例中,第二界面中还提供有拍摄选项44,用户可以触发拍摄选项44。响应于用户对拍摄选项44的触发操作,手机通过摄像头(如主摄像头)录制视频,譬如请继续参考图4,视频录制界面如图4中的(d)图所示。作为本申请的一个示例,在夜景场景下,手机通过本申请提供的方法对摄像头采集的视频数据进行处理,从而使得最终能够拍摄出画面清晰的视频帧。其中这里所述的画面清晰是指高亮区域不会过于曝光,暗调区域不会过暗。In one embodiment, a shooting option 44 is also provided in the second interface, and the user can trigger the shooting option 44 . In response to the user's trigger operation on the shooting option 44, the mobile phone records a video through a camera (such as a main camera). For example, please continue to refer to FIG. 4 , and the video recording interface is shown in (d) in FIG. 4 . As an example of the present application, in a night scene, the mobile phone processes the video data collected by the camera through the method provided in the present application, so that a clear video frame can be captured finally. The clarity of the picture mentioned here means that the highlighted areas will not be overexposed, and the dark areas will not be too dark.
在一个示例中,请继续参考图4中的(d)图,视频录制界面中提供有暂停选项45。在视频录制过程中,当用户想要暂停视频录制时,可以触发暂停选项45,响应于用户对暂停选项45的触发操作,手机暂停视频录制。In an example, please continue to refer to figure (d) in FIG. 4 , a pause option 45 is provided in the video recording interface. During the video recording process, when the user wants to pause the video recording, the pause option 45 can be triggered, and in response to the user's trigger operation on the pause option 45, the mobile phone pauses the video recording.
在一个示例中,请继续参考图4中的(d)图,视频录制界面中提供有抓拍选项46。在视频录制过程中,当用户想要抓拍某个视频帧时,可以触发抓拍选项46,响应于用户对抓拍选项46的触发操作,手机执行抓拍操作,并存储抓拍到的视频帧。In an example, please continue to refer to figure (d) in FIG. 4 , a snapshot option 46 is provided in the video recording interface. During the video recording process, when the user wants to capture a certain video frame, the capture option 46 can be triggered. In response to the trigger operation of the capture option 46 by the user, the mobile phone performs a capture operation and stores the captured video frame.
请参考图5,第一界面中提供有“更多”选项51。作为本申请的一个示例,当用 户想要拍摄夜景视频时,可以触发“更多”选项51。响应于用户对“更多”选项51的触发操作,手机展示第三界面,譬如第三界面如图5中的(b)图所示。作为本申请的一个示例,在第三界面中提供有“夜景录像”选项52,“夜景录像”选项52用于触发夜景场景下的视频录制功能,也即相比于图4所示的示例,这里也可以单独设立一个用于拍摄夜景视频的选项。当用户想要通过手机录制夜景视频时可以触发“夜景录像”选项52。响应于用户对“夜景录像”选项52的触发操作,手机展示夜景模式下的操作界面(称为第四界面),示例性地,第四界面如图5中的(c)图所示。Please refer to FIG. 5 , there is a "more" option 51 in the first interface. As an example of the present application, when the user wants to take a night scene video, the "more" option 51 can be triggered. In response to the user's trigger operation on the "more" option 51, the mobile phone displays a third interface, for example, the third interface is shown in (b) of FIG. 5 . As an example of the present application, a "night scene recording" option 52 is provided in the third interface, and the "night scene recording" option 52 is used to trigger the video recording function under the night scene scene, that is, compared to the example shown in FIG. 4, Here you can also set up an option for shooting night scene videos separately. When the user wants to record the night scene video through the mobile phone, the option 52 of "night scene recording" can be triggered. In response to the user's trigger operation on the "night scene recording" option 52, the mobile phone displays an operation interface (called the fourth interface) in the night scene mode. Exemplarily, the fourth interface is shown in (c) in FIG. 5 .
在一个实施例中,第四界面中提供有拍摄选项53,用户可以触发拍摄选项53。响应于用户对拍摄选项53的触发操作,手机通过摄像头(如主摄像头)录制视频,譬如,视频录制界面如图5中的(d)图所示。另外,第四界面中还可以提供有第一切换选项54,第一切换选项54用于在前置摄像头和后置摄像头之间进行切换。与图4所示实施例不同的是,这里不需要在第四界面中提供第二切换选项,也即单独在“更多”选项下提供用于触发夜景视频录制的“夜景录像”选项52。In one embodiment, a shooting option 53 is provided on the fourth interface, and the user can trigger the shooting option 53 . In response to the user's trigger operation on the shooting option 53, the mobile phone records a video through a camera (such as a main camera). For example, the video recording interface is shown in (d) in FIG. 5 . In addition, a first switching option 54 may also be provided in the fourth interface, and the first switching option 54 is used to switch between the front camera and the rear camera. Different from the embodiment shown in FIG. 4 , there is no need to provide the second switching option in the fourth interface, that is, the “night scene recording” option 52 for triggering night scene video recording is provided separately under the “more” option.
作为本申请的一个示例,请参考图6中的(a)图,视频录制界面中提供有用于调焦的调焦项47。在视频录制过程中,当用户想要调焦时,可以触发调焦项47,譬如从1倍焦向长焦调整,比如调整至多倍焦(如2倍焦),或者从1倍焦向广角调整,比如调整至0.8倍焦。响应于用户对调焦项47的触发操作,手机对主摄像头进行调焦,或者切换至其他辅摄像头进行视频采集。譬如,当用户从1倍焦调整至n倍焦,n大于1且小于2时,手机对主摄像头进行调焦,当n大于或等于2时,手机从主摄像头切换至长焦摄像头。再如,当用户从1倍焦向广角调整时,手机从主摄像头切换至广角摄像头。在调焦过程中,为了便于用户获知当前调整到多少倍焦,手机显示当前的调焦结果,譬如请参考图6中的(b)图,以用户向长焦调整为例,手机在调焦项47附近显示当前的调焦结果,显示效果如图6中的61所示。As an example of the present application, please refer to diagram (a) in FIG. 6 , the video recording interface provides a focusing item 47 for focusing. During the video recording process, when the user wants to focus, the focus adjustment item 47 can be triggered, such as adjusting from 1x focus to telephoto, such as adjusting to multi-fold focus (such as 2x focus), or from 1x focus to wide-angle Adjustment, such as adjusting to 0.8 times focus. In response to the user's trigger operation on the focusing item 47, the mobile phone focuses on the main camera, or switches to other auxiliary cameras for video collection. For example, when the user adjusts from 1x focus to nx focus, when n is greater than 1 and less than 2, the mobile phone will focus on the main camera, and when n is greater than or equal to 2, the mobile phone will switch from the main camera to the telephoto camera. For another example, when the user adjusts from 1x focus to wide-angle, the mobile phone switches from the main camera to the wide-angle camera. During the focusing process, in order to facilitate the user to know how much focus is currently adjusted, the mobile phone displays the current focusing result. For example, please refer to (b) in Figure 6. Take the user’s adjustment to the telephoto as an example. The current focusing result is displayed near item 47, and the display effect is shown as 61 in FIG. 6 .
作为本申请的另一个示例,手机在通过辅摄像头拍摄视频时,当基于调焦项47检测到用户的调焦操作时,从辅摄像头向主摄像头切换。示例性地,手机在通过长焦摄像头拍摄视频,当基于调焦项47检测到用户的调焦操作,且调焦结果为1倍焦时,从长焦摄像头切换回主摄像头。As another example of the present application, when the mobile phone is shooting video through the auxiliary camera, when a user's focusing operation is detected based on the focusing item 47, the mobile phone switches from the auxiliary camera to the main camera. Exemplarily, when the mobile phone is shooting video with the telephoto camera, when the user's focusing operation is detected based on the focusing item 47, and the focusing result is 1x focus, the telephoto camera is switched back to the main camera.
在本申请实施例中,当从一个摄像头切换至另一个摄像头时,若两个摄像头之间存在预留时间,也即从一个摄像头切换至另一个摄像头不是立即进行切换,而是当调焦结果满足切换条件时才进行切换,譬如当从1倍焦调至3倍焦时,从主摄像头切换至长焦摄像头,但在3倍焦之前未进行切换。该种情况下,手机可以实现平滑切换,从用户视觉角度来说,调焦前后的视频画面差异不大,且在摄像头切换时刻用户是无感知的。另外,无论是调焦前还是调焦后,均可以对当前进行视频录制的摄像头所采集的视频数据进行处理,以使得最终得到画面清晰的视频帧。In this embodiment of the application, when switching from one camera to another camera, if there is a reserved time between the two cameras, that is, switching from one camera to another camera is not performed immediately, but when the focus adjustment result Switching is only performed when the switching conditions are met, for example, when adjusting from 1x focus to 3x focus, switch from the main camera to the telephoto camera, but do not switch before 3x focus. In this case, the mobile phone can achieve smooth switching. From the perspective of the user's vision, there is not much difference between the video images before and after focusing, and the user is not aware of the camera switching moment. In addition, no matter before or after the focus adjustment, the video data collected by the camera currently performing video recording can be processed, so that a clear video frame can be finally obtained.
当然需要说明的是,上述是以夜景拍摄为例进行说明,在另一个实施例中,本申请实施例提供的方法还可以应用于常规的视频录制场景,譬如可以参考图5中的(a)图,在用户通过“录像”选项触发电子设备执行视频录制后,电子设备仍可以采用本申请实施例提供的方法进行摄像头切换以及对采集的视频数据进行优化处理。在另一个实施例中,该方法还可以应用于相机预览场景,也即电子设备在启动相机进入预览 状态时,可以采用本申请实施例提供的方法进行摄像头切换以及对预览图像进行处理。Of course, it should be noted that the above is described by taking night scene shooting as an example. In another embodiment, the method provided by the embodiment of the present application can also be applied to a conventional video recording scene. For example, refer to (a) in FIG. 5 As shown in the figure, after the user triggers the electronic device to perform video recording through the "recording" option, the electronic device can still use the method provided by the embodiment of the present application to switch between cameras and optimize the collected video data. In another embodiment, the method can also be applied to the camera preview scene, that is, when the electronic device starts the camera and enters the preview state, it can switch the camera and process the preview image using the method provided in the embodiment of the present application.
接下来结合图3所示的系统架构对本申请实施例提供的摄像头的切换方法实现流程进行详细介绍。作为示例而非限定,该方法应用于电子设备中,电子设备通过图3所示的各个节点之间的交互实现。这里以从主摄像头向辅摄像头切换为例进行说明。请参考图7,首先介绍电子设备对主摄像头的视频数据的处理流程,具体可以包括如下几个实现步骤:Next, in combination with the system architecture shown in FIG. 3 , the implementation process of the camera switching method provided by the embodiment of the present application will be introduced in detail. As an example but not a limitation, the method is applied to an electronic device, and the electronic device is implemented through the interaction between various nodes shown in FIG. 3 . Here, switching from the primary camera to the secondary camera is taken as an example for illustration. Please refer to Figure 7, firstly introduce the processing flow of the video data of the main camera by the electronic device, which may specifically include the following implementation steps:
701:图像感应器节点获取第一RAW数据。701: The image sensor node acquires first RAW data.
作为本申请的一个示例,第一RAW数据是通过主摄像头的图像感应器输出的RAW数据。在实施中,电子设备启动相机应用程序后,若相机应用程序检测到超夜视频模式下的视频拍摄的触发操作,则响应于该触发操作,相机应用程序向视频模块下发夜景视频拍摄请求。示例性地,请参考图4实施例中的交互流程,电子设备在基于第二界面提供的第二切换选项检测到进入超夜视频模式后,若检测到用户对拍摄选项44的触发操作,则生成夜景视频拍摄请求,并向视频模块下发夜景视频拍摄请求。视频模块接收夜景视频拍摄请求后,建立起用于处理夜景视频的框架,具体实现可以参见前文。之后,图像感应器节点通过主摄像头中的图像感应器采集捕捉光源信号,并将捕捉到的光源信号转化为数据信号,得到第一RAW数据。示例性地,第一RAW数据为4K60的交错式高动态域(staggered high dynamic range,SHDR)数据,其中4K60是指分辨率是4K、帧率是60帧/秒。As an example of the present application, the first RAW data is the RAW data output by the image sensor of the main camera. In implementation, after the electronic device starts the camera application, if the camera application detects a trigger operation of video shooting in the super night video mode, in response to the trigger operation, the camera application sends a night scene video shooting request to the video module. Exemplarily, please refer to the interaction flow in the embodiment of FIG. Generate a night scene video shooting request, and send the night scene video shooting request to the video module. After the video module receives the night scene video shooting request, it establishes a framework for processing the night scene video, and the specific implementation can be referred to above. Afterwards, the image sensor node collects and captures the light source signal through the image sensor in the main camera, and converts the captured light source signal into a data signal to obtain the first RAW data. Exemplarily, the first RAW data is 4K60 interlaced high dynamic range (staggered high dynamic range, SHDR) data, where 4K60 means that the resolution is 4K and the frame rate is 60 frames per second.
在一个实施例中,第一RAW数据包括长曝光数据和短曝光数据,长曝光数据是指图像感应器通过长曝光方式采集的数据,短曝光数据是指图像感应器通过短曝光方式采集的数据。也即在一个曝光时长内进行两次曝光,以得到第一RAW数据。示例性地,以第一RAW数据为4K60的SHDR数据为例,主摄像头在每个33ms内曝光两次,如此得到60帧的视频数据。In one embodiment, the first RAW data includes long exposure data and short exposure data, the long exposure data refers to the data collected by the image sensor through the long exposure method, and the short exposure data refers to the data collected by the image sensor through the short exposure method . That is, two exposures are performed within one exposure time to obtain the first RAW data. Exemplarily, taking the first RAW data as 4K60 SHDR data as an example, the main camera exposes twice within each 33ms, thus obtaining 60 frames of video data.
值得一提的是,长短曝光结合,可以有效的提升视频帧的动态范围,高亮区域通过短曝光防止过曝,暗部通过长曝光提亮以防止欠曝光。It is worth mentioning that the combination of long and short exposures can effectively improve the dynamic range of the video frame. Short exposures are used to prevent overexposure in highlighted areas, and long exposures are used to brighten dark areas to prevent underexposure.
702:图像感应器节点向外置ISP节点发送第一RAW数据。702: The image sensor node sends the first RAW data to the external ISP node.
示例性地,图像感应器节点将4K60的SHDR数据发送给外置ISP节点,以通过外置ISP节点进行融合、增强等处理。Exemplarily, the image sensor node sends the 4K60 SHDR data to the external ISP node for processing such as fusion and enhancement through the external ISP node.
作为本申请的一个示例,第一RAW数据先到达外置ISP节点中的路由子模块。As an example of the present application, the first RAW data first arrives at the routing submodule in the external ISP node.
703:路由子模块对第一RAW数据进行复制、路由处理。703: The routing submodule performs copying and routing processing on the first RAW data.
电子设备在夜景场景中拍摄视频时,为了能够得到清晰的视频帧,一方面,可以对第一RAW数据进行增强等处理,另一方面,可以根据第一RAW数据统计曝光数据,得到第一曝光数据,之后根据第一曝光数据动态调整主摄像头的曝光参数。When an electronic device shoots a video in a night scene, in order to obtain a clear video frame, on the one hand, it can perform processing such as enhancement on the first RAW data; on the other hand, it can calculate the exposure data according to the first RAW data to obtain the first exposure data, and then dynamically adjust the exposure parameters of the main camera according to the first exposure data.
为此,作为本申请的一个示例,由外置ISP节点中的路由子模块对第一RAW数据进行复制、路由处理。在实施中,路由子模块对第一RAW数据进行复制,得到另一份RAW数据,这里称为第五RAW数据。之后,对第一RAW数据和第五RAW数据进行路由处理,具体地,路由子模块将第一RAW数据和第五RAW数据中的一份RAW数据(譬如第一RAW数据)传输给第一预处理子模块进行处理,另一份RAW 数据(譬如第五RAW数据)用于后续内置ISP节点统计第一曝光数据。Therefore, as an example of the present application, the routing sub-module in the external ISP node performs copying and routing processing on the first RAW data. In an implementation, the routing submodule copies the first RAW data to obtain another copy of RAW data, which is called fifth RAW data here. Afterwards, routing processing is performed on the first RAW data and the fifth RAW data. Specifically, the routing submodule transmits a piece of RAW data (such as the first RAW data) in the first RAW data and the fifth RAW data to the first preset The processing sub-module performs processing, and another piece of RAW data (for example, the fifth RAW data) is used for subsequent built-in ISP nodes to count the first exposure data.
需要说明的是,上述是以将第一RAW数据传输给第一预处理子模块,以及将第五RAW数据传输给内置ISP节点为例。在另一实施例中,也可以将第一RAW数据传输给内置ISP节点,以及将第五RAW数据传输给第一预处理子模块,本申实施例对此不作限定。It should be noted that the above is an example of transmitting the first RAW data to the first preprocessing submodule and transmitting the fifth RAW data to the built-in ISP node. In another embodiment, the first RAW data may also be transmitted to the built-in ISP node, and the fifth RAW data may be transmitted to the first preprocessing submodule, which is not limited in this embodiment.
接下来以路由子模块将第一RAW数据传输给第一预处理子模块、以及将第五RAW数据传输给内置ISP节点以用于统计第一曝光数据为例进行说明。Next, the routing sub-module transmits the first RAW data to the first pre-processing sub-module, and transmits the fifth RAW data to the built-in ISP node for the purpose of counting the first exposure data as an example.
704:第一预处理子模块对第一RAW数据进行预处理。704: The first preprocessing submodule performs preprocessing on the first RAW data.
由于受到主摄像头的物理器件不理想等因素的影响,可能导致第一RAW数据存在一定的缺陷,譬如存在受到暗电流影响、图像周边的亮度衰减,以及存在坏点等问题,所以通常在对第一RAW数据进行融合和降噪处理之前,第一预处理子模块先对第一RAW数据进行预处理,以对第一RAW数据进行修正。Due to the influence of factors such as the unsatisfactory physical components of the main camera, there may be certain defects in the first RAW data, such as the influence of dark current, the brightness attenuation around the image, and the existence of dead pixels. Before performing fusion and noise reduction processing on the RAW data, the first preprocessing submodule first preprocesses the first RAW data, so as to correct the first RAW data.
作为示例而非限定,预处理包括但不限于镜头校正(lens shading correction,LSC)处理、黑电平补偿(black level compensation,BLC)处理、坏像素校正(bad pixel correction,BPC处理)、颜色插值处理中的至少一项。As an example and not limitation, preprocessing includes but is not limited to lens shading correction (LSC) processing, black level compensation (black level compensation, BLC) processing, bad pixel correction (bad pixel correction, BPC processing), color interpolation At least one of the processing.
705:第一预处理子模块将预处理后的第一RAW数据发送给增强子模块。705: The first preprocessing submodule sends the preprocessed first RAW data to the enhancement submodule.
譬如,第一预处理子模块将预处理后的4K60的SHDR数据发送给增强子模块。For example, the first preprocessing submodule sends the preprocessed 4K60 SHDR data to the enhancement submodule.
706:增强子模块对预处理后的第一RAW数据进行融合和降噪处理。706: The enhancement submodule performs fusion and noise reduction processing on the preprocessed first RAW data.
作为本申请的一个示例,对预处理后的第一RAW数据进行融合处理的具体实现可以包括:将预处理后的第一RAW数据输入至第二目标模型中进行处理,输出融合RAW数据。第二目标模型能够对任意的长曝光数据和短曝光数据进行融合处理。As an example of the present application, the specific implementation of performing fusion processing on the preprocessed first RAW data may include: inputting the preprocessed first RAW data into the second target model for processing, and outputting the fusion RAW data. The second target model can perform fusion processing on arbitrary long-exposure data and short-exposure data.
示例性地,若预处理后的第一RAW数据是4K60的SHDR数据,则将4K60的SHDR数据输入至第二目标模型中,经过融合处理后得到的融合RAW数据是4K30数据。也即第二目标模型在做融合处理时,是将同一时间段内经连续两次曝光得到的长曝光数据和短曝光数据进行融合,所以对于融合前的60帧数据,经过融合处理后即变为30帧。如此通过融合处理可以提高视频数据的信噪比和动态范围。Exemplarily, if the preprocessed first RAW data is 4K60 SHDR data, the 4K60 SHDR data is input into the second target model, and the fused RAW data obtained after fusion processing is 4K30 data. That is to say, when the second target model performs fusion processing, it fuses the long-exposure data and short-exposure data obtained through two consecutive exposures in the same period of time, so the 60 frames of data before fusion become 30 frames. In this way, the signal-to-noise ratio and dynamic range of video data can be improved through fusion processing.
其中,第二目标模型可以是预先训练好的融合网络模型。譬如第二目标模型可以是基于曝光样本数据对第二网络模型进行训练后得到的。在一个示例中,第二网络模型可以包括但不限于HDRnet。Wherein, the second target model may be a pre-trained fusion network model. For example, the second target model may be obtained after training the second network model based on the exposure sample data. In one example, the second network model may include, but is not limited to, HDRnet.
之后,对融合后得到的融合RAW数据进行降噪处理。作为本申请的一个示例,对融合RAW数据进行降噪处理的具体实现可以包括:将融合RAW数据输入至主摄像头对应的第三目标模型中进行处理,输出降噪后的视频数据。第三目标模型能够对任意的视频数据进行降噪处理。Afterwards, noise reduction processing is performed on the fused RAW data obtained after fusion. As an example of the present application, the implementation of denoising the fused RAW data may include: inputting the fused RAW data into a third object model corresponding to the main camera for processing, and outputting the noise-reduced video data. The third target model can perform noise reduction processing on arbitrary video data.
其中,第三目标模型可以是预先训练好的降噪网络模型。譬如第三目标模型可以是基于RAW样本数据对第三网络模型进行训练后得到的。在一个示例中,第三网络模型可以包括但不限于Unet。Wherein, the third target model may be a pre-trained denoising network model. For example, the third target model may be obtained after training the third network model based on the RAW sample data. In one example, the third network model may include, but is not limited to, Unet.
需要说明的是,外置ISP节点通过第一预处理子模块对第一RAW数据进行预处理是可选地,在另一实施例中,也可以直接将第一RAW发送给增强子模块,由增强子模块对第一RAW数据进行融合和降噪处理。It should be noted that it is optional for the external ISP node to preprocess the first RAW data through the first preprocessing submodule. In another embodiment, the first RAW may also be directly sent to the enhancement submodule, by The enhancement sub-module performs fusion and noise reduction processing on the first RAW data.
707:增强子模块输出降噪处理后的视频数据,以及路由子模块输出第五RAW数据。707: The enhancement submodule outputs the video data after noise reduction processing, and the routing submodule outputs fifth RAW data.
具体地,增强子模块将降噪处理后的视频数据发送给内置ISP节点,以及路由子模块将第五RAW数据也发送给内置ISP节点。内置ISP节点通过第二预处理子模块接收该视频数据和第五RAW数据。不难理解,增强子模块输出的视频数据是4K30数据,用于浏览和记录;路由子模块输出的第五RAW数据是4K60数据,用于计算3A和可能的拍照需求。Specifically, the enhancement submodule sends the noise-reduced video data to the built-in ISP node, and the routing submodule also sends the fifth RAW data to the built-in ISP node. The built-in ISP node receives the video data and the fifth RAW data through the second preprocessing submodule. It is not difficult to understand that the video data output by the enhancement sub-module is 4K30 data, which is used for browsing and recording; the fifth RAW data output by the routing sub-module is 4K60 data, which is used for calculating 3A and possible camera needs.
需要说明的是,由于外置ISP节点对主摄像头的第一RAW数据进行了融合、降噪等处理,所以,外置ISP节点输出的视频数据与主摄像头输出的第一RAW数据之间一般会存在一定的时延。比如存在一帧的时延,举例来说,若主摄像头输出的是t时刻的第一RAW数据,则同时外置ISP节点输出的是t-1时刻的视频数据。It should be noted that since the external ISP node performs fusion and noise reduction processing on the first RAW data of the main camera, there is generally a gap between the video data output by the external ISP node and the first RAW data output by the main camera. There is a certain delay. For example, there is a delay of one frame. For example, if the main camera outputs the first RAW data at time t, the external ISP node outputs video data at time t-1 at the same time.
另外,外置ISP节点控制增强子模块与路由子模块同步输出,也即降噪处理后的视频数据与第五RAW数据同步传输至第二预处理子模块。In addition, the external ISP node controls the synchronous output of the enhancement sub-module and the routing sub-module, that is, the noise-reduced video data and the fifth RAW data are synchronously transmitted to the second pre-processing sub-module.
708:第二预处理子模块对增强子模块输出的视频数据进行处理,以及基于第五RAW数据统计第一曝光数据,调整曝光参数。708: The second preprocessing submodule processes the video data output by the enhancement submodule, and calculates the first exposure data based on the fifth RAW data, and adjusts the exposure parameters.
作为本申请的一个示例,第二预处理子模块对增强子模块输出的视频数据的处理包括:对增强子模块输出的视频数据再次进行预处理,譬如可以包括但不限于LSC处理、BLC处理、BPC处理、颜色插值处理中的至少一项,以进一步减小视频数据的噪声。之后,将经过再次预处理后的视频数据进行RGB转换,并对RGB转换后得到的视频图像进行压缩处理,得到YUV图像。As an example of the present application, the processing of the video data output by the enhancement submodule by the second preprocessing submodule includes: performing preprocessing again on the video data output by the enhancement submodule, such as but not limited to LSC processing, BLC processing, At least one of BPC processing and color interpolation processing to further reduce the noise of the video data. Afterwards, RGB conversion is performed on the preprocessed video data again, and the video image obtained after the RGB conversion is compressed to obtain a YUV image.
需要说明的是,本申请实施例中所述的第二预处理子模块再次对增强子模块输出的视频数据进行预处理是可选的,在另一个实施例中,第二预处理子模块也可以直接基于增强子模块输出的视频数据进行RGB转换,本申请实施例对此不作限定。It should be noted that it is optional for the second preprocessing submodule described in the embodiment of the present application to preprocess the video data output by the enhancement submodule again. In another embodiment, the second preprocessing submodule also The RGB conversion may be performed directly based on the video data output by the enhancement sub-module, which is not limited in this embodiment of the present application.
另外,第二预处理子模块基于第五RAW数据确定第一曝光数据,并根据第一曝光数据确定当前的曝光程度是否合理,若不合理,再去调整主摄像头的曝光参数。其中第一曝光数据的取值范围是(0,255)。在一个示例中,第二预处理子模块将第一曝光数据与曝光阈值进行比较,若第一曝光数据与曝光阈值之间的差值大于阈值范围,则按照一定的调整步长逐渐调整第一曝光数据,得到目标曝光数据。第二预处理子模块将目标曝光数据发送给主摄像头,以使得主摄像头调整图像感应器的曝光参数,最终的目的是使得根据主摄像头输出的第五RAW数据统计的曝光数据与曝光阈值接近或相同。In addition, the second preprocessing sub-module determines the first exposure data based on the fifth RAW data, and determines whether the current exposure level is reasonable according to the first exposure data, and then adjusts the exposure parameters of the main camera if it is not reasonable. The value range of the first exposure data is (0, 255). In one example, the second preprocessing submodule compares the first exposure data with the exposure threshold, and if the difference between the first exposure data and the exposure threshold is greater than the threshold range, gradually adjusts the first Exposure data to obtain target exposure data. The second preprocessing sub-module sends the target exposure data to the main camera, so that the main camera adjusts the exposure parameters of the image sensor. The ultimate goal is to make the exposure data calculated according to the fifth RAW data output by the main camera close to or same.
其中,调整步长可以根据实际需求进行设置。曝光阈值可以根据实际需求进行设置。阈值范围也可以根据实际需求进行设置。Wherein, the adjustment step size may be set according to actual requirements. The exposure threshold can be set according to actual needs. The threshold range can also be set according to actual needs.
譬如,曝光阈值为128,阈值范围为[0,5],调整步长为4。若第一曝光数据为86,说明需要提高曝光参数,此时可以按照调整步长调整第一曝光数据,得到目标曝光数据为90。第二预处理子模块将目标曝光数据90发送给主摄像头,以使主摄像头将图像感应器的曝光参数调整为90。并再次根据下次接收的第五RAW数据统计曝光数据,按照上述方法调整图像感应器的曝光参数,直到统计的曝光数据接近或等于128为止。For example, the exposure threshold is 128, the threshold range is [0,5], and the adjustment step is 4. If the first exposure data is 86, it means that the exposure parameter needs to be increased. At this time, the first exposure data can be adjusted according to the adjustment step to obtain a target exposure data of 90. The second preprocessing sub-module sends the target exposure data 90 to the main camera, so that the main camera adjusts the exposure parameter of the image sensor to 90. The exposure data is again counted according to the fifth RAW data received next time, and the exposure parameters of the image sensor are adjusted according to the above method until the counted exposure data is close to or equal to 128.
值得一提的是,通过逐步调整曝光数据的方式使得主摄像头的曝光参数与曝光阈 值相接近或相同,可以使得视频帧的曝光变化平滑过度。It is worth mentioning that by adjusting the exposure data step by step so that the exposure parameters of the main camera are close to or the same as the exposure threshold, the exposure changes of the video frames can be smoothly transitioned.
作为本申请的一个示例,第二预处理子模块除了基于第五RAW数据统计第一曝光数据之外,还可以基于第五RAW数据统计第一AWB、第一AF和第一FOV。在一个示例中,第二预处理子模块将第一AWB发送给优化处理子模块,以便于优化处理子模块在图像优化处理过程中进行白平衡调整。另外第二预处理子模块将第一AF发送给主摄像头,以便于主摄像头根据第一AF进行调整处理。在一个示例中,将第一AWB、第一曝光数据、第一AF、第一FOV作为第一摄像信息,第一摄像信息可以用于后续在摄像头切换过程中进行参数同步。As an example of the present application, in addition to counting the first exposure data based on the fifth RAW data, the second preprocessing submodule may also count the first AWB, the first AF and the first FOV based on the fifth RAW data. In an example, the second preprocessing submodule sends the first AWB to the optimization processing submodule, so that the optimization processing submodule can perform white balance adjustment during image optimization processing. In addition, the second preprocessing sub-module sends the first AF to the main camera, so that the main camera performs adjustment processing according to the first AF. In an example, the first AWB, the first exposure data, the first AF, and the first FOV are used as the first imaging information, and the first imaging information may be used for subsequent parameter synchronization during camera switching.
709:第二预处理子模块向优化处理子模块发送YUV图像和目标曝光数据。709: The second preprocessing submodule sends the YUV image and target exposure data to the optimization processing submodule.
根据前文所述可知,目标曝光数据是根据第一曝光数据确定的。譬如,若第一曝光数据是100,第二预处理子模块确定需要将主摄像头的曝光参数调整至200,则目标曝光数据是200。According to the foregoing, it can be known that the target exposure data is determined according to the first exposure data. For example, if the first exposure data is 100, and the second preprocessing submodule determines that the exposure parameter of the main camera needs to be adjusted to 200, then the target exposure data is 200.
作为本申请的一个示例,由于第二预处理子模块对主摄像头的曝光参数进行了调整,所以后续通过主摄像头获得的视频数据的增益发生了变化,为了能够便于优化处理子模块对下一次接收到的YUV图像进行合理的降噪处理,第二预处理子模块在调整主摄像头的曝光参数的同时,将目标曝光数据发送给优化处理子模块,便于优化处理子模块确定降噪参数,从而根据降噪参数对下一次接收到YUV图像进行合理的降噪处理。As an example of the present application, since the second preprocessing submodule adjusts the exposure parameters of the main camera, the gain of the video data obtained through the main camera subsequently changes. The YUV image obtained is reasonably de-noised. The second pre-processing sub-module adjusts the exposure parameters of the main camera and sends the target exposure data to the optimization processing sub-module, which is convenient for the optimization processing sub-module to determine the noise reduction parameters. The noise reduction parameter performs reasonable noise reduction processing on the next received YUV image.
作为本申请的一个示例,外置ISP节点中包括与主摄像头对应的多个第三目标模型,多个第三目标模型中的每个第三目标模型对应有曝光数值范围,每个第三目标模型对应的曝光数值范围的数量可以为一个或者多个。根据前文所述可知,第三目标模型能够用于降噪处理,同理,为了能够对下一次的视频数据进行合理的降噪处理,第二预处理子模块还可以将目标曝光数据发送给外置ISP节点,以便于外置ISP节点确定第二预处理子模块反馈的目标曝光数据所属的曝光数值范围,从而根据所确定的曝光数值范围,从多个第三目标模型中选择对应的第三目标模型,选择的第三目标模型用于下一次的降噪处理。As an example of this application, the external ISP node includes multiple third target models corresponding to the main camera, each third target model in the multiple third target models corresponds to an exposure value range, and each third target The number of exposure value ranges corresponding to the model may be one or more. According to the foregoing, it can be seen that the third target model can be used for noise reduction processing. Similarly, in order to perform reasonable noise reduction processing on the next video data, the second preprocessing sub-module can also send the target exposure data to external Set the ISP node so that the external ISP node can determine the exposure value range to which the target exposure data fed back by the second preprocessing sub-module belongs, so that according to the determined exposure value range, the corresponding third target model can be selected from multiple third target models. The target model, the selected third target model is used for the next noise reduction process.
710:优化处理子模块基于接收的数据进行图像优化处理。710: The optimization processing submodule performs image optimization processing based on the received data.
优化处理子模块根据目标曝光数据对YUV图像进行优化,譬如对YUV图像进行降噪处理,从而得到画面清晰、明朗的视频帧。The optimization processing sub-module optimizes the YUV image according to the target exposure data, such as performing noise reduction processing on the YUV image, so as to obtain a clear and bright video frame.
711:优化处理子模块将得到的视频帧送显。711: The optimization processing submodule sends the obtained video frame to display.
也即,优化处理子模块将图像优化处理后得到的视频帧发送给显示屏进行显示。That is, the optimization processing sub-module sends the video frames obtained after the image optimization processing to the display screen for display.
值得一提的是,在超夜视频模式下,通过外置ISP对视频数据进行融合和图像增强处理,将处理后的视频数据发送给内置ISP,并为内置ISP提供原始的视频数据。如此,内置ISP即可基于外置ISP提供的视频数据,生成清晰的视频帧,减小了内置ISP的运行负担,从而减小了SOC的功耗。It is worth mentioning that in the super night video mode, the video data is fused and image enhanced through the external ISP, the processed video data is sent to the built-in ISP, and the original video data is provided for the built-in ISP. In this way, the built-in ISP can generate clear video frames based on the video data provided by the external ISP, which reduces the operating burden of the built-in ISP, thereby reducing the power consumption of the SOC.
在未调焦的情况下,电子设备按照上述实施例的流程对主摄像头的视频数据进行处理,输出高清晰度的视频帧。在一个实施例中,请参考图8,当电子设备检测到调焦操作时,执行如下操作:When the focus is not adjusted, the electronic device processes the video data of the main camera according to the procedures of the above embodiments, and outputs high-definition video frames. In one embodiment, please refer to FIG. 8, when the electronic device detects a focusing operation, it performs the following operations:
801:图像感应器节点根据摄像头预启动指令,启动辅摄像头。801: The image sensor node starts the auxiliary camera according to the camera pre-start instruction.
作为本申请的一个示例,摄像头预启动指令由相机应用程序下发。在一个示例中,相机应用程序检测到调焦操作,由于在一种可能的情况下,调焦操作可能会调至辅摄像头的视场范围,也即需要从主摄像头切换至辅摄像头进行拍摄。所以,为了避免摄像头切换时存在的卡顿问题,相机应用程序在未满足摄像头切换条件之前,向视频模块下发摄像头预启动指令,以通知视频模块提前启动辅摄像头。在一个示例中,摄像头预启动指令中携带目标摄像头标识,目标摄像头标识用于唯一标识一个辅摄像头。视频模块接收摄像头预启动指令后,可以通过图像感应器节点启动辅摄像头。其中图像感应器节点启动辅摄像头的具体过程可以参见前文,这里不再重复赘述。As an example of this application, the camera pre-start instruction is issued by the camera application program. In one example, the camera application detects a focus operation, because in a possible situation, the focus operation may be adjusted to the field of view of the secondary camera, that is, it needs to switch from the primary camera to the secondary camera for shooting. Therefore, in order to avoid the stuck problem when the camera is switched, the camera application program sends a camera pre-start command to the video module before the camera switching condition is met, so as to notify the video module to start the auxiliary camera in advance. In an example, the camera pre-start instruction carries a target camera identifier, and the target camera identifier is used to uniquely identify an auxiliary camera. After the video module receives the camera pre-start instruction, it can start the auxiliary camera through the image sensor node. The specific process of starting the auxiliary camera by the image sensor node can be referred to above, and will not be repeated here.
在一个示例中,摄像头切换条件可以根据主摄像头的视场角和/或辅摄像头的视场角确定。譬如,摄像头切换条件可以是指调焦操作对应的调焦值超过目标调焦值,目标调焦值对应的视场范围超过主摄像头的视场角,但小于辅摄像头的视场角。In an example, the camera switching condition may be determined according to the field of view angle of the main camera and/or the field of view angle of the auxiliary camera. For example, the camera switching condition may mean that the focus value corresponding to the focus operation exceeds the target focus value, and the field of view corresponding to the target focus value exceeds the field of view of the main camera but is smaller than the field of view of the auxiliary camera.
在一个实施例中,若检测到调焦操作,则在未满足摄像头切换条件之前,当调焦操作对应的调焦值与摄像头切换条件对应的目标调焦值之间的差值小于或等于预设数值时,启动辅摄像头。In one embodiment, if a focusing operation is detected, before the camera switching condition is met, when the difference between the focusing value corresponding to the focusing operation and the target focusing value corresponding to the camera switching condition is less than or equal to the preset When a value is set, the secondary camera is activated.
其中,预设数值可以根据实际需求进行设置。Wherein, the preset value can be set according to actual needs.
譬如,辅摄像头为长焦摄像头,目标调焦值为3倍焦,也即当调焦操作对应的调焦值达到3倍焦时,自动从主摄像头切换至长焦摄像头。另外,假设预设数值为0.3,则当调焦操作对应的调焦值达到2.7倍焦时,开始启动长焦摄像头。For example, the auxiliary camera is a telephoto camera, and the target focus value is 3x focus, that is, when the focus value corresponding to the focus operation reaches 3x focus, it will automatically switch from the main camera to the telephoto camera. In addition, assuming that the preset value is 0.3, when the focus value corresponding to the focus operation reaches 2.7 times focus, the telephoto camera starts to be activated.
需要说明的是,当存在多个辅摄像头时,由于多个辅摄像头中不同辅摄像头对应的视场角不同,因此,不同辅摄像头对应有一个摄像头切换条件,或者说,不同辅摄像头对应一个目标调焦值。It should be noted that when there are multiple auxiliary cameras, since the field of view angles corresponding to different auxiliary cameras in the multiple auxiliary cameras are different, different auxiliary cameras correspond to a camera switching condition, or in other words, different auxiliary cameras correspond to a target Focus value.
802:图像感应器节点获取第二RAW数据。802: The image sensor node acquires second RAW data.
第二RAW数据是通过辅摄像头的图像感应器输出的。也即电子设备在启动辅摄像头后,辅摄像头开始采集视频数据,图像感应节点获取辅摄像头采集的视频数据,得到第二RAW数据。在一个示例中,第二RAW数据可以为SHDR数据,在另一个示例中,第二RAW数据也可以为SDR数据。The second RAW data is output through the image sensor of the auxiliary camera. That is, after the electronic device starts the auxiliary camera, the auxiliary camera starts to collect video data, and the image sensing node obtains the video data collected by the auxiliary camera to obtain the second RAW data. In one example, the second RAW data may be SHDR data, and in another example, the second RAW data may also be SDR data.
在一个实施例中,第二RAW数据包括长曝光数据和短曝光数据。也即辅摄像头的图像感应器可以在每个曝光时间段内曝光两次,一次长曝光,一次短曝光,比如可以采用CMOS图像感应器在同一个时间段内曝光两次。如此可以使得后续将同一时间段内的长曝光数据和短曝光数据进行融合后输出高动态视频帧。示例性地,以第二RAW数据为4K60的SHDR数据为例,辅摄像头在每个33ms内曝光两次,如此得到60帧/秒的视频数据。In one embodiment, the second RAW data includes long exposure data and short exposure data. That is to say, the image sensor of the auxiliary camera can expose twice in each exposure time period, one long exposure and one short exposure, for example, a CMOS image sensor can be used to expose twice in the same time period. In this way, the long-exposure data and the short-exposure data in the same time period can be fused subsequently to output high dynamic video frames. Exemplarily, taking the second RAW data as 4K60 SHDR data as an example, the auxiliary camera exposes twice in every 33ms, so as to obtain video data of 60 frames per second.
在另一个实施例中,第二RAW数据也可以为4K30的视频数据,也即辅摄像头在每个曝光时间段内曝光一次,其输出的是30帧/秒的视频数据。该种情况下,后续无需融合处理。In another embodiment, the second RAW data may also be 4K30 video data, that is, the secondary camera exposes once in each exposure time period, and outputs video data at 30 frames per second. In this case, subsequent fusion processing is not required.
需要说明的是,图像感应器节点通过辅摄像头采集第二RAW数据的过程中,电子设备仍继续执行上述步骤701至步骤711。It should be noted that, during the process of the image sensor node collecting the second RAW data through the auxiliary camera, the electronic device still continues to execute the above step 701 to step 711 .
803:图像感应器节点向外置ISP节点发送第二RAW数据。803: The image sensor node sends the second RAW data to the external ISP node.
804:外置ISP节点对第二RAW数据进行复制。804: The external ISP node replicates the second RAW data.
作为本申请的一个示例,外置ISP节点通过路由子模块对第二RAW数据进行复制,得到第六RAW数据,第六RAW数据用于统计辅摄像头当前的曝光数据等信息。As an example of the present application, the external ISP node copies the second RAW data through the routing sub-module to obtain the sixth RAW data, and the sixth RAW data is used to count the current exposure data of the secondary camera and other information.
805:外置ISP节点对第二RAW数据进行降分辨率处理和降帧率处理,得到第四RAW数据。805: The external ISP node performs resolution reduction processing and frame rate reduction processing on the second RAW data to obtain fourth RAW data.
作为本申请的一个示例,外置ISP节点将第二RAW数据传输给第一预处理子模块,由第一预处理子模块对第二RAW数据进行降分辨率处理以及降帧率处理,从而得到小分辨率、低帧率的第四RAW数据。在一个示例中,第一预处理子模块可以按照第一预设比例对第二RAW数据进行降分辨率处理,然后按照第二预设比例对降分辨率处理后的第二RAW数据进行降帧率处理。其中,第一预设比例和第二预设比例可以根据实际需求进行设置。As an example of this application, the external ISP node transmits the second RAW data to the first preprocessing submodule, and the first preprocessing submodule performs resolution reduction and frame rate reduction processing on the second RAW data, thereby obtaining Fourth RAW data with small resolution and low frame rate. In an example, the first preprocessing submodule may perform resolution reduction processing on the second RAW data according to a first preset ratio, and then perform frame reduction processing on the second RAW data after resolution reduction processing according to a second preset ratio rate processing. Wherein, the first preset ratio and the second preset ratio can be set according to actual needs.
值得一提的是,通过对第二RAW数据进行降分辨率、降帧率处理,可以减小后续预降噪处理的功耗。It is worth mentioning that by performing resolution reduction and frame rate reduction processing on the second RAW data, the power consumption of the subsequent pre-noise reduction processing can be reduced.
806:外置ISP节点基于第四RAW数据进行预降噪处理。806: The external ISP node performs pre-noise reduction processing based on the fourth RAW data.
在实施例中,外置ISP节点中的第一预处理子模块将第四RAW数据发送给增强子模块。在一个示例中,当第二RAW数据包括长曝光数据和短曝光数据时,增强子模块对第四RAW数据进行融合处理,譬如通过第二目标模型进行融合,输出小分辨率、低帧率的融合数据。之后,增强子模块基于得到的小分辨率、低帧率的融合数据进行降噪处理,示例性地,增强子模块通过辅摄像头对应的第一目标模型对得到的小分辨率、低帧率的融合数据进行预降噪处理。In an embodiment, the first preprocessing submodule in the external ISP node sends the fourth RAW data to the enhancement submodule. In an example, when the second RAW data includes long-exposure data and short-exposure data, the enhancement sub-module performs fusion processing on the fourth RAW data, for example, through the fusion of the second target model, and outputs a small-resolution, low-frame-rate Fusion data. Afterwards, the enhancement sub-module performs noise reduction processing based on the obtained fusion data with small resolution and low frame rate. Fusion data for pre-noise reduction.
值得一提的是,在切换前基于辅摄像头采集的视频数据进行预降噪处理,可以使得第一目标模型的降噪效果与第三目标模型的降噪效果较接近,从而使得后续切换后经过第一目标模型降噪处理后的视频帧与切换前输出的视频帧的画面差异较小。It is worth mentioning that pre-noise reduction processing based on the video data collected by the auxiliary camera before switching can make the noise reduction effect of the first object model closer to that of the third object model, so that after subsequent switching The image difference between the video frame after the noise reduction processing of the first target model and the output video frame before switching is small.
其中,第一目标模型可以是预先训练好的降噪网络模型。譬如第一目标模型可以是基于RAW样本数据对第一网络模型进行训练后得到的。在一个示例中,第一网络模型可以包括但不限于Unet。Wherein, the first target model may be a pre-trained denoising network model. For example, the first target model may be obtained after training the first network model based on RAW sample data. In one example, the first network model may include but not limited to Unet.
在一个实施例中,第一预处理子模块在将第四RAW数据发送给增强子模块之前,还可以对第四RAW数据进行预处理,譬如预处理可以包括但不限于LSC处理、BLC处理、BPC处理、颜色插值处理中的至少一项。或者,在另一个实施例中,第一预处理子模块也可以在对第二RAW数据进行降分辨率、降帧率处理之前,对第二RAW数据进行预处理。本申请实施例对预处理的时机不作限定。In one embodiment, before the first preprocessing submodule sends the fourth RAW data to the enhancement submodule, it can also preprocess the fourth RAW data. For example, the preprocessing can include but not limited to LSC processing, BLC processing, At least one of BPC processing and color interpolation processing. Or, in another embodiment, the first preprocessing submodule may also perform preprocessing on the second RAW data before performing processing on the second RAW data to reduce resolution and frame rate. The embodiment of the present application does not limit the timing of preprocessing.
807:外置ISP节点将第六RAW数据输出至内置ISP节点。807: The external ISP node outputs the sixth RAW data to the internal ISP node.
在一个示例中,内置ISP节点通过第二预处理子模块接收第六RAW数据。In an example, the built-in ISP node receives the sixth RAW data through the second preprocessing submodule.
作为本申请的一个示例,路由子模块输出第六RAW数据的时机可以发生在复制操作之后,也即步骤807与步骤804之间没有严格的先后执行顺序。As an example of the present application, the timing for the routing submodule to output the sixth RAW data may occur after the copy operation, that is, there is no strict execution sequence between step 807 and step 804 .
808:内置ISP节点基于第六RAW数据,统计第二摄像信息。808: The built-in ISP node collects statistics on the second camera information based on the sixth RAW data.
在一个示例中,第二摄像信息包括第二曝光数据、第二AF、第二AWB和第二FOV。In one example, the second imaging information includes second exposure data, second AF, second AWB and second FOV.
内置ISP节点通过第二预处理子模块基于第六RAW数据,统计第二摄像信息。The built-in ISP node collects statistics of the second camera information based on the sixth RAW data through the second preprocessing submodule.
809:内置ISP节点基于第一摄像信息,调整第二摄像信息。809: The built-in ISP node adjusts the second camera information based on the first camera information.
在一个示例中,通过ISP节点通过第二预处理子模块将第二摄像信息中各个参数调整为与第一摄像信息中对应参数相同或接近,从而进行信息同步。譬如,将第一曝光数据与第二曝光数据进行信息同步,将第一AF和第二AF进行信息同步,将第一AWB与第二AWB进行信息同步,以及将第一FOV与第二FOV进行信息同步。In an example, the ISP node adjusts each parameter in the second camera information to be the same as or close to the corresponding parameter in the first camera information through the second preprocessing submodule, so as to perform information synchronization. For example, information synchronization between the first exposure data and the second exposure data, information synchronization between the first AF and the second AF, information synchronization between the first AWB and the second AWB, and information synchronization between the first FOV and the second FOV Information synchronization.
810:内置ISP节点基于调整后的第二摄像信息,对辅摄像头进行参数调整。810: The built-in ISP node adjusts parameters of the auxiliary camera based on the adjusted second camera information.
譬如,内置ISP节点通过第二预处理子模块将调整后的第二摄像信息发送给辅摄像头,并指示辅摄像头根据第二摄像信息进行参数调整。For example, the built-in ISP node sends the adjusted second camera information to the auxiliary camera through the second preprocessing submodule, and instructs the auxiliary camera to adjust parameters according to the second camera information.
811:当调焦操作满足摄像头切换条件时,外置ISP节点将经过参数同步后的辅摄像头输出的第三RAW数据作为前台数据处理。811: When the focusing operation satisfies the camera switching condition, the external ISP node processes the third RAW data output by the auxiliary camera whose parameters have been synchronized as foreground data.
在一个示例中,当相机应用程序检测到调焦操作满足摄像头切换条件,譬如调焦操作对应的调焦值达到目标调焦值时,通知外置ISP节点。外置ISP节点按照上述步骤701至步骤711的执行方式对辅摄像头输出的第三RAW数据进行处理,也即此时将辅摄像头输出的第三RAW数据作为前台数据处理。In an example, when the camera application detects that the focus operation meets the camera switching condition, for example, when the focus value corresponding to the focus operation reaches the target focus value, the external ISP node is notified. The external ISP node processes the third RAW data output by the auxiliary camera according to the execution manner of steps 701 to 711 above, that is, processes the third RAW data output by the auxiliary camera as foreground data at this time.
示例性地,当调焦操作对应的调焦值达到3倍焦时,外置ISP节点通过路由子模块将第三RAW数据发送给第一预处理子模块进行预处理,之后由第一预处理子模块将预处理后的第三RAW数据发送给增强子模块进行融合处理,将融合处理后得到的RAW数据输入至第一目标模型进行降噪处理。另外,路由子模块对第三RAW数据进行复制。For example, when the focusing value corresponding to the focusing operation reaches 3X, the external ISP node sends the third RAW data to the first pre-processing sub-module through the routing sub-module for pre-processing, and then the first pre-processing The sub-module sends the preprocessed third RAW data to the enhancement sub-module for fusion processing, and inputs the RAW data obtained after fusion processing to the first target model for noise reduction processing. In addition, the routing submodule copies the third RAW data.
812:外置ISP节点将处理后的视频数据发送给内置ISP节点。812: The external ISP node sends the processed video data to the built-in ISP node.
外置ISP节点将降噪处理后的视频数据输出给内置ISP,以及将对第三RAW复制得到的RAW数据输出给内置ISP节点。之后,内置ISP节点通过第二预处理子模块按照对第一RAW数据的处理方式,对接收的视频数据进行处理,通过优化处理子模块优化处理后,输出清晰度较高的视频帧。The external ISP node outputs the noise-reduced video data to the built-in ISP, and outputs the RAW data copied from the third RAW to the built-in ISP node. Afterwards, the built-in ISP node processes the received video data through the second preprocessing submodule according to the processing method for the first RAW data, and outputs video frames with higher definition after optimized processing by the optimization processing submodule.
在一种可能的实现方式中,在从主摄像头切换至辅摄像头之后,可以控制主摄像头下电。在另一种可能的实现方式中,在从主摄像头切换至辅摄像头之后,也可以控制主摄像头处于上电状态。在又一种可能的实现方式中,在从主摄像头切换至辅摄像头之后,也可以控制主摄像头在一段时长阈值内处于上电状态,若在时长阈值内未从辅摄像头切换回主摄像头,则控制主摄像头下电。其中,时长阈值可以根据实际需求进行设置。In a possible implementation manner, after switching from the main camera to the auxiliary camera, the main camera may be controlled to be powered off. In another possible implementation manner, after switching from the main camera to the auxiliary camera, the main camera may also be controlled to be in a power-on state. In yet another possible implementation, after switching from the main camera to the auxiliary camera, the main camera can also be controlled to be in the power-on state within a certain duration threshold, if the auxiliary camera is not switched back to the main camera within the duration threshold, then Control the power off of the main camera. Wherein, the duration threshold may be set according to actual requirements.
当从辅摄像头切换回主摄像头时,若主摄像头处于下电状态,则可以按照上述切换流程进行切换;若主摄像头处于上电状态,则可以直接进行切换,也即无需按照上述切换流程进行切换。When switching back to the main camera from the auxiliary camera, if the main camera is powered off, it can be switched according to the above switching process; if the main camera is powered on, it can be switched directly, that is, there is no need to switch according to the above switching process .
在一个实施例中,外置ISP中存储有辅摄像头对应的多个第一目标模型,多个第一目标模型中的每个第一目标模型对应有曝光数值范围。在该种情况下,内置ISP的第二预处理子模块对第二曝光数据同步处理后,将同步后的第二曝光数据反馈给外置ISP。如此,外置ISP确定经同步后的第二曝光数据所属的曝光数值范围,然后从多个第一目标模型中选择所确定的曝光数值范围对应的第一目标模型,选择的第一目标模型用于下一次的预降噪处理。In one embodiment, the external ISP stores a plurality of first object models corresponding to the auxiliary camera, and each first object model in the plurality of first object models corresponds to an exposure value range. In this case, after the second preprocessing sub-module of the built-in ISP synchronously processes the second exposure data, it feeds back the synchronized second exposure data to the external ISP. In this way, the external ISP determines the exposure value range to which the synchronized second exposure data belongs, and then selects the first target model corresponding to the determined exposure value range from a plurality of first target models, and the selected first target model is used for for the next pre-noise reduction process.
在本申请实施例中,在调焦过程中,提前启动待启动的摄像头,相比于直接切换, 可以避免由于摄像头之间存在空间位置差异导致的卡顿问题。另外在启动后,将辅摄像头与主摄像头进行参数同步,以使得在切换后,辅摄像头采集视频帧的画面效果与主摄像头采集视频帧的画面效果接近,避免了切换前后视频画面差异较大的问题,实现了摄像头之间的平滑切换。In the embodiment of the present application, during the focusing process, the camera to be started is started in advance, compared with direct switching, it can avoid the jamming problem caused by the spatial position difference between the cameras. In addition, after starting, synchronize the parameters of the auxiliary camera with the main camera, so that after switching, the picture effect of the video frame captured by the secondary camera is close to the picture effect of the video frame collected by the main camera, avoiding the large difference in the video picture before and after switching problem, achieved smooth switching between cameras.
为了便于理解,接下来结合附图9所示的硬件框架图,对本申请实施例提供的方法流程进行介绍。如图9所示,本申请实施例涉及的硬件主要包括多个摄像头(譬如包括主摄像头和辅摄像头)、SOC、外置ISP和内置ISP。For ease of understanding, the flow of the method provided by the embodiment of the present application will be introduced next with reference to the hardware framework diagram shown in FIG. 9 . As shown in FIG. 9 , the hardware involved in this embodiment of the present application mainly includes multiple cameras (for example, including a main camera and a secondary camera), a SOC, an external ISP, and a built-in ISP.
外置ISP内部包括多个接口、路由单元、第一外置ISP前端单元、第二外置ISP前端单元以及外置ISP后端单元,路由单元分别与第一外置ISP前端单元、第二外置ISP前端单元相连接,第一外置ISP前端单元与外置ISP后端单元相连接,第二外置ISP前端单元与外置ISP后端单元相连接。路由单元用于执行上述各个实施例中路由子模块的功能,第一外置ISP前端单元和第二外置ISP前端单元用于执行上述各个实施例中第一预处理子模块的功能,外置ISP后端单元用于执行上述各个实施例中增强子模块的功能。在一个示例中,第一外置ISP前端单元为外置ISP中的IFE0,第二外置ISP前端单元为外置ISP中的IFE1,外置ISP后端单元为外置ISP中的NPU。The external ISP includes multiple interfaces, a routing unit, a first external ISP front-end unit, a second external ISP front-end unit, and an external ISP back-end unit. The routing unit is connected to the first external ISP front-end unit and the second external The ISP front-end unit is connected, the first external ISP front-end unit is connected with the external ISP back-end unit, and the second external ISP front-end unit is connected with the external ISP back-end unit. The routing unit is used to perform the function of the routing submodule in each of the above-mentioned embodiments, the first external ISP front-end unit and the second external ISP front-end unit are used to perform the function of the first preprocessing sub-module in the above-mentioned various embodiments, and the external The ISP back-end unit is used to implement the functions of the enhanced sub-modules in each of the above embodiments. In one example, the first external ISP front-end unit is IFE0 in the external ISP, the second external ISP front-end unit is IFE1 in the external ISP, and the external ISP back-end unit is an NPU in the external ISP.
内置ISP内部包括第一内置ISP前端单元、第二内置ISP前端单元、第三内置ISP前端单元以及内置ISP后端单元。第一内置ISP前端单元与内置ISP后端单元相连接,第二内置ISP前端单元与内置ISP后端单元相连接。第一内置ISP前端单元、第二内置ISP前端单元以及第三内置ISP前端单元用于执行上述各个实施例中的第二预处理子模块的功能,内置ISP后端单元用于执行上述各个实施例中优化处理子模块的功能。在一个示例中,第一内置ISP前端单元为内置ISP中的IFE0,第二内置ISP前端单元为内置ISP中的IFE1,第三内置ISP前端单元为内置ISP中的IFE2,内置ISP后端单元为内置ISP中的IPE。The built-in ISP includes a first built-in ISP front-end unit, a second built-in ISP front-end unit, a third built-in ISP front-end unit and a built-in ISP back-end unit. The first built-in ISP front-end unit is connected to the built-in ISP back-end unit, and the second built-in ISP front-end unit is connected to the built-in ISP back-end unit. The first built-in ISP front-end unit, the second built-in ISP front-end unit and the third built-in ISP front-end unit are used to execute the function of the second preprocessing submodule in each of the above-mentioned embodiments, and the built-in ISP back-end unit is used to execute the above-mentioned each embodiment Optimize the function of processing submodules in . In one example, the first built-in ISP front-end unit is IFE0 in the built-in ISP, the second built-in ISP front-end unit is IFE1 in the built-in ISP, the third built-in ISP front-end unit is IFE2 in the built-in ISP, and the built-in ISP back-end unit is Built-in IPE in ISP.
需要说明的是,上述仅是示例性的示出了外置ISP和内置ISP内部包括的多个单元,但并不对其结构的组成部分构成限定。在一些实施例中,外置ISP或内置ISP的内部还可能包括其他单元,本申请实施例对此不作限定。It should be noted that, the foregoing is only an exemplary illustration of the multiple units included in the external ISP and the internal ISP, but does not constitute a limitation to the structural components thereof. In some embodiments, the external ISP or the internal ISP may further include other units, which is not limited in this embodiment of the present application.
接下来结合附图9所示的硬件框架图,对本申请实施例提供的摄像头的切换方法流程进行介绍,具体地:Next, in conjunction with the hardware frame diagram shown in Figure 9, the flow of the camera switching method provided by the embodiment of the present application is introduced, specifically:
901:外置ISP接收第一RAW数据。901: The external ISP receives the first RAW data.
作为本申请的一个示例,第一RAW数据是来自电子设备的主摄像头,具体地,主摄像头的图像感应器输出第一RAW数据至外置ISP。As an example of the present application, the first RAW data is from a main camera of the electronic device, specifically, an image sensor of the main camera outputs the first RAW data to an external ISP.
作为示例而非限定,如图9所示,外置ISP通过移动行业处理器接口(mobile industry processor interface,Mipi)0接收来自主摄像头的第一RAW数据。As an example but not a limitation, as shown in FIG. 9, the external ISP receives the first RAW data from the main camera through a mobile industry processor interface (mobile industry processor interface, Mipi)0.
902:外置ISP通过路由单元对第一RAW数据进行复制、路由处理。902: The external ISP copies and routes the first RAW data through the routing unit.
作为本申请的一个示例,外置ISP首先通过路由单元对第一RAW数据进行复制,得到第五RAW数据。之后,路由单元对这两份RAW数据进行路由处理,示例性地,将第一RAW数据传输给第一外置ISP前端单元,由第一外置ISP前端单元基于第一RAW数据进行预处理,并将预处理后得到的第一RAW数据发送给外置ISP后端单元, 由外置ISP后端单元进行融合和降噪处理;第五RAW数据直接输出给内置ISP。As an example of the present application, the external ISP first copies the first RAW data through the routing unit to obtain the fifth RAW data. Afterwards, the routing unit performs routing processing on the two sets of RAW data. For example, the first RAW data is transmitted to the first external ISP front-end unit, and the first external ISP front-end unit performs preprocessing based on the first RAW data. And send the first RAW data obtained after preprocessing to the external ISP back-end unit, and the external ISP back-end unit performs fusion and noise reduction processing; the fifth RAW data is directly output to the built-in ISP.
第一外置ISP前端单元对第一RAW数据的预处理可以参见上述图7所示实施例,外置ISP后端单元对预处理后的第一RAW数据的融合和降噪处理也可以参见上述图7所示实施例。For the preprocessing of the first RAW data by the first external ISP front-end unit, refer to the embodiment shown in FIG. 7 above. For the fusion and noise reduction processing of the preprocessed first RAW data by the external ISP back-end unit, please refer to the above Figure 7 shows the embodiment.
903:外置ISP后端单元输出降噪处理后的视频数据,以及通过路由单元输出第五RAW数据。903: The external ISP back-end unit outputs the video data after noise reduction processing, and outputs the fifth RAW data through the routing unit.
示例性地,外置ISP后端单元通过外置ISP的Mipi0接口,将降噪处理后的视频数据发送给内置ISP,路由单元通过外置ISP的Mipi1接口将第五RAW数据发送给内置ISP。请参考图9,在摄像头切换之前,外置ISP通过第一分支1处理主摄像头的第一RAW数据。Exemplarily, the external ISP back-end unit sends the noise-reduced video data to the built-in ISP through the Mipi0 interface of the external ISP, and the routing unit sends the fifth RAW data to the built-in ISP through the Mipi1 interface of the external ISP. Please refer to FIG. 9 , before the camera is switched, the external ISP processes the first RAW data of the main camera through the first branch 1 .
904:内置ISP接收外置ISP后端单元输出的视频数据,以及路由单元输出的第五RAW数据。904: The built-in ISP receives the video data output by the external ISP back-end unit, and the fifth RAW data output by the routing unit.
在一个示例中,内置ISP通过第一内置ISP前端单元接收外置ISP后端单元输出的视频数据,然后由第一内置ISP前端单元对该视频数据进行处理,譬如进行再次预处理,然后进行RGB转换,并将转换后的RGB图像进行压缩,得到YUV图像。之后将YUV图像传输给内置ISP后端单元进行处理。In one example, the built-in ISP receives the video data output by the external ISP back-end unit through the first built-in ISP front-end unit, and then the first built-in ISP front-end unit processes the video data, such as preprocessing again, and then performing RGB Convert and compress the converted RGB image to obtain a YUV image. Then transmit the YUV image to the built-in ISP back-end unit for processing.
在一个示例中,内置ISP通过第二内置ISP前端单元接收路由单元输出的第五RAW数据。之后,第二内置ISP前端单元基于第五RAW数据确定第一曝光数据,并根据第一曝光数据确定当前的曝光程度是否合理,若不合理,确定目标曝光数据,并根据目标曝光数据去调整摄像头的曝光参数。在一个示例中,第二内置ISP前端单元通过I2C接口调整摄像头的曝光数据。In an example, the built-in ISP receives the fifth RAW data output by the routing unit through the second built-in ISP front-end unit. After that, the second built-in ISP front-end unit determines the first exposure data based on the fifth RAW data, and determines whether the current exposure level is reasonable according to the first exposure data, and if not, determines the target exposure data, and adjusts the camera according to the target exposure data exposure parameters. In one example, the second built-in ISP front-end unit adjusts the exposure data of the camera through the I2C interface.
除此之外,第二内置ISP前端单元还基于第五RAW数据统计AWB、颜色等数据。第二内置ISP前端单元将3A、颜色等数据传输给内置ISP后端单元,以便于内置ISP后端单元根据第二内置ISP前端单元传输的数据对YUV图像进行优化,譬如对YUV图像进行降噪处理,从而得到画面清晰、明朗的视频帧。In addition, the second built-in ISP front-end unit also counts AWB, color and other data based on the fifth RAW data. The second built-in ISP front-end unit transmits data such as 3A, color, etc. to the built-in ISP back-end unit, so that the built-in ISP back-end unit can optimize the YUV image according to the data transmitted by the second built-in ISP front-end unit, such as denoising the YUV image processing, so as to obtain a clear and clear video frame.
此外,第二内置ISP前端单元还可以通过外设接口,将目标曝光数据发送给外置ISP,譬如发送至外置ISP后端单元中,以便于外置ISP后端单元根据目标曝光数据,从多个用于降噪处理的第三目标模型中选择一个第三目标模型,从而根据选择的第三目标模型,对下一次的视频数据进行降噪处理。示例性地,外设接口可以为安全数据输入和输出(secure digital input and output,SDIO)接口。In addition, the second built-in ISP front-end unit can also send the target exposure data to the external ISP through the peripheral interface, for example, to the external ISP back-end unit, so that the external ISP back-end unit can use the target exposure data from A third target model is selected from a plurality of third target models used for noise reduction processing, so that next video data is subjected to noise reduction processing according to the selected third target model. Exemplarily, the peripheral interface may be a secure digital input and output (secure digital input and output, SDIO) interface.
进一步地,第二内置ISP前端单元基于第五RAW数据确定第一AF、第一AWB、第一FOV,以得到第一摄像信息。其具体实现可以参见图7所示实施例。Further, the second built-in ISP front-end unit determines the first AF, the first AWB, and the first FOV based on the fifth RAW data, so as to obtain the first imaging information. For its specific implementation, reference may be made to the embodiment shown in FIG. 7 .
905:内置ISP输出视频帧。905: Built-in ISP output video frame.
具体地,内置ISP通过内置ISP后端单元输出经过优化处理后的视频帧,将视频帧显示在显示屏上。Specifically, the built-in ISP outputs optimized video frames through the built-in ISP back-end unit, and displays the video frames on the display screen.
需要说明的是,在未执行切换操作之前,电子设备按照上述流程输出主摄像头的视频帧。当用户进行调焦时,执行如下切换操作:It should be noted that, before the switching operation is performed, the electronic device outputs the video frames of the main camera according to the above process. When the user adjusts the focus, perform the following switching operations:
906:在视频帧输出的过程中,当相机应用程序检测到调焦操作时,在未满足摄像头切换条件之前,SOC启动辅摄像头。906: In the process of video frame output, when the camera application program detects a focusing operation, before the camera switching condition is not met, the SOC starts the secondary camera.
在一个示例中,当检测到用户的调焦操作时,在未满足摄像头切换条件之前,若调焦操作对应的调焦值与摄像头切换条件对应的目标调焦值之间的差值小于预设数值,则启动辅摄像头。之后,电子设备通过辅摄像头采集视频数据,得到第二RAW数据。In an example, when the user's focus operation is detected, before the camera switch condition is met, if the difference between the focus value corresponding to the focus operation and the target focus value corresponding to the camera switch condition is less than the preset value, the auxiliary camera is activated. Afterwards, the electronic device collects video data through the auxiliary camera to obtain second RAW data.
需要说明的是,电子设备启动辅摄像头后,辅摄像头开始采集视频数据,得到第二RAW数据。在未切换之前,仍是对主摄像头的视频数据作输出,也即辅摄像头采集的第二RAW数据未输出,对第二RAW数据的处理过程请参见如下步骤。It should be noted that after the electronic device starts the auxiliary camera, the auxiliary camera starts to collect video data to obtain the second RAW data. Before switching, the video data of the main camera is still output, that is, the second RAW data collected by the auxiliary camera is not output. For the processing process of the second RAW data, please refer to the following steps.
907:外置ISP接收第二RAW数据。907: The external ISP receives the second RAW data.
在一个示例中,外置ISP通过Mipi1接口接收第二RAW数据。In an example, the external ISP receives the second RAW data through the Mipi1 interface.
908:外置ISP通过路由单元对第二RAW数据进行复制、路由处理。908: The external ISP copies and routes the second RAW data through the routing unit.
在一个示例中,路由单元对第二RAW数据进行复制,得到第六RAW数据。路由单元将第二RAW数据发送给第二外置ISP前端单元,以及将第六RAW数据通过Mipi2接口发送给内置ISP。In an example, the routing unit copies the second RAW data to obtain sixth RAW data. The routing unit sends the second RAW data to the second external ISP front-end unit, and sends the sixth RAW data to the built-in ISP through the Mipi2 interface.
909:外置ISP通过第二外置ISP前端单元对第二RAW数据进行降分辨率、降帧率处理,得到第四RAW数据。909: The external ISP performs resolution reduction and frame rate reduction processing on the second RAW data through the second external ISP front-end unit to obtain fourth RAW data.
在一个实施例中,第二外置ISP前端单元对第二RAW数据进行降分辨率、降帧率处理之前,还可以对第二RAW数据进行预处理,本申请实施例对此不作限定。In an embodiment, before the second external ISP front-end unit reduces the resolution and frame rate of the second RAW data, it may also perform preprocessing on the second RAW data, which is not limited in this embodiment of the present application.
910:第二外置ISP前端单元将第四RAW数据发送给外置ISP后端单元。910: The second external ISP front-end unit sends the fourth RAW data to the external ISP back-end unit.
911:外置ISP后端单元基于第四RAW数据进行预降噪处理。911: The external ISP back-end unit performs pre-noise reduction processing based on the fourth RAW data.
请参考图9,对于外置ISP来说,在启动辅摄像头之后,以及在摄像头切换之前,通过第二分支2处理辅摄像头的第二RAW数据。Please refer to FIG. 9 , for an external ISP, after the auxiliary camera is started and before the camera is switched, the second RAW data of the auxiliary camera is processed through the second branch 2 .
912:内置ISP通过第三内置ISP前端单元接收第六RAW数据。912: The built-in ISP receives sixth RAW data through the third built-in ISP front-end unit.
913:第三内置ISP前端单元基于第六RAW数据确定第二摄像信息。913: The third built-in ISP front-end unit determines second camera information based on the sixth RAW data.
914:第三内置ISP前端单元对第一摄像信息和第二摄像信息进行信息同步。914: The third built-in ISP front-end unit performs information synchronization on the first camera information and the second camera information.
在一个示例中,第三内置ISP前端单元从内置ISP的第二内置ISP前端单元中获取第一摄像信息,之后,根据第一摄像信息对第二摄像信息进行调整,以将第二摄像信息与第一摄像信息进行信息同步。In one example, the third built-in ISP front-end unit obtains the first camera information from the second built-in ISP front-end unit of the built-in ISP, and then adjusts the second camera information according to the first camera information, so as to combine the second camera information with the Information synchronization is performed on the first camera information.
915:内置ISP根据同步后的第二摄像信息控制辅摄像头进行参数调整。915: The built-in ISP controls the secondary camera to adjust parameters according to the synchronized second camera information.
在一个示例中,由第三内置ISP前端单元根据同步后的第二摄像信息,通过I2C接口控制摄像头进行参数调整。In one example, the third built-in ISP front-end unit controls the camera through the I2C interface to adjust parameters according to the synchronized second camera information.
在一个实施例中,当外置ISP内部包括辅摄像头对应的多个第一目标模型时,内置ISP对第二曝光数据同步处理后,将同步后的第二曝光数据反馈给外置ISP,譬如,可以反馈至外置ISP后端单元中。如此,外置ISP后端单元确定经同步后的第二曝光数据所属的曝光数值范围,然后从多个第一目标模型中选择所确定的曝光数值范围对应的第一目标模型,选择的第一目标模型用于下一次对辅摄像头采集的视频数据的预降噪处理。In one embodiment, when the external ISP includes a plurality of first object models corresponding to the auxiliary camera, the built-in ISP synchronously processes the second exposure data, and feeds back the synchronized second exposure data to the external ISP, for example , can be fed back to the external ISP back-end unit. In this way, the external ISP back-end unit determines the exposure value range to which the synchronized second exposure data belongs, and then selects the first target model corresponding to the determined exposure value range from a plurality of first target models, and the selected first The target model is used for the next pre-noise reduction processing on the video data collected by the auxiliary camera.
916:在满足摄像头切换条件的情况下,外置ISP将第三RAW数据作为待输出数据。916: When the camera switching condition is satisfied, the external ISP uses the third RAW data as data to be output.
第三RAW数据是经过参数同步后的辅摄像头输出的RAW数据。The third RAW data is RAW data output by the secondary camera after parameter synchronization.
在实施中,外置ISP通过路由单元对第三RAW数据进行复制。之后,路由单元 将第三RAW数据发送给第一外置ISP前端单元,由第一外置ISP前端单元进行预处理,之后发送给外置ISP后端单元,由外置ISP后端单元进行融合和降噪处理,将降噪处理后的视频数据通过Mipi0接口输出给内置ISP进行后续的优化处理。另外,外置ISP通过路由单元将对第三RAW数据复制得到的RAW数据发送给内置ISP,由内置ISP中的第三内置ISP前端单元确定曝光数据。In an implementation, the external ISP copies the third RAW data through the routing unit. Afterwards, the routing unit sends the third RAW data to the first external ISP front-end unit, which is preprocessed by the first external ISP front-end unit, and then sent to the external ISP back-end unit, which is fused by the external ISP back-end unit And noise reduction processing, the video data after noise reduction processing is output to the built-in ISP through the Mipi0 interface for subsequent optimization processing. In addition, the external ISP sends the RAW data copied from the third RAW data to the built-in ISP through the routing unit, and the front-end unit of the third built-in ISP in the built-in ISP determines the exposure data.
请参考图9,在满足摄像头切换条件的情况下,外置ISP通过第一分支1处理辅摄像头的第三RAW数据。Please refer to FIG. 9 , when the camera switching condition is satisfied, the external ISP processes the third RAW data of the secondary camera through the first branch 1 .
作为示例而非限定,本申请根据另一实施例提供了一种摄像头切换的方法,该方法可以应用于上述电子设备中,电子设备至少包括第一摄像头和第二摄像头。在一个实施例中,电子设备包括第一图像信号处理模块以及第二图像信号处理模块,譬如第二图像信号处理模块为SOC中集成的ISP(简称:内置ISP),第一图像信号处理模块包括SOC外部的ISP(简称:外置ISP)。该方法可以包括如下几个实现步骤:As an example but not a limitation, the present application provides a camera switching method according to another embodiment, and the method may be applied to the above-mentioned electronic device, where the electronic device includes at least a first camera and a second camera. In one embodiment, the electronic device includes a first image signal processing module and a second image signal processing module, for example, the second image signal processing module is an ISP integrated in the SOC (abbreviation: built-in ISP), and the first image signal processing module includes The ISP outside the SOC (referred to as: external ISP). The method may include the following implementation steps:
步骤1001、根据第一摄像头的第一RAW数据进行视频帧输出,第一RAW数据是原始视频数据。Step 1001: Output video frames according to the first RAW data of the first camera, where the first RAW data is original video data.
在一个示例中,第一摄像头可以为主摄像头。在另一个示例中,第一摄像头也可以为辅摄像头。In one example, the first camera may be the main camera. In another example, the first camera may also be an auxiliary camera.
作为本申请的一个示例,步骤1001的具体实现可以包括:第一摄像头的图像感应器输出第一RAW数据,第一图像信号处理模块获取第一RAW数据。第一图像信号处理模块复制第一RAW数据,得到第五RAW数据。第一图像信号处理模块对第一RAW数据进行图像增强处理,得到视频增强数据。第一图像信号处理模块将视频增强数据以及第五RAW数据发送给第二图像信号处理模块。第二图像信号处理模块基于视频增强数据和第五RAW数据进行视频帧输出。As an example of the present application, specific implementation of step 1001 may include: the image sensor of the first camera outputs first RAW data, and the first image signal processing module acquires the first RAW data. The first image signal processing module copies the first RAW data to obtain fifth RAW data. The first image signal processing module performs image enhancement processing on the first RAW data to obtain video enhancement data. The first image signal processing module sends the video enhancement data and the fifth RAW data to the second image signal processing module. The second image signal processing module outputs video frames based on the video enhancement data and the fifth RAW data.
作为本申请的一个示例,第一摄像头的图像感应器输出第一RAW数据的具体实现可以包括:通过电子设备中的相机应用检测到夜景视频拍摄指令,夜景视频拍摄指令用于指示在夜景模式下进行视频录制。响应于夜景视频拍摄指令,图像感应器输出第一RAW数据。As an example of the present application, the specific implementation of outputting the first RAW data by the image sensor of the first camera may include: detecting a night scene video shooting instruction through the camera application in the electronic device, and the night scene video shooting instruction is used to indicate that in the night scene mode Make a video recording. In response to the night scene video shooting instruction, the image sensor outputs first RAW data.
作为本申请的一个示例,第一RAW数据包括同一时间段内采集的长曝光数据和短曝光数据,第一图像信号处理模块对第一RAW数据进行图像增强处理,包括:第一图像信号处理模块将长曝光数据和短曝光数据进行融合处理,得到融合RAW数据。第一图像信号处理模块对融合RAW数据进行降噪处理,得到视频增强数据。As an example of the present application, the first RAW data includes long exposure data and short exposure data collected in the same time period, and the first image signal processing module performs image enhancement processing on the first RAW data, including: the first image signal processing module The long-exposure data and short-exposure data are fused to obtain fused RAW data. The first image signal processing module performs noise reduction processing on the fused RAW data to obtain video enhancement data.
作为本申请的一个示例,第一图像信号处理模块将长曝光数据和短曝光数据进行融合处理,包括:第一图像信号处理模块将长曝光数据和短曝光数据输入至第二目标模型中,由第二目标模型进行融合处理,第二目标模型能够对任意的长曝光数据和短曝光数据进行融合处理。As an example of the present application, the first image signal processing module fuses the long exposure data and the short exposure data, including: the first image signal processing module inputs the long exposure data and the short exposure data into the second target model, and the The second target model performs fusion processing, and the second target model can perform fusion processing on arbitrary long exposure data and short exposure data.
作为本申请的一个示例,第一图像信号处理模块对融合RAW数据进行降噪处理,包括:第一图像信号处理模块将融合RAW数据输入至第一摄像头对应的第三目标模型中,由第三目标模型进行降噪处理,第三目标模型能够对任意的RAW数据进行降噪处理。As an example of the present application, the first image signal processing module performs noise reduction processing on the fused RAW data, including: the first image signal processing module inputs the fused RAW data into the third target model corresponding to the first camera, and the third The target model performs noise reduction processing, and the third target model can perform noise reduction processing on arbitrary RAW data.
作为本申请的一个示例,第一图像信号处理模块中包括第一摄像头对应的多个第三目标模型,多个第三目标模型中的每个第三目标模型对应有曝光数值范围。在该种情况下,第一图像信号处理模块接收目标曝光数据,目标曝光数据是由第二图像信号处理模块基于第一曝光数据确定,第一曝光数据是由第二图像信号处理模块基于第五RAW数据进行曝光数据统计得到,目标曝光数据用于调整第一摄像头的曝光参数。第一图像信号处理模块根据目标曝光数据、以及每个第三目标模型对应的曝光数值范围,从多个第三目标模型中选择一个第三目标模型,选择的第三目标模型用于降噪处理。As an example of the present application, the first image signal processing module includes multiple third target models corresponding to the first camera, and each third target model in the multiple third target models corresponds to an exposure value range. In this case, the first image signal processing module receives target exposure data, the target exposure data is determined by the second image signal processing module based on the first exposure data, and the first exposure data is determined by the second image signal processing module based on the fifth The RAW data is obtained through exposure data statistics, and the target exposure data is used to adjust the exposure parameters of the first camera. The first image signal processing module selects a third target model from a plurality of third target models according to the target exposure data and the exposure value range corresponding to each third target model, and the selected third target model is used for noise reduction processing .
作为本申请的一个示例,第二图像信号处理模块对视频增强数据进行格式转换处理,得到YUV图像的具体实现可以包括:第二图像信号处理模块基于第五RAW数据,确定目标数据,目标数据用于调整YUV图像的图像质量。第二图像信号处理模块基于目标数据调整YUV图像,并将调整后的YUV图像作为视频帧输出。As an example of the present application, the second image signal processing module performs format conversion processing on the video enhancement data to obtain a YUV image. The specific implementation may include: the second image signal processing module determines the target data based on the fifth RAW data, and the target data uses Used to adjust the image quality of YUV images. The second image signal processing module adjusts the YUV image based on the target data, and outputs the adjusted YUV image as a video frame.
步骤1002、在视频帧输出的过程中,若检测到调焦操作,则在未满足摄像头切换条件之前,启动第二摄像头。Step 1002: During the process of video frame output, if a focus operation is detected, start the second camera before the camera switching condition is not met.
作为本申请的一个示例,若检测到调焦操作,则在未达到摄像头切换条件之前,当调焦操作对应的调焦值与摄像头切换条件对应的目标调焦值之间的差值小于或等于预设数值时,启动第二摄像头。As an example of this application, if a focusing operation is detected, before the camera switching condition is reached, when the difference between the focusing value corresponding to the focusing operation and the target focusing value corresponding to the camera switching condition is less than or equal to When the value is preset, activate the second camera.
步骤1003、根据第一RAW数据、第二摄像头的第二RAW数据,将第二摄像头与第一摄像头进行参数同步。Step 1003, according to the first RAW data and the second RAW data of the second camera, synchronize the parameters of the second camera with the first camera.
在一个示例中,第二摄像头可以为辅摄像头。在另一个示例,第二摄像头也可以为主摄像头。第二摄像头与第一摄像头为不同摄像头。In one example, the second camera can be a secondary camera. In another example, the second camera can also be the main camera. The second camera is different from the first camera.
作为本申请的一个示例,步骤1003的具体实现可以包括:根据第一RAW数据,确定第一摄像信息。根据第二RAW数据,确定第二摄像信息。根据第一摄像信息,调整第二摄像信息,以将第二摄像信息与第一摄像信息同步。根据调整后的第二摄像信息,对第二摄像头进行参数调整,以将第二摄像头与第一摄像头进行参数同步。As an example of the present application, specific implementation of step 1003 may include: determining first imaging information according to the first RAW data. Based on the second RAW data, second imaging information is determined. According to the first imaging information, the second imaging information is adjusted to synchronize the second imaging information with the first imaging information. According to the adjusted second camera information, the parameters of the second camera are adjusted, so as to synchronize the parameters of the second camera with the first camera.
可选地,第一摄像信息包括第一曝光数据、第一自动对焦AF、第一自动白平衡AWB、第一视场角FOV,第二摄像信息包括第二曝光数据、第二AF、第二AWB、第二FOV。Optionally, the first imaging information includes the first exposure data, the first autofocus AF, the first automatic white balance AWB, and the first field of view FOV, and the second imaging information includes the second exposure data, the second AF, the second AWB, second FOV.
作为本申请的一个示例,电子设备还可以基于第二RAW数据,对第二摄像头对应的第一目标模型进行预降噪处理,第一目标模型能够基于任意的RAW数据进行降噪处理,预降噪处理后的第一目标模型用于在调焦操作满足摄像头切换条件后对第三RAW数据进行降噪处理。As an example of the present application, the electronic device may also perform pre-noise reduction processing on the first target model corresponding to the second camera based on the second RAW data. The first target model can perform noise reduction processing based on arbitrary RAW data. The noise-processed first target model is used to perform noise reduction processing on the third RAW data after the focusing operation meets the camera switching condition.
作为本申请的一个示例,基于第二RAW数据,通过第二摄像头对应的第一目标模型进行预降噪处理的具体实现可以包括:按照第一预设比例对第二RAW数据进行降分辨率处理,以及按照第二预设比例对降分辨率处理后的第二RAW数据进行降帧率处理,得到第四RAW数据,将第四RAW数据输入至第一目标模型中,以对第一目标模型进行预降噪处理。As an example of the present application, based on the second RAW data, the specific implementation of performing pre-noise reduction processing through the first target model corresponding to the second camera may include: performing resolution reduction processing on the second RAW data according to a first preset ratio , and perform frame rate reduction processing on the second RAW data after the resolution reduction processing according to the second preset ratio to obtain the fourth RAW data, and input the fourth RAW data into the first target model, so that the first target model Perform pre-noise reduction processing.
其中第一预设比例和第二预设比例均可以根据实际需求进行设置。Both the first preset ratio and the second preset ratio can be set according to actual needs.
在另一实施例中,也可以先按照第二预设比例对第二RAW数据进行降帧率处理,然后按照第一预设比例对降帧率处理后的第二RAW数据进行降分辨率处理。In another embodiment, the second RAW data may be subjected to frame rate reduction processing according to the second preset ratio, and then the resolution processing may be performed on the second RAW data after the frame rate reduction processing according to the first preset ratio. .
步骤1004、当调焦操作满足摄像头切换条件时,根据第三RAW数据进行视频帧输出,第三RAW数据是经参数同步后的第二摄像头的原始视频数据。Step 1004 , when the focusing operation satisfies the camera switching condition, output the video frame according to the third RAW data, the third RAW data is the raw video data of the second camera whose parameters have been synchronized.
在本申请实施例中,根据第一摄像头的第一RAW数据进行视频帧输出,在视频帧输出的过程中,若检测到调焦操作,则在未满足摄像头切换条件之前,启动第二摄像头,根据第一RAW数据、第二摄像头的第二RAW数据,将第二摄像头与第一摄像头进行参数同步。当调焦操作满足摄像头切换条件时,根据第三RAW数据进行视频帧输出,第三RAW数据是经参数同步后的第二摄像头的原始视频数据。如此,通过提前启动第二摄像头,并在启动后将第二摄像头与第一摄像头进行参数同步,可以使得切换后第二摄像头的视频画面与第一摄像头的视频画面差异较小,也即,解决了切换前后视频画面差异较大的问题,从而实现了摄像头之间的平滑切换。In the embodiment of the present application, the video frame output is performed according to the first RAW data of the first camera. During the video frame output process, if a focusing operation is detected, the second camera is started before the camera switching condition is met. According to the first RAW data and the second RAW data of the second camera, the parameters of the second camera are synchronized with the first camera. When the focusing operation satisfies the camera switching condition, video frame output is performed according to the third RAW data, and the third RAW data is the raw video data of the second camera whose parameters have been synchronized. In this way, by starting the second camera in advance, and synchronizing the parameters of the second camera and the first camera after starting, the difference between the video picture of the second camera and the video picture of the first camera after switching can be small, that is, to solve It solves the problem of large difference in video images before and after switching, thus realizing smooth switching between cameras.
应理解,上述实施例中各步骤的序号并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the sequence numbers of the steps in the above embodiments do not mean the order of execution, and the execution order of each process should be determined by its functions and internal logic, and should not constitute any limitation to the implementation process of the embodiment of the present application.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used for illustration. In practical applications, the above-mentioned functions can be assigned to different functional units, Completion of modules means that the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment may be integrated into one processing unit, or each unit may exist separately physically, or two or more units may be integrated into one unit, and the above-mentioned integrated units may adopt hardware It can also be implemented in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the present application. For the specific working process of the units and modules in the above system, reference may be made to the corresponding process in the foregoing method embodiments, and details will not be repeated here.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the descriptions of each embodiment have their own emphases, and for parts that are not detailed or recorded in a certain embodiment, refer to the relevant descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
在本申请所提供的实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的系统实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed devices and methods may be implemented in other ways. For example, the system embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be Incorporation may either be integrated into another system, or some features may be omitted, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到电子设备的任何实体或装置、记录介质、计算机存储器、ROM、RAM、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the procedures in the methods of the above embodiments in the present application can be completed by instructing related hardware through computer programs, and the computer programs can be stored in a computer-readable storage medium. The computer program When executed by a processor, the steps in the above-mentioned various method embodiments can be realized. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form. The computer readable medium may include at least: any entity or means capable of carrying computer program codes to electronic equipment, recording media, computer memory, ROM, RAM, electrical carrier signals, telecommunication signals, and software distribution media. Such as U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunication signals under legislation and patent practice.
最后应说明的是:以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。Finally, it should be noted that: the above is only a specific implementation of the application, but the scope of protection of the application is not limited thereto, and any changes or replacements within the technical scope disclosed in the application shall be covered by this application. within the scope of the application. Therefore, the protection scope of the present application should be determined by the protection scope of the claims.

Claims (17)

  1. 一种摄像头的切换方法,其特征在于,应用于电子设备,所述电子设备包括第一摄像头和第二摄像头,所述方法包括:A camera switching method, characterized in that it is applied to an electronic device, the electronic device includes a first camera and a second camera, and the method includes:
    根据所述第一摄像头的第一原始数据进行视频帧输出;performing video frame output according to the first raw data of the first camera;
    在视频帧输出的过程中,若检测到调焦操作,则在未满足摄像头切换条件之前,启动所述第二摄像头;In the process of video frame output, if a focusing operation is detected, before the camera switching condition is not met, start the second camera;
    根据所述第一原始数据、所述第二摄像头的第二原始数据,将所述第二摄像头与所述第一摄像头进行参数同步;Synchronize parameters of the second camera with the first camera according to the first raw data and the second raw data of the second camera;
    当所述调焦操作满足所述摄像头切换条件时,根据第三原始数据进行视频帧输出,所述第三原始数据是经参数同步后的所述第二摄像头的原始视频数据。When the focusing operation satisfies the camera switching condition, the video frame output is performed according to the third original data, and the third original data is the original video data of the second camera whose parameters are synchronized.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述第一原始数据、所述第二摄像头的第二原始数据,将所述第二摄像头与所述第一摄像头进行参数同步,包括:The method according to claim 1, wherein, according to the first raw data and the second raw data of the second camera, the parameter synchronization of the second camera and the first camera is performed, include:
    根据所述第一原始数据,确定第一摄像信息;determining first imaging information according to the first raw data;
    根据所述第二原始数据,确定第二摄像信息;determining second imaging information according to the second raw data;
    根据所述第一摄像信息,调整所述第二摄像信息,以将所述第二摄像信息与所述第一摄像信息同步;adjusting the second imaging information according to the first imaging information to synchronize the second imaging information with the first imaging information;
    根据调整后的所述第二摄像信息,对所述第二摄像头进行参数调整,以将所述第二摄像头与所述第一摄像头进行参数同步。According to the adjusted second camera information, the parameters of the second camera are adjusted, so as to synchronize the parameters of the second camera with the first camera.
  3. 根据权利要求2所述的方法,其特征在于,所述第一摄像信息包括第一曝光数据、第一自动对焦AF、第一自动白平衡AWB、第一视场角FOV,所述第二摄像信息包括第二曝光数据、第二AF、第二AWB、第二FOV。The method according to claim 2, wherein the first imaging information includes the first exposure data, the first autofocus AF, the first automatic white balance AWB, and the first field of view FOV, and the second imaging information includes: The information includes second exposure data, second AF, second AWB, and second FOV.
  4. 根据权利要求1-3中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-3, further comprising:
    基于所述第二原始数据,对所述第二摄像头对应的第一目标模型进行预降噪处理,所述第一目标模型能够对任意的原始数据进行降噪处理,预降噪处理后的所述第一目标模型用于在所述调焦操作满足所述摄像头切换条件后对所述第三原始数据进行降噪处理。Based on the second raw data, pre-noise reduction processing is performed on the first target model corresponding to the second camera, the first target model can perform noise reduction processing on any raw data, and all pre-noise reduction processing The first target model is used to perform noise reduction processing on the third raw data after the focusing operation satisfies the camera switching condition.
  5. 根据权利要求4所述的方法,其特征在于,所述基于所述第二原始数据,通过所述第二摄像头对应的第一目标模型进行预降噪处理,包括:The method according to claim 4, wherein, based on the second raw data, performing pre-noise reduction processing through the first target model corresponding to the second camera includes:
    按照第一预设比例对所述第二原始数据进行降分辨率处理,以及按照第二预设比例对降分辨率处理后的所述第二原始数据进行降帧率处理,得到第四原始数据;Performing resolution reduction processing on the second original data according to a first preset ratio, and performing frame rate reduction processing on the second original data after resolution reduction processing according to a second preset ratio, to obtain fourth original data ;
    将所述第四原始数据输入至所述第一目标模型中,以对所述第一目标模型进行预降噪处理。The fourth original data is input into the first object model to perform pre-noise reduction processing on the first object model.
  6. 根据权利要求1所述的方法,其特征在于,所述在视频帧输出的过程中,若检测到调焦操作,则在未满足摄像头切换条件之前,启动所述第二摄像头,包括:The method according to claim 1, wherein, in the process of outputting the video frame, if a focusing operation is detected, before the camera switching condition is not met, starting the second camera includes:
    在视频帧输出的过程中,若检测到调焦操作,则在未达到所述摄像头切换条件之前,当所述调焦操作对应的调焦值与所述摄像头切换条件对应的目标调焦值之间的差值小于或等于预设数值时,启动所述第二摄像头。In the process of video frame output, if a focusing operation is detected, before the camera switch condition is reached, when the focus value corresponding to the focus operation is between the target focus value corresponding to the camera switch condition When the difference between them is less than or equal to the preset value, start the second camera.
  7. 根据权利要求1-6中任一项所述的方法,其特征在于,所述电子设备包括第一图像信号处理模块以及第二图像信号处理模块;The method according to any one of claims 1-6, wherein the electronic device includes a first image signal processing module and a second image signal processing module;
    所述根据所述第一摄像头的第一原始数据进行视频帧输出,包括:The video frame output according to the first raw data of the first camera includes:
    所述第一摄像头的图像感应器输出所述第一原始数据;The image sensor of the first camera outputs the first raw data;
    所述第一图像信号处理模块获取所述第一原始数据;The first image signal processing module acquires the first raw data;
    所述第一图像信号处理模块复制所述第一原始数据,得到第五原始数据;The first image signal processing module copies the first original data to obtain fifth original data;
    所述第一图像信号处理模块对所述第一原始数据进行图像增强处理,得到视频增强数据;The first image signal processing module performs image enhancement processing on the first raw data to obtain video enhancement data;
    所述第一图像信号处理模块将所述视频增强数据以及所述第五原始数据发送给所述第二图像信号处理模块;The first image signal processing module sends the video enhancement data and the fifth original data to the second image signal processing module;
    所述第二图像信号处理模块基于所述视频增强数据和所述第五原始数据进行视频帧输出。The second image signal processing module outputs video frames based on the video enhancement data and the fifth original data.
  8. 根据权利要求7所述的方法,其特征在于,所述第一原始数据包括同一时间段内采集的长曝光数据和短曝光数据,所述第一图像信号处理模块对所述第一原始数据进行图像增强处理,得到视频增强数据,包括:The method according to claim 7, wherein the first raw data includes long exposure data and short exposure data collected in the same time period, and the first image signal processing module performs processing on the first raw data Image enhancement processing to obtain video enhancement data, including:
    所述第一图像信号处理模块将所述长曝光数据和所述短曝光数据进行融合处理,得到融合原始数据;The first image signal processing module fuses the long exposure data and the short exposure data to obtain fused original data;
    所述第一图像信号处理模块对所述融合原始数据进行降噪处理,得到所述视频增强数据。The first image signal processing module performs noise reduction processing on the fused original data to obtain the enhanced video data.
  9. 根据权利要求8所述的方法,其特征在于,所述第一图像信号处理模块将所述长曝光数据和所述短曝光数据进行融合处理,包括:The method according to claim 8, wherein the first image signal processing module fuses the long exposure data and the short exposure data, including:
    所述第一图像信号处理模块将所述长曝光数据和所述短曝光数据输入至第二目标模型中,由所述第二目标模型进行融合处理,所述第二目标模型能够对任意的长曝光数据和短曝光数据进行融合处理。The first image signal processing module inputs the long-exposure data and the short-exposure data into a second object model, and performs fusion processing by the second object model, and the second object model can Exposure data and short exposure data are fused.
  10. 根据权利要求8或9所述的方法,其特征在于,所述第一图像信号处理模块对所述融合原始数据进行降噪处理,包括:The method according to claim 8 or 9, wherein the first image signal processing module performs noise reduction processing on the fused original data, including:
    所述第一图像信号处理模块将所述融合原始数据输入至所述第一摄像头对应的第三目标模型中,由所述第三目标模型进行降噪处理,所述第三目标模型能够对任意的原始数据进行降噪处理。The first image signal processing module inputs the fused raw data into a third object model corresponding to the first camera, and performs noise reduction processing by the third object model, and the third object model can perform any The original data is subjected to noise reduction processing.
  11. 根据权利要求10所述的方法,其特征在于,所述第一图像信号处理模块中包括所述第一摄像头对应的多个第三目标模型,所述多个第三目标模型中的每个第三目标模型对应有曝光数值范围;所述方法还包括:The method according to claim 10, wherein the first image signal processing module includes a plurality of third object models corresponding to the first camera, and each of the third object models in the plurality of third object models The three-target model corresponds to an exposure value range; the method also includes:
    所述第一图像信号处理模块接收目标曝光数据,所述目标曝光数据是由所述第二图像信号处理模块基于第一曝光数据确定,所述第一曝光数据是由所述第二图像信号处理模块基于所述第五原始数据进行曝光数据统计得到,所述目标曝光数据用于调整所述第一摄像头的曝光参数;The first image signal processing module receives target exposure data, the target exposure data is determined by the second image signal processing module based on the first exposure data, and the first exposure data is determined by the second image signal processing module The module obtains exposure data statistics based on the fifth raw data, and the target exposure data is used to adjust the exposure parameters of the first camera;
    所述第一图像信号处理模块根据所述目标曝光数据、以及所述每个第三目标模型对应的曝光数值范围,从所述多个第三目标模型中选择一个第三目标模型,选择的第三目标模型用于降噪处理。The first image signal processing module selects a third target model from the plurality of third target models according to the target exposure data and the exposure value range corresponding to each third target model, and the selected third target model A three-objective model is used for noise reduction processing.
  12. 根据权利要求7-11中任一项所述的方法,其特征在于,所述第二图像信号处理模块基于所述视频增强数据和所述第五原始数据进行视频帧输出,包括:The method according to any one of claims 7-11, wherein the second image signal processing module performs video frame output based on the video enhancement data and the fifth original data, comprising:
    所述第二图像信号处理模块对所述视频增强数据进行格式转换处理,得到YUV图像;The second image signal processing module performs format conversion processing on the video enhancement data to obtain a YUV image;
    所述第二图像信号处理模块基于所述第五原始数据,确定目标数据,所述目标数据用于调整所述YUV图像的图像质量;The second image signal processing module determines target data based on the fifth raw data, and the target data is used to adjust the image quality of the YUV image;
    所述第二图像信号处理模块基于所述目标数据调整所述YUV图像,并将调整后的所述YUV图像作为所述视频帧输出。The second image signal processing module adjusts the YUV image based on the target data, and outputs the adjusted YUV image as the video frame.
  13. 根据权利要求7-12中任一项所述的方法,其特征在于,所述第二图像信号处理模块包括芯片级系统SOC中集成的ISP,第一图像信号处理模块包括所述SOC外部的ISP。The method according to any one of claims 7-12, wherein the second image signal processing module includes an ISP integrated in a chip-level system SOC, and the first image signal processing module includes an ISP outside the SOC .
  14. 根据权利要求7-13中任一项所述的方法,其特征在于,所述第一摄像头的图像感应器输出所述第一原始数据,包括:The method according to any one of claims 7-13, wherein the image sensor of the first camera outputs the first raw data, comprising:
    通过所述电子设备中的相机应用检测到夜景视频拍摄指令,所述夜景视频拍摄指令用于指示在夜景模式下进行视频录制;A night scene video shooting instruction is detected through the camera application in the electronic device, and the night scene video shooting instruction is used to indicate video recording in night scene mode;
    响应于所述夜景视频拍摄指令,所述图像感应器输出所述第一原始数据。In response to the night scene video shooting instruction, the image sensor outputs the first raw data.
  15. 一种摄像头的切换装置,其特征在于,配置于电子设备中,所述电子设备包括第一摄像头和第二摄像头;所述装置包括图像感应器节点、第一图像信号处理模块以及第二图像信号处理模块;A camera switching device, characterized in that it is configured in an electronic device, the electronic device includes a first camera and a second camera; the device includes an image sensor node, a first image signal processing module, and a second image signal processing module processing module;
    所述第一图像信号处理模块和所述第二图像信号处理模块,用于根据所述第一摄像头的第一原始数据进行视频帧输出;The first image signal processing module and the second image signal processing module are configured to output video frames according to the first raw data of the first camera;
    所述图像感应器节点,用于在视频帧输出的过程中,若检测到调焦操作,则在未满足摄像头切换条件之前,启动所述第二摄像头;The image sensor node is used to start the second camera before the camera switching condition is met if a focusing operation is detected during the video frame output process;
    所述第一图像信号处理模块和所述第二图像信号处理模块,用于根据所述第一原始数据、所述第二摄像头的第二原始数据,将所述第二摄像头与所述第一摄像头进行参数同步;The first image signal processing module and the second image signal processing module are configured to, according to the first raw data and the second raw data of the second camera, combine the second camera with the first The camera performs parameter synchronization;
    所述第一图像信号处理模块和所述第二图像信号处理模块,用于当所述调焦操作满足所述摄像头切换条件时,根据第三原始数据进行视频帧输出,所述第三原始数据是经参数同步后的所述第二摄像头的原始视频数据。The first image signal processing module and the second image signal processing module are configured to output video frames according to third raw data when the focusing operation satisfies the camera switching condition, and the third raw data is the raw video data of the second camera after parameter synchronization.
  16. 一种电子设备,其特征在于,所述电子设备包括存储器和处理器;An electronic device, characterized in that the electronic device includes a memory and a processor;
    所述存储器用于存储支持所述电子设备执行权利要求1-14任一项所述的方法的程序,以及存储用于实现权利要求1-14任一项所述的方法所涉及的数据;所述处理器被配置为用于执行所述存储器中存储的程序。The memory is used to store a program that supports the electronic device to execute the method described in any one of claims 1-14, and to store data involved in implementing the method described in any one of claims 1-14; The processor is configured to execute programs stored in the memory.
  17. 一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,其特征在于,当其在计算机上运行时,使得计算机执行权利要求1-14任一项所述的方法。A computer-readable storage medium, with instructions stored in the computer-readable storage medium, is characterized in that, when the computer-readable storage medium is run on a computer, it causes the computer to execute the method described in any one of claims 1-14.
PCT/CN2022/116759 2021-11-05 2022-09-02 Camera switching method and apparatus, and electronic device and storage medium WO2023077939A1 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN202111310300.6 2021-11-05
CN202111310300 2021-11-05
CN202210248963.8 2022-03-10
CN202210248963.8A CN116095476B (en) 2021-11-05 2022-03-10 Camera switching method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2023077939A1 true WO2023077939A1 (en) 2023-05-11

Family

ID=86187464

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/116759 WO2023077939A1 (en) 2021-11-05 2022-09-02 Camera switching method and apparatus, and electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN116095476B (en)
WO (1) WO2023077939A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117278850A (en) * 2023-10-30 2023-12-22 荣耀终端有限公司 Shooting method and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105959553A (en) * 2016-05-30 2016-09-21 维沃移动通信有限公司 Camera switching method and terminal
US20170054919A1 (en) * 2013-10-26 2017-02-23 The Lightco Inc. Methods and apparatus for use with multiple optical chains
CN107277480A (en) * 2017-07-10 2017-10-20 广东欧珀移动通信有限公司 White balance synchronous method, device and terminal device
CN107343190A (en) * 2017-07-25 2017-11-10 广东欧珀移动通信有限公司 White balance adjusting method, apparatus and terminal device
CN110809101A (en) * 2019-11-04 2020-02-18 RealMe重庆移动通信有限公司 Image zooming processing method and device, electronic equipment and storage medium
CN111432143A (en) * 2020-04-10 2020-07-17 展讯通信(上海)有限公司 Control method, system, medium and electronic device for switching camera modules
CN111641777A (en) * 2020-02-28 2020-09-08 北京爱芯科技有限公司 Image processing method, image processing apparatus, image processor, electronic device, and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170054919A1 (en) * 2013-10-26 2017-02-23 The Lightco Inc. Methods and apparatus for use with multiple optical chains
CN105959553A (en) * 2016-05-30 2016-09-21 维沃移动通信有限公司 Camera switching method and terminal
CN107277480A (en) * 2017-07-10 2017-10-20 广东欧珀移动通信有限公司 White balance synchronous method, device and terminal device
CN107343190A (en) * 2017-07-25 2017-11-10 广东欧珀移动通信有限公司 White balance adjusting method, apparatus and terminal device
CN110809101A (en) * 2019-11-04 2020-02-18 RealMe重庆移动通信有限公司 Image zooming processing method and device, electronic equipment and storage medium
CN111641777A (en) * 2020-02-28 2020-09-08 北京爱芯科技有限公司 Image processing method, image processing apparatus, image processor, electronic device, and storage medium
CN111432143A (en) * 2020-04-10 2020-07-17 展讯通信(上海)有限公司 Control method, system, medium and electronic device for switching camera modules

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117278850A (en) * 2023-10-30 2023-12-22 荣耀终端有限公司 Shooting method and electronic equipment

Also Published As

Publication number Publication date
CN116095476B (en) 2024-04-12
CN116095476A (en) 2023-05-09

Similar Documents

Publication Publication Date Title
WO2022262260A1 (en) Photographing method and electronic device
US11765463B2 (en) Multi-channel video recording method and device
WO2021052232A1 (en) Time-lapse photography method and device
WO2020192461A1 (en) Recording method for time-lapse photography, and electronic device
CN110198417A (en) Image processing method, device, storage medium and electronic equipment
WO2023015981A1 (en) Image processing method and related device therefor
WO2021057277A1 (en) Photographing method in dark light and electronic device
CN113810601B (en) Terminal image processing method and device and terminal equipment
CN113810600B (en) Terminal image processing method and device and terminal equipment
CN110381276B (en) Video shooting method and electronic equipment
WO2020155052A1 (en) Method for selecting images based on continuous shooting and electronic device
WO2023160285A1 (en) Video processing method and apparatus
WO2023160295A1 (en) Video processing method and apparatus
WO2023077939A1 (en) Camera switching method and apparatus, and electronic device and storage medium
CN113726949B (en) Video processing method, electronic device and storage medium
WO2024032033A1 (en) Video processing method and electronic device
CN115426449B (en) Photographing method and terminal
WO2023077938A1 (en) Video frame generation method and apparatus, electronic device, and storage medium
WO2023160221A1 (en) Image processing method and electronic device
WO2023160220A1 (en) Image processing method and electronic device
CN116723417B (en) Image processing method and electronic equipment
CN116048323B (en) Image processing method and electronic equipment
CN116051368B (en) Image processing method and related device
CN115705663B (en) Image processing method and electronic equipment
EP4287607A1 (en) Image processing method and electronic device