Image processing method and electronic equipment

By using the system to cache interactive image data and dynamically update the demosaicing model in multi-camera electronic devices, the problem of poor flexibility in processing image data from different cameras is solved and efficient demosaicing processing is achieved.

CN118870201APending Publication Date: 2024-10-29HONOR DEVICE CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202310490261.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-28
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

In the existing technology, the differences in color filters of different cameras of multi-camera electronic devices lead to a single demosaic processing method, which is difficult to adapt to the image data collected by different cameras and has poor flexibility.

Method used

By exchanging image data in the system cache between the image signal processor ISP and the neural network processor NPU, different demosaicing models are used to dynamically update the model in the NPU based on the scene recognition results, improving the flexibility of demosaicing processing.

Benefits of technology

It realizes efficient demosaicing processing that adapts to different camera image data in different scenarios, improving the flexibility and adaptability of processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118870201A_ABST
    Figure CN118870201A_ABST
Patent Text Reader

Abstract

The invention provides an image processing method and electronic equipment. The method comprises the steps that an ISP receives a first image frame, reads first image bar data and writes the first image bar data into a first cache region of a system cache; the NPU reads the first image strip data from the first cache region, the first model is utilized to carry out demosaicing processing on the first image strip data to obtain first data and write the first data into a second cache region of the system cache, and the ISP reads the second image strip data, writes the second image strip data into the first cache region and reads the first data from the second cache region; the NPU reads second image bar data from the first cache region, demosaicing processing is carried out by using the first model to obtain second data and write the second data into the second cache region, and the ISP reads the second data from the second cache region and obtains a first target image according to the first data and the second data. Thus, the models of different demosaicing algorithms can be configured in the NPU according to processing requirements in different scenes, and the flexibility of demosaicing processing is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal devices, and in particular to an image processing method and electronic device. Background Art

[0002] The camera function is an important function commonly possessed by electronic devices. Currently, many electronic devices, such as mobile phones, have multiple cameras. In this article, such electronic devices with multiple cameras are referred to as multi-camera electronic devices.

[0003] The image data collected by the camera needs to go through a series of processing before it can be output as the final picture or video. In the process of processing image data, de-mosaicing is an important processing process. There are differences between the color filters (CFA, Color Filter Array) of different cameras of multi-camera electronic devices. The de-mosaicing processing method in the related art is single, difficult to adapt to the image data collected by different cameras, and has poor flexibility. Summary of the invention

[0004] In order to solve the above technical problems, the present application provides an image processing method and an electronic device, which can adapt to the de-mosaic processing needs in different scenarios and improve the flexibility of de-mosaic processing.

[0005] In a first aspect, the present application provides an image processing method, which is applied to an electronic device. The method may include: an ISP receives a first image frame; the ISP reads the first image strip data from the first image frame and writes it into a first buffer area of ​​a system cache according to the first image strip configuration information; the NPU reads the first image strip data from the first buffer area, and performs a demosaicing process on the first image strip data using a first model to obtain first data; the NPU writes the first data into a second buffer area of ​​the system cache, the ISP reads the second image strip data from the first image frame and writes it into the first buffer area according to the first image strip configuration information, and reads the first data from the second buffer area; the NPU reads the second image strip data from the first buffer area, and performs a demosaicing process on the second image strip data using the first model to obtain second data; the NPU writes the second data into the second buffer area, and the ISP reads the second data from the second buffer area; the ISP obtains a first target image corresponding to the first image frame according to the first data and the second data. In this way, different demosaicing algorithm models can be configured in the NPU according to the demosaicing processing needs in different scenarios, thereby improving the flexibility of demosaicing processing.

[0006] According to the first aspect, it also includes: a de-mosaic control module receives first image parameter information corresponding to a first image frame; the de-mosaic control module performs scene recognition based on the first image parameter information to obtain a first scene recognition result, the first scene recognition result indicates that a first scene factor corresponding to the first image frame does not match the first model, and the first scene factor does not include a camera; the de-mosaic control module determines a second model that matches the first scene factor of the first image frame based on the first scene recognition result, and the second model is different from the first model; the de-mosaic control module updates the first model in the NPU to the second model.

[0007] According to the first aspect, it also includes: the ISP receives the second image frame; the ISP reads the third image strip data from the second image frame and writes it into the first buffer area according to the first image strip configuration information; the NPU reads the third image strip data from the first buffer area, and uses the second model to perform de-mosaic processing on the third image strip data to obtain the third data; the NPU writes the third data into the second buffer area, and the ISP reads the fourth image strip data from the second image frame and writes it into the first buffer area according to the first image strip configuration information, and reads the third data from the second buffer area; the NPU reads the fourth image strip data from the first buffer area, and uses the second model to perform de-mosaic processing on the fourth image strip data to obtain the fourth data; the NPU writes the fourth data into the second buffer area, and the ISP reads the fourth data from the second buffer area; the ISP obtains the second target image corresponding to the second image frame according to the third data and the fourth data.

[0008] According to the first aspect, it also includes: a de-mosaic control module receives second image parameter information corresponding to the second image frame; the de-mosaic control module performs scene recognition according to the second image parameter information to obtain a second scene recognition result, and the second scene recognition result indicates that all preset scene factors corresponding to the second image frame match the second model.

[0009] According to the first aspect, it also includes: the ISP receives the third image frame; the ISP reads the fifth image strip data from the third image frame and writes it into the first buffer area according to the first image strip configuration information; the NPU reads the fifth image strip data from the first buffer area, and uses the first model to perform de-mosaic processing on the fifth image strip data to obtain the fifth data; the NPU writes the fifth data into the second buffer area, and the ISP reads the sixth image strip data from the third image frame and writes it into the first buffer area according to the first image strip configuration information, and reads the fifth data from the second buffer area; the NPU reads the sixth image strip data from the first buffer area, and uses the first model to perform de-mosaic processing on the sixth image strip data to obtain the sixth data; the NPU writes the sixth data into the second buffer area, and the ISP reads the sixth data from the second buffer area; the ISP obtains the third target image corresponding to the third image frame according to the fifth data and the sixth data.

[0010] According to the first aspect, it also includes: a de-mosaic control module receives camera switching information; the de-mosaic control module performs scene recognition according to the camera switching information to obtain a third scene recognition result, and the third scene recognition result indicates switching from the first camera corresponding to the first image frame to the second camera; the de-mosaic control module determines a third model and target configuration information matching the second camera according to the third scene recognition result, and the third model is different from the first model; the de-mosaic control module updates the first model in the NPU to the third model, and updates the first image strip configuration information to the second image strip configuration information in the target configuration information; the de-mosaic control module creates a third cache area and a fourth cache area in the system cache according to the target configuration information, and notifies the ISP and the NPU of the address of the third cache area and the address of the fourth cache area.

[0011] According to the first aspect, the method further includes: the ISP receives a fourth image frame; the ISP reads the seventh image strip data from the fourth image frame and writes the seventh image strip data into the third buffer area according to the second image strip configuration information; the NPU reads the seventh image strip data from the third buffer area, and performs a demosaicing process on the seventh image strip data using the third model to obtain the seventh data; the NPU writes the seventh data into the fourth buffer area, the ISP reads the eighth image strip data from the fourth image frame and writes the eighth image strip data into the third buffer area according to the second image strip configuration information, and reads the seventh data from the fourth buffer area; the NPU reads the eighth image strip data from the third buffer area, and performs a demosaicing process on the eighth image strip data using the third model The image strip data is demosaiced to obtain eighth data; the NPU writes the eighth data into the fourth buffer area, and the ISP reads the ninth image strip data from the fourth image frame and writes it into the third buffer area according to the second image strip configuration information, and reads the eighth data from the fourth buffer area; the NPU reads the ninth image strip data from the third buffer area, and demosaices the ninth image strip data using the third model to obtain ninth data; the NPU writes the ninth data into the fourth buffer area, and the ISP reads the ninth data from the fourth buffer area; the ISP obtains a fourth target image corresponding to the fourth image frame according to the seventh data, the eighth data and the ninth data.

[0012] According to the first aspect, before the image signal processor ISP receives the first image frame, it also includes: the demosaic control module applies to create a first cache area and a second cache area in the system cache according to the initial configuration file, and notifies the ISP and the NPU of the first address corresponding to the first cache area and the second address corresponding to the second cache area; the demosaic control module writes the first image strip configuration information in the image strip configuration area of ​​the system cache according to the initial configuration file; the demosaic control module creates multiple demosaic algorithm models, and deploys the first model of the multiple demosaic algorithm models in the NPU.

[0013] According to the first aspect, the de-mosaic control module creates a first cache area and a second cache area in the system cache according to an initial configuration file, and before notifying the ISP and the NPU of a first address corresponding to the first cache area and a second address corresponding to the second cache area, it also includes: when the camera function is started, the de-mosaic control module starts a dedicated processing thread, and the dedicated processing thread is used to perform de-mosaic processing on image frames that have been collected but not de-mosaiced when the camera function was last started.

[0014] According to the first aspect, the size of the first buffer area is the same as the size of the second buffer area.

[0015] According to the first aspect, the size of the third cache area is the same as the size of the fourth cache area, and the size of the third cache area is different from the size of the first cache area.

[0016] In a second aspect, the present application provides an electronic device, including: an image signal processor ISP, used to receive a first image frame, read first image strip data from the first image frame and write it into a first buffer area of ​​a system cache according to first image strip configuration information; a neural network processor NPU, used to read the first image strip data from the first buffer area, and use a first model to perform de-mosaic processing on the first image strip data to obtain first data; the NPU is also used to write the first data into a second buffer area of ​​the system cache, and the ISP is also used to read the second image strip data from the first image frame and write it into the first buffer area according to the first image strip configuration information, and read the first data from the second buffer area; the NPU is also used to read the second image strip data from the first buffer area, and use the first model to perform de-mosaic processing on the second image strip data to obtain second data; the NPU is also used to write the second data into the second buffer area, and the ISP is also used to read the second data from the second buffer area; the ISP is also used to obtain a first target image corresponding to the first image frame based on the first data and the second data.

[0017] According to the second aspect, it also includes: a de-mosaic control module, used to receive first image parameter information corresponding to a first image frame; and used to perform scene recognition based on the first image parameter information to obtain a first scene recognition result, the first scene recognition result indicating that the first scene factor corresponding to the first image frame does not match the first model, and the first scene factor does not include a camera; and used to determine a second model that matches the first scene factor of the first image frame based on the first scene recognition result, the second model is different from the first model; and used to update the first model in the NPU to the second model.

[0018] According to the second aspect, the ISP is also used to receive the second image frame; and, based on the first image strip configuration information, read the third image strip data from the second image frame and write it into the first buffer area; the NPU is also used to read the third image strip data from the first buffer area, and use the second model to perform de-mosaic processing on the third image strip data to obtain the third data; the NPU is also used to write the third data into the second buffer area, and the ISP is also used to read the fourth image strip data from the second image frame and write it into the first buffer area based on the first image strip configuration information, and read the third data from the second buffer area; the NPU is also used to read the fourth image strip data from the first buffer area, and use the second model to perform de-mosaic processing on the fourth image strip data to obtain the fourth data; the NPU is also used to write the fourth data into the second buffer area, and the ISP is also used to read the fourth data from the second buffer area; the ISP is also used to obtain the second target image corresponding to the second image frame based on the third data and the fourth data.

[0019] According to the second aspect, the de-mosaic control module is also used to receive second image parameter information corresponding to the second image frame; and to perform scene recognition based on the second image parameter information to obtain a second scene recognition result, wherein the second scene recognition result indicates that all preset scene factors corresponding to the second image frame match the second model.

[0020] According to the second aspect, the ISP is also used to receive a third image frame; and, based on the first image strip configuration information, read the fifth image strip data from the third image frame and write it into the first buffer area; the NPU is also used to read the fifth image strip data from the first buffer area, and use the first model to perform de-mosaic processing on the fifth image strip data to obtain fifth data; the NPU is also used to write the fifth data into the second buffer area, and the ISP is also used to read the sixth image strip data from the third image frame and write it into the first buffer area based on the first image strip configuration information, and read the fifth data from the second buffer area; the NPU is also used to read the sixth image strip data from the first buffer area, and use the first model to perform de-mosaic processing on the sixth image strip data to obtain sixth data; the NPU is also used to write the sixth data into the second buffer area, and the ISP is also used to read the sixth data from the second buffer area; the ISP is also used to obtain a third target image corresponding to the third image frame based on the fifth data and the sixth data.

[0021] According to the second aspect, the de-mosaic control module is also used to receive camera switching information; and to perform scene recognition according to the camera switching to obtain a third scene recognition result, the third scene recognition result indicating switching from the first camera corresponding to the first image frame to the second camera; and to determine a third model and target configuration information matching the second camera according to the third scene recognition result, the third model being different from the first model; and to update the first model in the NPU to the third model, and to update the first image strip configuration information to the second image strip configuration information in the target configuration information; and to create a third cache area and a fourth cache area in the system cache according to the target configuration information, and to notify the ISP and the NPU of the address of the third cache area and the address of the fourth cache area.

[0022] According to the second aspect, the ISP is further used to receive a fourth image frame; and, according to the second image strip configuration information, read the seventh image strip data from the fourth image frame and write it into the third buffer area; the NPU is further used to read the seventh image strip data from the third buffer area, and use the third model to demosaic the seventh image strip data to obtain the seventh data; the NPU is further used to write the seventh data into the fourth buffer area, and the ISP is further used to read the eighth image strip data from the fourth image frame and write it into the third buffer area according to the second image strip configuration information, and read the seventh data from the fourth buffer area; the NPU is further used to read the eighth image strip data from the third buffer area, and use the third model to demosaic the eighth image strip data The NPU is further used to de-mosaic the strip of data to obtain eighth data; the NPU is further used to write the eighth data into the fourth buffer area, and the ISP is further used to read the ninth image strip of data from the fourth image frame and write it into the third buffer area according to the second image strip configuration information, and read the eighth data from the fourth buffer area; the NPU is further used to read the ninth image strip of data from the third buffer area, and de-mosaic the ninth image strip of data using the third model to obtain ninth data; the NPU is further used to write the ninth data into the fourth buffer area, and the ISP is further used to read the ninth data from the fourth buffer area; the ISP is further used to obtain a fourth target image corresponding to the fourth image frame according to the seventh data, the eighth data and the ninth data.

[0023] According to the second aspect, the de-mosaic control module is also used to create a first cache area and a second cache area in the system cache according to the initial configuration file, and to notify the ISP and the NPU of a first address corresponding to the first cache area and a second address corresponding to the second cache area; and to write the first image strip configuration information in the image strip configuration area of ​​the system cache according to the initial configuration file; and to create multiple de-mosaic algorithm models, and deploy a first model of the multiple de-mosaic algorithm models in the NPU.

[0024] According to the second aspect, the de-mosaic control module is also used to start a dedicated processing thread when the camera function is started, and the dedicated processing thread is used to perform de-mosaic processing on image frames that have been collected but not de-mosaiced when the camera function was last started.

[0025] According to the second aspect, the size of the first buffer area is the same as the size of the second buffer area.

[0026] According to the second aspect, the size of the third cache area is the same as the size of the fourth cache area, and the size of the third cache area is different from the size of the first cache area. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 The figure is a schematic diagram showing the principle of outputting an image of a Bayer array RGB color filter;

[0028] Figure 2 is an exemplary diagram of a demosaicing process of an RGB Bayer array image;

[0029] Figure 3 is a schematic structural diagram of an illustrative electronic device 100;

[0030] Figure 4 1 is a software structure block diagram of an electronic device 100 according to an embodiment of the present application;

[0031] Figure 5 The figure is a schematic diagram of a de-mosaicing process in a related art shown as an example;

[0032] Figure 6 is a flowchart of an image processing method according to an embodiment of the present invention;

[0033] Figure 7 Schematic diagram of the demosaicing process in this embodiment;

[0034] Figure 8 FIG. 1 is another example flow chart of the image processing method in this embodiment;

[0035] Fig. 9 FIG. 4 is a block diagram of the structure of an electronic device of the present embodiment. DETAILED DESCRIPTION

[0036] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0037] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0038] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.

[0039] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0040] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.

[0041] Here, we first explain the image output principles of mainstream image sensors.

[0042] The imaging of current mainstream image sensors is completed by two basic components, one is the photosensitive PD (Photodiode) part, and the other is the color filter (CFA, Color Filter Array), and color information is obtained through these two basic components.

[0043] Figure 1 The figure is a schematic diagram showing the principle of outputting an image of a Bayer array RGB color filter. Figure 1 The color blocks in the bottom layer of the left-side figure are photosensitive PD parts, where photons are converted into electrical signals; the upper layer in the left-side figure is a color filter, and the three color blocks of R / G / B (red / green / blue) in the color filter represent filters of their respective colors. After white light (including red light, green light, blue light and other components) passes through the RGB color filter, the image components corresponding to red / green / blue light are filtered out respectively and absorbed by the photosensitive PD part. Figure 1 The figure on the right side shows the filtering effect of the red filter on the red light component in the white light and the red component image formed, the filtering effect of the green filter on the green light component in the white light and the green component image formed, and the filtering effect of the blue filter on the blue light component in the white light and the blue component image formed.

[0044] The color filters of different sensors may be different. Therefore, in multi-camera terminal products, the CFAs equipped with different focal lengths may be different, such as RGGB color filters, RYYB color filters, etc.

[0045] The following uses the RGB Bayer Pattern as an example to illustrate the demosaicing process of an image.

[0046] Figure 2 This is an example diagram showing the demosaicing process of an RGB Bayer array image. Figure 2 The processing process of the demosaic interpolation algorithm is as follows: in the RGB Bayer array image, each pixel can only collect information of one color channel, and the other two color information is missing. It is necessary to use the interpolation algorithm to use the adjacent pixel information of other colors to calculate the missing two color information, so that each pixel has all the color information. This "demosaicing" process is called the demosaic interpolation algorithm, and it is also one of the most important modules in the entire ISP channel.

[0047] The hardware demosaic method has low flexibility and poor adaptability due to the chip area cost considerations. The traditional software demosaic method is also full of limitations in flexibility and adaptability.

[0048] This embodiment uses a neural network (CNN) to perform de-mosaic processing, which can be flexibly adjusted and adapted to the greatest extent according to the characteristics of different environmental scenes.

[0049] This embodiment provides an image processing method and an electronic device. The image processing method of this embodiment can be applied to electronic devices such as mobile phones and tablets, but is certainly not limited thereto.

[0050] The structure of the electronic device in this embodiment can be as follows Figure 3 shown.

[0051] Figure 3 FIG. 1 is a schematic diagram of the structure of an electronic device 100 exemplarily shown. It should be understood that Figure 3 The illustrated electronic device 100 is merely one example of an electronic device, and the electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have a different configuration of components. Figure 3 The various components shown in the drawings may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.

[0052] See also Figure 3 The electronic device 100 may include: a processor 110, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, an indicator 192, a camera 193, etc.

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

[0054] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0055] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD) or an organic light-emitting diode (OLED).

[0056] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0057] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0058] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0059] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0060] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0061] Figure 4 1 is a block diagram of the software structure of the electronic device 100 according to an embodiment of the present application.

[0062] The layered architecture of the electronic device 100 divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system may include an application layer, an application framework layer, a hardware abstraction layer, and a kernel layer.

[0063] The application layer can include a series of application packages.

[0064] like Figure 4 As shown, the application package may include camera, calendar, map, WLAN, music, short message, gallery, call, navigation, Bluetooth, video and other applications. Of course, these applications are only exemplary. In other embodiments, the application layer may include Figure 4 The applications not shown in the figure may not include Figure 4 One or more applications shown in .

[0065] like Figure 4 As shown, the application framework layer (Android FWK) may include camera services, display / codec modules, etc.

[0066] The camera service is used to provide services related to the camera application. In this article, the camera service can also be called a camera service module.

[0067] The display / codec module is used to display the image sent to the camera service after being processed by the ISP, or to generate a video based on the image sent to the camera service after being processed by the ISP.

[0068] The Android system can include the Android Runtime. The Android Runtime includes the core library and the virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.

[0069] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.

[0070] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0071] like Figure 4 As shown, the hardware abstraction layer (ie, Android HAL) may include a de-mosaic processing module. The function of the mosaic processing module is described in the following description of this article.

[0072] The kernel layer is the layer between hardware and software. Figure 4 As shown, the kernel layer may include modules such as audio driver, display driver, Bluetooth driver, Wi-Fi driver, sensor driver, etc.

[0073] Understandably, Figure 4The layers in the software structure shown and the components included in each layer do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer layers than shown, and each layer may include more or fewer components, which is not limited in the present application.

[0074] Before describing the image processing method of this embodiment, the de-mosaicing process in the related art is first introduced.

[0075] Figure 5 Schematic diagram of the de-mosaicing process in the related art. Figure 5 In the related art, during the de-mosaicing process, the ISP and the NPU (Neural Processing Unit) interact with image data by reading and writing DDR (i.e., DDR SDRAM, double rate synchronous dynamic random access memory).

[0076] Figure 5 The image data interaction process in is as follows: ISP writes a complete image frame to DDR, NPU reads the image frame from DDR, NPU demosaicizes the image frame using the traditional demosaicing method, writes the processed image frame to DDR, and ISP reads the processed image frame from DDR. It can be seen that ISP needs to write a complete image frame to DDR before it can read the processed image frame from DDR.

[0077] If the ISP writes or reads an image frame (e.g. Figure 5 The time of image 1) in is one time unit, then use Figure 5 The time it takes to demosaic an image frame in this way is 2 time units.

[0078] The following takes a mobile phone as an example to explain the image processing method of this embodiment in detail. Of course, the following embodiment is also applicable to other electronic devices besides mobile phones, such as tablets.

[0079] Figure 6 FIG. 1 is a flowchart of an image processing method according to an embodiment of the present invention. Figure 6 In this embodiment, the image processing method may include the following steps:

[0080] S601, ISP receives a first image frame.

[0081] S602, the ISP reads the first image strip data from the first image frame and writes the first image strip data into the first buffer area of ​​the system cache according to the first image strip configuration information, the NPU reads the first image strip data from the first buffer area, and performs a demosaicing process on the first image strip data using the first model to obtain the first data.

[0082] S603, the NPU writes the first data into the second buffer area of ​​the system cache, and the ISP reads the second image strip data from the first image frame and writes it into the first buffer area according to the first image strip configuration information, and reads the first data from the second buffer area.

[0083] S604, the NPU reads the second image strip data from the first buffer area, and performs a demosaicing process on the second image strip data using the first model to obtain second data.

[0084] S605, the NPU writes the second data into the second buffer area, the ISP reads the second data from the second buffer area, and the ISP obtains the first target image corresponding to the first image frame according to the first data and the second data.

[0085] This embodiment introduces a system cache in image interaction. Although the time consumed by the CNN network to process the de-mosaicing process is longer than that of the transmission de-mosaicing process, the reading and writing speed of the system cache is much faster than that of the DDR. Therefore, this embodiment changes the traditional way of exchanging image data by reading and writing DDR, and exchanges image data on the platform by means of a shared system cache storage method, thereby improving the performance of the interactive processing between the NPU and the ISP.

[0086] Figure 7 FIG. 1 is a schematic diagram of the de-mosaicing process in this embodiment. Figure 7 In this embodiment, an image frame is divided into a number of small image slices, and then within a specified processing time interval, the ISP and the NPU complete the processing interaction on the system cache.

[0087] This is because the system cache equipped on most hardware is relatively smaller than DDR (for example, 16M on conventional platforms), while image data is often more than tens of megabytes, so the original image buffer information needs to be segmented and processed to divide the large image into small image strips.

[0088] See also Figure 7 In this embodiment, the system cache used for de-mosaic processing is applied from the memory system of the mobile phone. The structure of the system cache is as follows: Figure 7 The curved arrow on the lower right indicates the slice configuration area, the ISP write NPU read area, the ISP read NPU write area, and several reserved areas.

[0089] The slice configuration area is used to store slice configuration information (i.e., image strip configuration information). The slice configuration information may include the number of slices, the size of the slice, the first address and length of the ISP write NPU read area, the first address and length of the ISP read NPU write area, etc.

[0090] According to the starting address and length of the ISP write NPU read area and the starting address and length of the ISP read NPU write area, the ISP and NPU can know the address range of their own read data and write data.

[0091] For example, the address range of the ISP write NPU read area can be determined by the first address and length of the ISP write NPU read area in the slice configuration information, and the address range is the address range of the ISP write data, and the address range is also the address range of the NPU read data. Among them, the length of the ISP write NPU read area is equal to the length of the ISP read NPU write area.

[0092] The reserved area is used to adjust the size of the ISP write NPU read area and the ISP read NPU write area. The adjustment mechanism will be described in detail later.

[0093] Please continue to see Figure 7 This embodiment uses SIT (located in the hardware abstraction layer) to be compatible with the integration of multi-chip platform architecture: the interactive function logic is implemented as a plug-in module in SIT (for example Figure 7 The de-mosaic control module in the chip is not strongly coupled with the actual chip platform, and supports flexible switching and configurability of functions. Figure 7 Node 1, node 2, etc. can be modules for performing other processing on the image, such as noise removal, white balance, etc. Of course, the number of nodes can be more than Figure 7 The examples shown may be more or less, and this embodiment is not limited thereto.

[0094] Figure 8 FIG. 1 is another example flow chart of the image processing method in this embodiment. Figure 7 , Figure 8 In this embodiment, the image processing method may include the following steps:

[0095] S801: The user opens the camera application, and the camera service in the Android FWK sends a camera function start notification to the de-mosaic control module to notify the de-mosaic control module to start the camera function.

[0096] Herein, the demosaicing control module may also be referred to as an AIDemosaic control module.

[0097] S802: The demosaicing control module starts a dedicated processing thread.

[0098] The dedicated processing thread is used to perform de-mosaic processing on image frames that have been collected but not de-mosaiced when the camera function was last started.

[0099] S803: The de-mosaic control module loads an initial configuration file (XM file).

[0100] In one example, the configuration file may include the following information: the size of the requested system cache (i.e. Figure 7 The size of the total system cache used for demosaic processing, including slice configuration area, ISP write NPU read area, ISP read NPU write area, reserved area), slice configuration information, and the model used for demosaic processing.

[0101] The configuration file may also include the resolution, frame rate, camera format (ie, the pattern format of the sensor, such as RYYB, RGGB, etc.), product information (such as a certain model of mobile phone) corresponding to the model.

[0102] The model may be a pre-trained CNN (Convolutional Neural Networks) model.

[0103] By training the CNN model in different environmental scenes, we can obtain CNN models that are better adapted to different environmental scenes. In this way, we can make the most flexible adjustment and adaptation for the de-mosaicing process in different environmental scenes.

[0104] For example, by using sample data obtained when the brightness and darkness parameters of the main camera are in the brightness and darkness parameter range 11 to train CNN, we can obtain model 1 that is better adapted to the use of the main camera and the brightness and darkness parameters are in the brightness and darkness parameter range 11; by using sample data obtained when the brightness and darkness parameters of the main camera are in the brightness and darkness parameter range 12 to train CNN, we can obtain model 2 that is better adapted to the use of the main camera and the brightness and darkness parameters are in the brightness and darkness parameter range 12, and so on.

[0105] Of course, in other embodiments, models adapting to different frame rate ranges can be obtained based on other parameters, such as frame rate, etc. For example, if the frame rate is large, the time left for processing each frame is short, and a model with a simple algorithm and short processing time can be configured; if the frame rate is small, the time left for processing each frame is long, and a model with a complex algorithm and long processing time but good effect can be configured.

[0106] In one example, each model corresponds to a configuration file. The same camera can correspond to multiple configuration files.

[0107] In this embodiment, it is assumed that the mobile phone has three cameras: a main camera, a telephoto camera, and a wide-angle camera.

[0108] The initial configuration file loaded in step S803 can be determined as follows: after the camera is turned on, the de-mosaic control module obtains image parameter information and determines the initial configuration file based on the image parameter information. For example, after the camera is turned on, the de-mosaic control module obtains image parameter information showing that the main camera is currently in use, and the current brightness and darkness parameters belong to the brightness and darkness parameter range 11. Then the initial configuration file loaded by the de-mosaic control module is configuration file 1 corresponding to model 1.

[0109] S804: After the camera service in the Android FWK completes the initialization operation, it notifies the demosaicing control module.

[0110] Here, the initialization operation is initiated by the framework layer Android FWK, and the initialization operation is used to prepare for the output of the image, such as calling related interfaces.

[0111] S805, the de-mosaic control module creates a model.

[0112] The model here refers to the demosaicing algorithm model.

[0113] In this step, one or more models may be created for each camera. In the multiple models created for the same camera, each model corresponds to a different scene. The different scenes here may refer to, for example, different ranges of one or more scene factors.

[0114] For example, the scene factors may include brightness parameters (ISO), frame rate parameters (FPS), handheld motion detection parameters, etc.

[0115] For example, according to the different ranges of brightness and darkness parameters, three models can be created for the main camera: Model 1 (corresponding to brightness and darkness parameter range 11, profile 1), Model 2 (corresponding to brightness and darkness parameter range 12, profile 2), and Model 3 (corresponding to brightness and darkness parameter range 13, profile 3); three models are created for the telephoto camera: Model 4 (corresponding to brightness and darkness parameter range 21, profile 4), Model 5 (corresponding to brightness and darkness parameter range 22, profile 5), and Model 6 (corresponding to brightness and darkness parameter range 23, profile 6); three models are created for the wide-angle camera: Model 7 (corresponding to brightness and darkness parameter range 31, profile 7), Model 8 (corresponding to brightness and darkness parameter range 32, profile 8), and Model 9 (corresponding to brightness and darkness parameter range 33, profile 9).

[0116] S806: Call the creation initialization of the model through the HIDL interface.

[0117] This step is: the de-mosaic control module deploys a model in the NPU (the model is the model in the initial configuration file in step S803).

[0118] S807. The de-mosaic control module creates a shared memory between the NPU and the ISP and maps the system memory.

[0119] In this step, the shared memory between the NPU and the ISP is the system memory (ie, the system cache) used for demosaicing. The demosaicing control module can determine the size of the system cache to be applied for according to the initial configuration file.

[0120] Mapping the system memory is to correspond the physical addresses of the system memory to the addresses that can be recognized by the NPU and ISP.

[0121] S808. The de-mosaic control module passes the mapping buffer handle and the slice configuration information in the initial configuration file to the NPU through the HIDL interface.

[0122] Among them, buffer refers to the system cache.

[0123] The content of the handle may be, for example, a mapping relationship between a physical address of a system memory and an address recognizable by the NPU.

[0124] Through this step, the NPU learns the mapping relationship between the system cache address and the address it can identify. In addition, based on the slice configuration information, the NPU also learns the starting address and length of each area in the system cache, such as the ISP write NPU read area and the ISP read NPU write area, providing a basis for the NPU to read and write data to the system cache.

[0125] S809. The de-mosaic control module transmits the mapping buffer handle and the slice configuration information in the initial configuration file to the ISP through the HIDL interface.

[0126] Through this step, ISP learns the mapping relationship between the system cache address and the address it can identify. In addition, based on the slice configuration information, ISP also learns the starting address and length of each area in the system cache, such as the ISP write NPU read area and the ISP read NPU write area, which provides a basis for ISP to read and write data to the system cache.

[0127] S810: The de-mosaic control module controls the NPU to perform corresponding frequency modulation and voltage regulation actions.

[0128] The purpose of frequency and voltage regulation in this step is to increase the operating frequency of the NPU and improve processing performance.

[0129] S811. The de-mosaic control module controls the ISP to perform corresponding frequency modulation and voltage regulation actions.

[0130] The purpose of frequency and voltage regulation in this step is to increase the ISP operating frequency and improve processing performance.

[0131] S812: The display / coding module sends a cache address M for storing the demosaiced image to the camera service of the Android FWK.

[0132] S813. The camera service of Android FWK sends a configuration operation corresponding to each new frame request of the camera to the de-mosaic control module.

[0133] In this step, when each image frame is generated, the camera calls the mosaic control module to perform de-mosaic processing on the image frame.

[0134] S814: The de-mosaic control module identifies the current scene.

[0135] The recognition scene is used to determine whether the current scene matches the model used in the NPU.

[0136] For example, the identified content may include one or more of the following:

[0137] (1) Identify whether the brightness parameter (ISO) changes;

[0138] (2) Identify whether the frame rate parameter (FPS) changes;

[0139] (3) Identify whether it is a motion scene through handheld motion detection;

[0140] (4) Identify whether to switch the camera.

[0141] The recognition content is the same as the scene factor corresponding to the model. For example, if the scene factor of the model is determined to be the camera and the range of brightness parameters, the recognition content includes: identifying whether the camera is switched and whether the brightness parameter (ISO) changes. Whether the brightness parameter (ISO) changes here refers to whether the range of brightness parameters (corresponding to the model) changes.

[0142] Of course, the recognized content is not limited to the above-mentioned ones, and the recognized content can be increased or decreased as needed in the application.

[0143] S815. The de-mosaic control module determines whether a new model needs to be started according to the current scene recognition result.

[0144] For example, the de-mosaic control module may determine that a new model needs to be started when any of the following results are identified, and otherwise determine that a new model does not need to be started:

[0145] (1) A change in the brightness parameter (ISO) is identified. For example, the brightness parameter before the change belongs to the brightness range 11, corresponding to model 1, and the brightness parameter after the change belongs to the brightness range 12, corresponding to model 2;

[0146] (2) Identify changes in frame rate parameters (FPS);

[0147] (3) Recognizing a motion scene through handheld motion detection;

[0148] (4) Recognize the camera switch.

[0149] S816a. If there is no need to enable a new model, keep the original model unchanged and execute step S817.

[0150] S816b. If you need to enable a new model, perform the following steps:

[0151] b1. The de-mosaic control module sends a message 1 to the ISP to stop the old model.

[0152] b2. The ISP sends refresh configuration information 1 to the NPU.

[0153] The NPU deletes the deployed old model according to the refresh configuration information 1.

[0154] b3. The de-mosaic control module sends information 2 to the ISP to enable the new model.

[0155] b2. The ISP sends refresh configuration information 2 to the NPU.

[0156] The NPU deploys the new model according to the refresh configuration information 2 .

[0157] If the recognition result includes switching the camera, the information 1 for stopping the old model and the refresh configuration information 1 are also used to indicate stopping the old slice configuration information. The ISP stops using the old slice configuration information according to the information 1 for stopping the old model, and the NPU stops using the old slice configuration information according to the refresh configuration information 1.

[0158] Furthermore, if the recognition result includes switching the camera, the information 2 for enabling the new model and the refresh configuration information 2 are also used to indicate enabling the new slice configuration information. The ISP enables the new slice configuration information according to the information 1 for enabling the new model, and the NPU enables the new slice configuration information according to the refresh configuration information 2.

[0159] If the recognition result does not include camera switching, the information b1 to b4 does not include corresponding indication information about the slice configuration information.

[0160] S817, ISP and NPU use the system cache to process each slice of the image frame alternately.

[0161] In this step, the ISP and NPU use the system cache to process each image strip of an image frame alternately until all image strips of an image frame are processed. For each image strip, the processing process is as follows:

[0162] (1) ISP writes to NPU reads, that is, the ISP writes the image data to the ISP write NPU read area of ​​the system cache, and the NPU reads the image data from this area;

[0163] (2) NPU processes data, that is, the NPU uses the model currently configured in itself to perform demosaicing on the read image strip data to obtain demosaiced image strip data;

[0164] (3) NPU writes and ISP reads, that is, the NPU writes the demosaiced image strip data to the ISP read NPU write area of ​​the system cache, and the ISP reads the demosaiced image strip data from this area.

[0165] S818: After completing the demosaicing process for all image strips of an image frame, the ISP returns a frame of complete demosaiced image to the camera service of the Android FWK.

[0166] S819. The camera service of Android FWK returns a complete demosaiced image of the frame to the display / codec module.

[0167] Then, the display / codec module can display the demosaiced image (completed by the display module) or generate a video file according to the demosaiced image (completed by the codec module).

[0168] S820. The camera service of Android FWK sends a camera stop streaming notification to the demosaicing control module.

[0169] For example, when a user stops taking photos or recording videos, the camera no longer generates image data and no longer sends image data to the ISP. At this time, the camera is considered to have stopped streaming.

[0170] S820. The de-mosaic control module sends a Flush instruction to the ISP and stops the model.

[0171] In this way, when the ISP receives the instruction to Flush and stop the model, it will process all the data of the current image frame (one) being processed, and the remaining unprocessed image frames will no longer be processed.

[0172] by Figure 7For example, suppose that when the ISP receives the instruction to flush and stop the model, the ISP is writing image strip 2.3 to the system cache. Then the ISP and NPU will de-mosaic image strips 2.3 and 2.4. After processing the entire image frame 2, the ISP stops the model and no longer writes to the system cache. Figure 7 Image frames 3 and 4 in are processed.

[0173] S821. The de-mosaic control module destroys the shared memory.

[0174] This step is to release the shared memory applied for in step S807.

[0175] S822. The de-mosaicing control module unloads and destroys all loaded models.

[0176] This step is to uninstall and destroy all models created in step S805.

[0177] S823. The de-mosaic control module notifies the NPU to unload and destroy the model.

[0178] The NPU unloads and destroys the model loaded by itself according to the notification.

[0179] S824. The de-mosaic control module destroys its own internal thread.

[0180] Below Figure 7 Taking the demosaicing process of an image frame as an example, the demosaicing process of an image frame is described in detail.

[0181] Example 1

[0182] In this example, it is assumed that the mobile phone has three cameras: a main camera, a telephoto camera, and a wide-angle camera. Figure 7 The image frame 1 in the figure is the image data collected by the main camera, and the de-mosaic algorithm model configured in the NPU is model 1. The total size of the system cache F applied for is 8M, of which the size of the initially configured ISP write NPU read area is 3M (for the convenience of description, referred to as cache area 1 below), and the size of the initially configured ISP read NPU write area (for the convenience of description, referred to as cache area 2 below) is also 3M. The number of image strips configured in the slice configuration information 1 of the initial configuration file is 4, and the size of the image strip is 3M.

[0183] The data volume of image frame 1 is 12M. Image frame 1 is divided into four image strips, namely image strip 1.1, image strip 1.2, image strip 1.3 and image strip 1.4. The size of each image strip is 3M.

[0184] Image frame 1 is the first image frame received by the ISP after the camera is turned on. Then, the image data demosaicing process of image frame 1 is as follows:

[0185] ISP receives image frame 1;

[0186] ISP reads slice configuration information 1 corresponding to image strip 1.1 from system cache F, reads 3M data from image frame 1 according to slice configuration information 1, which is image strip 1.1, and writes image strip 1.1 into cache area 1;

[0187] The NPU reads the image strip 1.1 from the buffer area 1, and performs demosaicing on the image strip 1.1 using the model 1 to obtain demosaiced image data 11;

[0188] The NPU writes the de-mosaiced image data 11 into the cache area 2 in the time period 1. The ISP reads the slice configuration information 1 corresponding to the image strip 1.2 from the system cache F in the time period 1. According to the slice configuration information 1, 3M data is read from the remaining data in the image frame 1, that is, the image strip 1.2, and the image strip 1.2 is written into the cache area 1. The mosaic image data 11 is read from the cache area 2 in the time period 1.

[0189] The NPU reads the image strip 1.2 from the buffer area 1, and performs demosaicing on the image strip 1.2 using the model 1 to obtain demosaiced image data 12;

[0190] The NPU writes the de-mosaiced image data 12 into the cache area 2 in the time period 2, and the ISP reads the slice configuration information 1 corresponding to the image strip 1.3 from the system cache F in the time period 2, and reads 3M data from the remaining data in the image frame 1 according to the slice configuration information 1, that is, the image strip 1.3, writes the image strip 1.3 into the cache area 1, and reads the mosaic image data 12 from the cache area 2 in the time period 2;

[0191] The NPU reads the image strip 1.3 from the buffer area 1, and performs demosaicing on the image strip 1.3 using the model 1 to obtain demosaiced image data 13;

[0192] The NPU writes the demosaiced image data 13 into the buffer area 2 in the time period 3. The ISP reads the slice configuration information 1 corresponding to the image strip 1.4 from the system buffer F in the time period 3. According to the slice configuration information 1, 3M data is read from the remaining data in the image frame 1, that is, the image strip 1.4. The image strip 1.4 is written into the buffer area 1, and the mosaic image data 13 is read from the buffer area 2 in the time period 3.

[0193] The NPU reads the image strip 1.4 from the buffer area 1, and performs demosaicing on the image strip 1.4 using the model 1 to obtain demosaiced image data 14;

[0194] The NPU writes the de-mosaiced image data 14 into the buffer area 2 in the time period 4, and the ISP reads the mosaic image data 14 from the buffer area 2 in the time period 4;

[0195] The ISP obtains a demosaiced image 1 corresponding to the image frame 1 according to the mosaic image data 11 , the mosaic image data 12 , the mosaic image data 13 , and the mosaic image data 14 .

[0196] Then, the ISP sends the demosaiced image 1 to the camera service, and the camera service sends the demosaiced image 1 to the display / codec module (such as Figure 8 The mosaic image 1 is stored in the cache address M, and the display / encoding module reads the mosaic image 1 from the cache address M. The subsequent processing of each de-mosaiced image is the same as that of the mosaic image 1, which will not be repeated below.

[0197] After capturing the image frame 1, on the one hand, the sensor corresponding to the main camera of the camera sends the image frame 1 to the ISP, and on the other hand, sends the image parameter information 1 corresponding to the image frame 1 to the de-mosaic control module, where the image parameter information 1 includes the brightness parameter value 1;

[0198] The demosaic control module performs scene recognition according to the image parameter information 1, and recognizes that the brightness parameter value 1 (in this example, the brightness parameter is a scene factor) corresponding to the image frame 1 does not match the model 1, that is, the brightness parameter value 1 does not belong to the brightness parameter range 11 corresponding to the model 1, but belongs to the brightness parameter range 12 corresponding to the model 2;

[0199] The demosaicing control module determines, according to the recognition result, a model 2 that matches the brightness parameter value 1 of the image frame 1, and the model 2 is not the same model as the model 1;

[0200] The de-mosaic control module updates model 1 in the NPU to model 2, that is, unloads model 1 and loads model 2.

[0201] In this example, the camera is not switched, but the brightness parameters are changed, so only the model in the NPU is replaced, and the slice configuration information (including the start address and length of the ISP write NPU read area and the ISP read NPU write area in the system cache F) is not changed.

[0202] It should be noted that scene recognition can be performed before the ISP processes the image frame 1, or after the ISP processes the image frame 1.

[0203] Example 2

[0204] Based on Example 1, Figure 7Image frame 2 in is also image data collected by the main camera, and the de-mosaic algorithm model configured in the NPU is currently model 2. The ISP write NPU read area in the system cache F is still cache area 1 in Example 1, and the ISP read NPU write area is still cache area 2 in Example 1. The number of image strips configured in the slice configuration information is still 4, and the size of the image strip is still 3M.

[0205] The data volume of the image frame 2 is 12M. The image frame 2 is divided into four image strips, namely, image strip 2.1, image strip 2.2, image strip 2.3, and image strip 2.4. The size of each image strip is 3M.

[0206] Image frame 2 is the second image frame received by the ISP after the camera is turned on. Then, the de-mosaicing process of the image data of image frame 2 is as follows:

[0207] ISP receives image frame 2;

[0208] ISP reads slice configuration information 1 corresponding to image strip 2.1 from system cache F, reads 3M data from image frame 2 according to slice configuration information 1, which is image strip 2.1, and writes image strip 2.1 into cache 1;

[0209] The NPU reads the image strip 2.1 from the buffer area 1, and performs demosaicing on the image strip 2.1 using the model 2 to obtain demosaiced image data 21;

[0210] The NPU writes the de-mosaiced image data 21 into the cache area 2 in the time period 5, and the ISP reads the slice configuration information 1 corresponding to the image strip 2.2 from the system cache F in the time period 5, and reads 3M data from the remaining data in the image frame 2 according to the slice configuration information 1, that is, the image strip 2.2, writes the image strip 2.2 into the cache area 1, and reads the mosaic image data 21 from the cache area 2 in the time period 5;

[0211] The NPU reads the image strip 2.2 from the buffer area 1, and performs a demosaicing process on the image strip 2.2 using the model 2 to obtain a demosaiced image data 22;

[0212] The NPU writes the de-mosaiced image data 22 into the buffer area 2 in the time period 6, and the ISP reads the slice configuration information 1 corresponding to the image strip 2.3 from the system buffer F in the time period 6, and reads 3M data from the remaining data in the image frame 2 according to the slice configuration information 1, that is, the image strip 2.3, writes the image strip 2.3 into the buffer area 1, and reads the mosaic image data 22 from the buffer area 2 in the time period 6;

[0213] The NPU reads the image strip 2.3 from the buffer area 1, and performs demosaicing on the image strip 2.3 using the model 2 to obtain demosaiced image data 23;

[0214] The NPU writes the demosaiced image data 23 into the buffer area 2 in the time period 7, and the ISP reads the slice configuration information 1 corresponding to the image strip 2.4 from the system buffer F in the time period 37, and reads 3M data from the remaining data in the image frame 2 according to the slice configuration information 1, that is, the image strip 2.4, writes the image strip 2.4 into the buffer area 1, and reads the mosaic image data 23 from the buffer area 2 in the time period 7;

[0215] The NPU reads the image strip 2.4 from the buffer area 1, and performs demosaicing on the image strip 2.4 using the model 2 to obtain demosaiced image data 24;

[0216] The NPU writes the demosaiced image data 24 into the buffer area 2 in the time period 8, and the ISP reads the demosaiced image data 24 from the buffer area 2 in the time period 8;

[0217] The ISP obtains a demosaiced image 2 corresponding to the image frame 2 according to the mosaic image data 21 , the mosaic image data 22 , the mosaic image data 23 and the mosaic image data 24 .

[0218] After the image frame 2 is acquired, on the one hand, the sensor corresponding to the main camera of the camera sends the image frame 2 to the ISP, and on the other hand, the image parameter information 2 corresponding to the image frame 2 is sent to the de-mosaic control module, and the image parameter information 2 includes the brightness parameter value 2;

[0219] The de-mosaic control module performs scene recognition based on the image parameter information 2, and recognizes that the brightness parameter value 2 (in this example, the brightness parameter is a scene factor) corresponding to the image frame 2 matches the model 2, that is, the brightness parameter value 1 belongs to the brightness parameter range 12 corresponding to the model 2.

[0220] In this case, the demosaic control module does not replace the model in the NPU.

[0221] In this example, the camera is not switched, and the range of the brightness and darkness parameters is not changed, so there is no need to change the model in the NPU or the slice configuration information. The model in the NPU remains model 2.

[0222] Example 3

[0223] Based on Example 2, after the camera acquires image frame 3, it switches the main camera to the wide-angle camera. Figure 7 The image frame 3 in the figure is the image data collected by the wide-angle camera. At this time, after the de-mosaic control module learns the camera switching information, it uses Figure 8 Steps b1 to b4 of step 816b in the system cache update the slice configuration information 1 in the system cache to the slice configuration information 2, and update the demosaicing algorithm model 2 configured in the NPU to the model 9. According to the slice configuration information 2, the ISP write NPU read area in the system cache F is changed to the cache area 3, and the ISP read NPU write area is changed to the cache area 4. The number of image strips configured in the slice configuration information 2 is 3, and the size of the image strip is still 3M.

[0224] It should be noted that when the camera is switched, the de-mosaic control module will update the slice configuration information and model before the ISP processes the switched image frame.

[0225] The data volume of the image frame 3 is 9M. The image frame 3 is divided into three image strips, namely, image strip 3.1, image strip 3.2, and image strip 3.3. The size of each image strip is 3M.

[0226] The demosaicing process for the image data of image frame 3 is as follows:

[0227] ISP reads slice configuration information 2 corresponding to image strip 3.1 from system cache F, reads 3M data from image frame 4 according to slice configuration information 2, namely image strip 4.1, and writes image strip 4.1 into cache 3;

[0228] The NPU reads the image strip 3.1 from the buffer area 3, and performs demosaicing on the image strip 4.1 using the model 9 to obtain demosaiced image data 31;

[0229] The NPU writes the demosaiced image data 31 into the buffer area 4 in the time period 9, and the ISP reads the slice configuration information 2 corresponding to the image strip 3.2 from the system buffer F in the time period 9, and reads 3M data from the remaining data in the image frame 3 according to the slice configuration information 2, that is, the image strip 3.2, writes the image strip 3.2 into the buffer area 3, and reads the mosaic image data 31 from the buffer area 4 in the time period 9;

[0230] The NPU reads the image strip 3.2 from the buffer area 3, and performs demosaicing on the image strip 3.2 using the model 9 to obtain demosaiced image data 32;

[0231] The NPU writes the demosaiced image data 32 into the buffer area 4 in the time period 10, and the ISP reads the slice configuration information 2 corresponding to the image strip 3.3 from the system buffer F in the time period 10, and reads 3M data from the remaining data in the image frame 4 according to the slice configuration information 2, that is, the image strip 3.3, writes the image strip 3.3 into the buffer area 3, and reads the mosaic image data 32 from the buffer area 4 in the time period 10;

[0232] The NPU reads the image strip 3.3 from the buffer area 3, and performs demosaicing on the image strip 3.3 using the model 9 to obtain demosaiced image data 33;

[0233] The NPU writes the demosaiced image data 33 into the buffer area 4 in the time period 11, and the ISP reads the mosaic image data 33 from the buffer area 4 in the time period 11;

[0234] The ISP obtains a demosaiced image 3 corresponding to the image frame 3 according to the mosaic image data 31 , the mosaic image data 32 , and the mosaic image data 33 .

[0235] After acquiring the image frame 3, on the one hand, the sensor corresponding to the main camera of the camera sends the image frame 3 to the ISP, and on the other hand, sends the image parameter information 3 corresponding to the image frame 3 to the de-mosaic control module, and the image parameter information 3 includes the camera switching information;

[0236] The de-mosaic control module performs scene recognition according to the image parameter information 3 to obtain a scene recognition result 3, and the scene recognition result 3 indicates that the scene has not changed.

[0237] In this example, the camera is not switched and the range of the brightness and darkness parameters is not changed, so there is no need to change the model in the NPU or the slice configuration information. The model in the NPU remains model 9.

[0238] Example 4

[0239] Based on Example 3, Figure 7 Image frame 4 in the figure is image data collected by the wide-angle camera, and the de-mosaic algorithm model configured in the NPU is currently model 9. The ISP write NPU read area in the system cache F is cache area 3, and the ISP read NPU write area is cache area 4. The number of image strips configured in the slice configuration information 2 is 3, and the size of the image strip is still 3M.

[0240] The data volume of image frame 4 is 9M. Image frame 4 is divided into image strip 4.1, image strip 4.2, and image strip 4.3, a total of 3 image strips, and the size of each image strip is 3M.

[0241] The de-mosaicing process for the image data of the image frame 4 is the same as the de-mosaicing process for the image data of the image frame 3, and will not be described in detail here.

[0242] It should be noted that in the above examples, the various actions performed in the same time period should be understood as the various actions being performed in parallel. For example, in the above example one, the NPU writes the de-mosaiced image data 12 into cache 2 in time period 2, and the ISP reads the slice configuration information 1 corresponding to the image strip 1.3 from the system cache F in time period 2. According to the slice configuration information 1, 3M data is read from the remaining data in the image frame 1, which is the image strip 1.3, and the image strip 1.3 is written into cache 1. In addition, the mosaic image data 12 is read from cache 2 in time period 2. It should be understood that the actions of the NPU writing the de-mosaiced image data 12 into cache 2, the ISP writing the image strip 1.3 into cache 1, and the ISP reading the mosaic image data 12 from cache 2 are performed in parallel. In this way, please refer to Figure 7 , taking the processing of image frame 1 as an example, the time taken to perform de-mosaicing on image frame 1 is 1.25 time units. Figure 5 Compared with the traditional solution shown, the image data interaction method adopted in this embodiment can effectively reduce the processing time of each frame of image, thereby improving the processing speed.

[0243] It can be seen from the foregoing embodiments that the image processing method of this embodiment can flexibly change the de-mosaic algorithm according to different scenes, and has good adaptability and high flexibility.

[0244] This embodiment also provides an electronic device. Fig. 9 FIG. 4 is a block diagram of the structure of an electronic device of the present embodiment.

[0245] See also Fig. 9 In (a) of the figure, in one example, the electronic device may include an ISP and an NPU.

[0246] See also Fig. 9 In another example, the electronic device may include an ISP, an NPU, and a de-mosaic control module. The connection method of the ISP, the NPU, and the de-mosaic control module may be as follows: Figure 7 In the electronic device of this embodiment, the functions of the ISP, NPU and de-mosaic control module refer to the descriptions in the above embodiments, which will not be repeated here.

[0247] An embodiment of the present application also provides an electronic device, which includes a memory and a processor, wherein the memory is coupled to the processor, and the memory stores program instructions. When the program instructions are executed by the processor, the electronic device performs the image processing method performed by the aforementioned electronic device.

[0248] It is understandable that, in order to realize the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.

[0249] This embodiment further provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the image processing method in the above-mentioned embodiment.

[0250] This embodiment further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the image processing method in the above-mentioned embodiment.

[0251] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer execution instructions, and when the device is running, the processor can execute the computer execution instructions stored in the memory so that the chip executes the image processing method in the above-mentioned method embodiments.

[0252] Among them, the electronic device, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above and will not be repeated here.

[0253] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0254] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0255] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0256] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0257] Any content of each embodiment of the present application, as well as any content of the same embodiment, can be freely combined. Any combination of the above content is within the scope of the present application.

[0258] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0259] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

[0260] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in a hardware manner, or can be implemented by a processor executing a software instruction. The software instruction can be composed of corresponding software modules, and the software module can be stored in a random access memory (Random Access Memory, RAM), a flash memory, a read-only memory (Read Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable ROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), a register, a hard disk, a mobile hard disk, a read-only compact disk (CD-ROM) or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.

[0261] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.

[0262] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. An image processing method, characterized in that: Applied to electronic equipment, the method comprises: The image signal processor ISP receives a first image frame; The ISP reads the first image strip data from the first image frame and writes the first image strip data into a first buffer area of ​​the system buffer according to the first image strip configuration information; The neural network processor NPU reads the first image strip data from the first buffer area, and performs demosaic processing on the first image strip data using a first model to obtain first data; The NPU writes the first data into the second buffer area of ​​the system buffer, and the ISP reads the second image strip data from the first image frame and writes the second image strip data into the first buffer area according to the first image strip configuration information, and reads the first data from the second buffer area; The NPU reads the second image strip data from the first buffer area, and performs demosaic processing on the second image strip data using the first model to obtain second data; The NPU writes the second data into the second buffer area, and the ISP reads the second data from the second buffer area; The ISP obtains a first target image corresponding to the first image frame according to the first data and the second data.

2. The method according to claim 1, characterized in that Also includes: The demosaic control module receives first image parameter information corresponding to the first image frame; The de-mosaic control module performs scene recognition according to the first image parameter information to obtain a first scene recognition result, wherein the first scene recognition result indicates that a first scene factor corresponding to the first image frame does not match the first model, and the first scene factor does not include a camera; The demosaic control module determines, according to the first scene recognition result, a second model that matches the first scene factor of the first image frame, wherein the second model is different from the first model; The de-mosaic control module updates the first model in the NPU to the second model.

3. The method according to claim 2, characterized in that Also includes: The ISP receives a second image frame; The ISP reads the third image strip data from the second image frame and writes the third image strip data into the first buffer area according to the first image strip configuration information; The NPU reads the third image strip data from the first buffer area, and performs demosaic processing on the third image strip data using the second model to obtain third data; The NPU writes the third data into the second buffer area, and the ISP reads the fourth image strip data from the second image frame and writes the fourth image strip data into the first buffer area according to the first image strip configuration information, and reads the third data from the second buffer area; The NPU reads the fourth image strip data from the first buffer area, and performs demosaic processing on the fourth image strip data using the second model to obtain fourth data; The NPU writes the fourth data into the second buffer area, and the ISP reads the fourth data from the second buffer area; The ISP obtains a second target image corresponding to the second image frame according to the third data and the fourth data.

4. The method according to claim 3, characterized in that Also includes: The demosaic control module receives second image parameter information corresponding to the second image frame; The de-mosaicing control module performs scene recognition according to the second image parameter information to obtain a second scene recognition result, where the second scene recognition result indicates that all preset scene factors corresponding to the second image frame match the second model.

5. The method according to claim 1, characterized in that Also includes: The ISP receives a third image frame; The ISP reads the fifth image strip data from the third image frame and writes the fifth image strip data into the first buffer area according to the first image strip configuration information; The NPU reads the fifth image strip data from the first buffer area, and performs demosaic processing on the fifth image strip data using the first model to obtain fifth data; The NPU writes the fifth data into the second buffer area, and the ISP reads the sixth image strip data from the third image frame and writes the sixth image strip data into the first buffer area according to the first image strip configuration information, and reads the fifth data from the second buffer area; The NPU reads the sixth image strip data from the first buffer area, and performs demosaicing on the sixth image strip data using the first model to obtain sixth data; The NPU writes the sixth data into the second buffer area, and the ISP reads the sixth data from the second buffer area; The ISP obtains a third target image corresponding to the third image frame according to the fifth data and the sixth data.

6. The method according to claim 5, characterized in that Also includes: The demosaic control module receives the camera switching information; The de-mosaic control module performs scene recognition according to the camera switching information to obtain a third scene recognition result, wherein the third scene recognition result indicates switching from the first camera corresponding to the first image frame to the second camera; The de-mosaic control module determines, according to the third scene recognition result, a third model and target configuration information that matches the second camera, wherein the third model is different from the first model; The demosaic control module updates the first model in the NPU to the third model, and updates the first image strip configuration information to the second image strip configuration information in the target configuration information; The de-mosaic control module creates a third cache area and a fourth cache area in the system cache according to the target configuration information, and notifies the ISP and the NPU of the address of the third cache area and the address of the fourth cache area.

7. The method according to claim 6, characterized in that Also includes: The ISP receives a fourth image frame; The ISP reads the seventh image strip data from the fourth image frame and writes the seventh image strip data into the third buffer area according to the second image strip configuration information; The NPU reads the seventh image strip data from the third buffer area, and performs a demosaicing process on the seventh image strip data using the third model to obtain seventh data; The NPU writes the seventh data into the fourth buffer area, and the ISP reads the eighth image strip data from the fourth image frame and writes the eighth image strip data into the third buffer area according to the second image strip configuration information, and reads the seventh data from the fourth buffer area; The NPU reads the eighth image strip data from the third buffer area, and performs demosaicing on the eighth image strip data using the third model to obtain eighth data; The NPU writes the eighth data into the fourth buffer area, and the ISP reads the ninth image strip data from the fourth image frame and writes the ninth image strip data into the third buffer area according to the second image strip configuration information, and reads the eighth data from the fourth buffer area; The NPU reads the ninth image strip data from the third buffer area, and performs a demosaicing process on the ninth image strip data using the third model to obtain ninth data; The NPU writes the ninth data into the fourth buffer area, and the ISP reads the ninth data from the fourth buffer area; The ISP obtains a fourth target image corresponding to the fourth image frame according to the seventh data, the eighth data and the ninth data.

8. The method according to claim 1, characterized in that Before the image signal processor ISP receives the first image frame, the method further includes: The de-mosaic control module applies to create the first cache area and the second cache area in the system cache according to the initial configuration file, and notifies the ISP and the NPU of a first address corresponding to the first cache area and a second address corresponding to the second cache area; The demosaic control module writes the first image strip configuration information into the image strip configuration area of ​​the system cache according to the initial configuration file; The de-mosaic control module creates multiple de-mosaic algorithm models, and deploys the first model among the multiple de-mosaic algorithm models in the NPU.

9. The method according to claim 1, characterized in that: The de-mosaic control module creates the first cache area and the second cache area in the system cache according to the initial configuration file, and before notifying the ISP and the NPU of a first address corresponding to the first cache area and a second address corresponding to the second cache area, further comprising: When the camera function is started, the de-mosaic control module starts a dedicated processing thread, and the dedicated processing thread is used to perform de-mosaic processing on image frames that have been collected but not de-mosaiced when the camera function was last started.

10. The method according to claim 1, characterized in that The size of the first buffer area is the same as the size of the second buffer area.

11. The method according to claim 6, characterized in that The size of the third cache area is the same as the size of the fourth cache area, and the size of the third cache area is different from the size of the first cache area.

12. An electronic device, characterized in that: include: An image signal processor ISP is used to receive a first image frame, read first image strip data from the first image frame and write the first image strip data into a first buffer area of ​​a system buffer according to first image strip configuration information; A neural network processor NPU, configured to read the first image strip data from the first buffer area, and perform a demosaicing process on the first image strip data using a first model to obtain first data; The NPU is further used to write the first data into a second buffer area of ​​the system buffer, and the ISP is further used to read the second image strip data from the first image frame and write it into the first buffer area according to the first image strip configuration information, and read the first data from the second buffer area; The NPU is further configured to read the second image strip data from the first buffer area, and perform a demosaicing process on the second image strip data using the first model to obtain second data; The NPU is further used to write the second data into the second buffer area, and the ISP is further used to read the second data from the second buffer area; The ISP is further used to obtain a first target image corresponding to the first image frame according to the first data and the second data.

13. The electronic device according to claim 12, characterized in that: Also includes: A demosaic control module, configured to receive first image parameter information corresponding to the first image frame; and, for performing scene recognition according to the first image parameter information to obtain a first scene recognition result, wherein the first scene recognition result indicates that a first scene factor corresponding to the first image frame does not match the first model, and the first scene factor does not include a camera; and, for determining, according to the first scene recognition result, a second model that matches the first scene factor of the first image frame, wherein the second model is different from the first model; And, used to update the first model in the NPU to the second model.

14. The electronic device according to claim 13, characterized in that: The ISP is further configured to receive a second image frame; and, based on the first image strip configuration information, read third image strip data from the second image frame and write the data into the first buffer area; The NPU is further configured to read the third image strip data from the first buffer area, and perform a demosaicing process on the third image strip data using the second model to obtain third data; The NPU is further used to write the third data into the second buffer area, and the ISP is further used to read the fourth image strip data from the second image frame and write it into the first buffer area according to the first image strip configuration information, and read the third data from the second buffer area; The NPU is further configured to read the fourth image strip data from the first buffer area, and perform a demosaicing process on the fourth image strip data using the second model to obtain fourth data; The NPU is further used to write the fourth data into the second buffer area, and the ISP is further used to read the fourth data from the second buffer area; The ISP is further used to obtain a second target image corresponding to the second image frame according to the third data and the fourth data.

15. The electronic device according to claim 14, characterized in that: The de-mosaic control module is also used to receive second image parameter information corresponding to the second image frame; and to perform scene recognition based on the second image parameter information to obtain a second scene recognition result, wherein the second scene recognition result indicates that all preset scene factors corresponding to the second image frame match the second model.

16. The electronic device according to claim 12, characterized in that: The ISP is further configured to receive a third image frame; and, based on the first image strip configuration information, read fifth image strip data from the third image frame and write the fifth image strip data into the first buffer area; The NPU is further configured to read the fifth image strip data from the first buffer area, and perform a demosaicing process on the fifth image strip data using the first model to obtain fifth data; The NPU is further used to write the fifth data into the second buffer area, and the ISP is further used to read the sixth image strip data from the third image frame and write it into the first buffer area according to the first image strip configuration information, and read the fifth data from the second buffer area; The NPU is further configured to read the sixth image strip data from the first buffer area, and perform a demosaicing process on the sixth image strip data using the first model to obtain sixth data; The NPU is further used to write the sixth data into the second buffer area, and the ISP is further used to read the sixth data from the second buffer area; The ISP is further used to obtain a third target image corresponding to the third image frame according to the fifth data and the sixth data.

17. The electronic device according to claim 16, characterized in that: The de-mosaic control module is further configured to receive camera switching information; and to perform scene recognition according to the camera switching to obtain a third scene recognition result, wherein the third scene recognition result indicates switching from the first camera corresponding to the first image frame to the second camera; and, for determining, according to the third scene recognition result, a third model and target configuration information that matches the second camera, wherein the third model is different from the first model; and, used to update the first model in the NPU to the third model, and update the first image strip configuration information to the second image strip configuration information in the target configuration information; And, it is used to create a third cache area and a fourth cache area in the system cache according to the target configuration information, and notify the ISP and the NPU of the address of the third cache area and the address of the fourth cache area.

18. The electronic device according to claim 17, characterized in that: The ISP is further configured to receive a fourth image frame; and, based on the second image strip configuration information, read a seventh image strip data from the fourth image frame and write the seventh image strip data into the third buffer area; The NPU is further configured to read the seventh image strip data from the third buffer area, and perform a demosaicing process on the seventh image strip data using the third model to obtain seventh data; The NPU is further used to write the seventh data into the fourth buffer area, and the ISP is further used to read the eighth image strip data from the fourth image frame and write the eighth image strip data into the third buffer area according to the second image strip configuration information, and read the seventh data from the fourth buffer area; The NPU is further configured to read the eighth image strip data from the third buffer area, and perform a demosaicing process on the eighth image strip data using the third model to obtain eighth data; The NPU is further used to write the eighth data into the fourth buffer area, and the ISP is further used to read the ninth image strip data from the fourth image frame and write the ninth image strip data into the third buffer area according to the second image strip configuration information, and read the eighth data from the fourth buffer area; The NPU is further configured to read the ninth image strip data from the third buffer area, and perform a demosaicing process on the ninth image strip data using the third model to obtain ninth data; The NPU is further used to write the ninth data into the fourth buffer area, and the ISP is further used to read the ninth data from the fourth buffer area; The ISP is further used to obtain a fourth target image corresponding to the fourth image frame according to the seventh data, the eighth data and the ninth data.

19. The electronic device according to claim 12, characterized in that: The demosaic control module is further configured to create the first buffer area and the second buffer area in the system buffer according to the initial configuration file, and notify the ISP and the NPU of a first address corresponding to the first buffer area and a second address corresponding to the second buffer area; and to write the first image strip configuration information in the image strip configuration area of ​​the system buffer according to the initial configuration file; And, used to create multiple de-mosaic algorithm models, and deploy the first model among the multiple de-mosaic algorithm models in the NPU.

20. The electronic device according to claim 12, characterized in that: The de-mosaic control module is also used to start a dedicated processing thread when the camera function is started, and the dedicated processing thread is used to perform de-mosaic processing on image frames that have been collected but not de-mosaiced when the camera function was last started.

21. The electronic device according to claim 12, characterized in that: The size of the first buffer area is the same as the size of the second buffer area.

22. The electronic device according to claim 17, characterized in that: The size of the third cache area is the same as the size of the fourth cache area, and the size of the third cache area is different from the size of the first cache area.

Citation Information

Patent Citations

  • Image processing method and related equipment

    CN114338958A

  • Shooting method, electronic equipment and readable storage medium

    CN114422682A

  • Photographing method and electronic equipment

    CN115696063A

  • Image processing method and device

    CN115735226A

  • White balance processing method and electronic equipment

    CN115835034A