Image simulation method, device and storage medium
By inputting the original image and processing parameters into the camera's own image processing path, and using environmental information for image simulation and debugging, the problem of low image simulation debugging efficiency in the existing technology is solved, and efficient and accurate image imaging effects are improved.
Patent Information
- Application Number
- CN202311605369.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-11-29
AI Technical Summary
The existing image simulation and debugging methods are inefficient and difficult to effectively improve the image imaging effect. Especially due to the complexity of the external environment and lack of user experience, the simulation environment is difficult to reproduce.
By inputting the original image and processing parameters into the camera's own image processing path for simulation debugging, and using processing parameters related to environmental information to perform multiple simulation debugging, it avoids the influence of the external environment and simplifies the simulation process.
It improves the efficiency and accuracy of image simulation debugging and reduces the complexity of building the simulation environment. It only takes one picture to conduct simulation debugging multiple times based on environmental information, avoiding result errors caused by the external environment.
Smart Images

Figure CN117319789B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to an image simulation method, device and storage medium. Background Art
[0002] With the development of science and technology, the shooting effects of electronic devices (such as mobile phones and tablets with cameras) are getting better and better. Using electronic devices to shoot has become a common choice for people. However, due to factors such as limited hardware capabilities of electronic devices or users' lack of shooting experience, the original (raw) images captured by electronic devices are prone to blurring, color cast and other problems. In order to improve the imaging effect of the image, the original image can be processed.
[0003] In the development process, in order to obtain an image with the best imaging effect, it is necessary to perform simulation debugging on the original image, that is, to continuously modify the processing parameters for the original image for simulation debugging. However, the efficiency of the existing simulation debugging method is low. Summary of the invention
[0004] The embodiment of the present application provides an image simulation method, device and storage medium. The image simulation method can improve the efficiency of simulation debugging.
[0005] In a first aspect, an embodiment of the present application provides an image simulation method, the method comprising: in response to a first instruction, obtaining an original image from a storage area, and obtaining processing parameters of the original image; inputting the original image and the processing parameters into an image processing path, and processing the original image based on the processing parameters through the image processing path to obtain a simulated image. The processing parameters are related to environmental information of the stored original image; the environmental information is used to describe at least one of the photographed object in the original image, the shooting environment in which the photographed object is located, or the shooting parameters when the original image is shot.
[0006] In the embodiment of the present application, the electronic device inputs the original image and processing parameters in the storage area into the image processing path, and directly simulates and debugs the original image through the image processing path. The image processing path is built-in to the camera, and no additional simulation environment needs to be built, which can effectively improve the efficiency of simulation debugging. At the same time, the processing parameters are related to the environmental information of the stored original image, and the environmental information describes at least one of the photographed object in the original image, the shooting environment in which the photographed object is located, or the shooting parameters when the original image is taken. Only one photo needs to be taken to perform simulation debugging multiple times based on the environmental information, which can further improve the efficiency of simulation debugging.
[0007] In addition, the original image and processing parameters are at the forefront of the input image processing pipeline, and the image simulation process is not easily affected by the external environment, effectively avoiding result errors caused by the external environment.
[0008] The first instruction is used to trigger the image simulation process. The first instruction may include the following three forms: (1) the first instruction is received from the outside; (2) the first instruction is generated based on the touch operation in the shooting interface; (3) the first instruction is generated based on the existing control (such as the shutter control) in the shooting interface.
[0009] The image processing pathway includes a plurality of image processing models.
[0010] The processing parameter is an input parameter of the image processing model. For example, when the image processing path includes an automatic white balance model, the processing parameter may include a cold adjustment parameter value or a warm adjustment parameter value of the automatic white balance model.
[0011] In combination with the first aspect, in an optional implementation, the image processing pathway includes multiple image processing models; the multiple image processing models are respectively deployed in an image signal processor, a central processing unit, or a graphics processor.
[0012] Optionally, multiple image processing models can be deployed in the ISP, CPU or GPU. In this case, the camera's own image processing pathway can be directly used for image simulation without the need to configure an additional simulation platform for the chip platform, which can effectively avoid errors in simulation results caused by configuration errors.
[0013] Optionally, multiple image processing models can be deployed in the CPU or GPU. In this case, the camera's own image processing pathway can be used directly for image simulation without the need to build an additional simulation environment for non-chip platform algorithm models, which is simpler and more convenient, and improves the efficiency of simulation debugging.
[0014] Optionally, multiple image processing models can be deployed in the ISP, CPU or GPU. In this case, the camera's own image processing pathway can be used directly for image simulation, without the need to configure an additional simulation platform for the chip platform, or to build an additional simulation environment for non-chip platform algorithm models, which can improve the accuracy of simulation results while improving the efficiency of simulation debugging.
[0015] In combination with the first aspect, in an optional implementation, before obtaining the original image from the storage area, the method further includes: acquiring the original image through a camera and storing the original image in the storage area. Optionally, if the storage area is a storage area of an electronic device (including an internal storage area or an external storage area), the original image can be directly stored in the storage area. Optionally, if the storage area is a storage area of another electronic device, it specifically includes: sending the original image to the other electronic device, and when the other electronic device receives the original image, storing the original image in the storage area.
[0016] In combination with the first aspect, in an optional embodiment, before obtaining the processing parameters of the original image from the storage area, the method also includes: determining initial processing parameters based on environmental information of the original image, and storing the initial processing parameters as processing parameters of the original image in the storage area.
[0017] In combination with the first aspect, in an optional embodiment, before obtaining the processing parameters of the original image from the storage area, the method also includes: determining initial processing parameters based on environmental information of the original image; updating the initial processing parameters based on the degree of image processing required for image optimization to obtain updated processing parameters; and storing the updated processing parameters as the processing parameters of the original image in the storage area.
[0018] Optionally, the degree of image processing required for image optimization may be manually determined, that is, the updated processing parameters may be obtained based on user input operations. In this implementation, the user may actively adjust the processing parameters of the original image based on experience, and may obtain a better simulation result more quickly.
[0019] Optionally, the image processing degree required for image optimization can be determined based on the simulation image output by the last simulation process. In this implementation, the image processing degree required for image optimization can be determined based on the simulation image output by the last simulation process, which is more convenient and intelligent.
[0020] In combination with the first aspect, in an optional implementation, initial processing parameters are determined based on environmental information of the original image, including: selecting multiple image processing models from an image processing model set based on the environmental information of the original image; and using the initial parameters corresponding to the selected multiple image processing models as the initial processing parameters.
[0021] In combination with the first aspect, in an optional implementation, before obtaining the original image from the storage area in response to the first instruction and obtaining the processing parameters of the original image, the method further includes: detecting whether the camera application supports the simulation mode; if the simulation mode is supported, generating the first instruction when a touch operation acting on the shutter control is detected. The camera application can determine whether to generate the first instruction based on the simulation mode, which can effectively prevent the first instruction from affecting the existing control logic in the camera application.
[0022] In a second aspect, an embodiment of the present application further provides an electronic device, comprising: one or more processors and one or more memories; the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method of the first aspect.
[0023] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, including computer instructions, which, when executed on an electronic device, enables the electronic device to execute the method of the first aspect.
[0024] In a fourth aspect, an embodiment of the present application further provides a chip or chip system, including a processing circuit and an interface circuit, wherein the interface circuit is used to receive code instructions and transmit them to the processing circuit, and the processing circuit is used to run the code instructions to execute the method described in the first aspect.
[0025] In a fifth aspect, an embodiment of the present application further provides a computer program product, which, when executed on an electronic device, enables the electronic device to execute the method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments of the present application will be described below.
[0027] Figure 1 It is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0028] Figure 2 It is a schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;
[0029] Figure 3 It is a flowchart of an image simulation method provided in an embodiment of the present application;
[0030] Figure 4 is a schematic diagram of a shooting interface provided in an embodiment of the present application;
[0031] Figure 5A and Figure 5B is a structural schematic diagram of an image processing pathway provided in an embodiment of the present application;
[0032] Figure 6 is a flow chart of another image simulation method provided in an embodiment of the present application;
[0033] Figure 7 It is a schematic diagram of the process of two consecutive image simulations provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] The application (Application, App) involved in the embodiments of the present application, which can also be called an application program, is a software program that can realize one or more specific functions. Usually, multiple applications can be installed in an electronic device, for example, instant messaging applications, audio applications, image capture applications, and the like. Among them, instant messaging applications, for example, may include text messaging applications, WeChat, DingTalk, and the like. Audio applications, for example, may include Kugou Music, Xiami Music, and the like. Image capture applications, for example, may include camera applications (factory setting system camera or third-party camera application). The applications mentioned in the following embodiments may be applications that are installed on the electronic device when it leaves the factory, or they may be applications that the user downloads from the Internet or obtains from other electronic devices during the use of the electronic device.
[0035] It should be understood that, in this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this application is only a way to describe the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. "At least one" means one or more, and "more than one" means two or more.
[0036] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0037] With the development of science and technology, the shooting effects of electronic devices (such as mobile phones and tablets with cameras) are getting better and better, and using electronic devices to shoot has become a common choice for people. However, due to factors such as limited hardware capabilities of electronic devices or lack of shooting experience of users, the original (raw) images collected by electronic devices are prone to blurring, color cast and other problems. In order to improve the imaging effect of the image, it is necessary to simulate and debug the original image to obtain a simulated image. During the development process, in order to obtain the image with the best imaging effect, it is necessary to simulate and debug the original image, that is, to continuously modify the processing parameters for the original image for simulation debugging. However, due to factors such as weather, season, and human factors, it is difficult to reproduce the shooting environment of the original image, or the steps of building a simulation environment to simulate the shooting environment are complicated, and the efficiency of the existing simulation debugging method is low.
[0038] Based on this, an embodiment of the present application provides an image simulation method, in which the electronic device inputs the original image and processing parameters in the storage area into the image processing path, and directly simulates and debugs the original image through the image processing path. The image processing path is built into the camera, and no additional simulation environment needs to be built, which can effectively improve the efficiency of simulation debugging. At the same time, the processing parameters are related to the environmental information of the stored original image, and the environmental information describes at least one of the photographed object in the original image, the shooting environment in which the photographed object is located, or the shooting parameters when the original image is taken. Only one photo needs to be taken to perform simulation debugging multiple times based on the environmental information, which can further improve the efficiency of simulation debugging.
[0039] It should be noted that the image simulation method described in the embodiment of the present application can be applied to the simulation debugging process in the development stage of the electronic device camera.
[0040] The concepts involved in the embodiments of the present application are explained below.
[0041] (1) Original image
[0042] Among them, the original image (or "raw image") refers to an unprocessed image, or it can also be called the original image captured by the camera. The original image is obtained by converting the light signal through the lens of the camera onto the image sensor. Optionally, the original image may refer to an image in Bayer format, and the image in Bayer format refers to an image including red, blue and green (i.e., three primary colors), that is, the original image only includes red pixel values, blue pixel values and green pixel values. It should be noted that in other embodiments, the original image may also refer to images in other formats without limitation. Optionally, the original image may refer to an image of any resolution, for example, the original image may be an image with a resolution of 1920x1080, or an image with a resolution of 3840x2160, and so on.
[0043] (2) Environmental information
[0044] The environment information is used to describe at least one of the photographed object in the original image, the shooting environment where the photographed object is located, or the shooting parameters when the original image is shot.
[0045] Optionally, the photographed object may include at least one of a person, an animal, or a scene. It should be noted that the photographed object in the original image may be determined by a detection algorithm. For example, when the original image is detected to contain facial information by a face recognition algorithm, it is determined that the photographed object includes a person. In other embodiments, the photographed object may also be determined by other means. For example, if the original image is captured in a scene where the camera application is in portrait mode, it is determined that the photographed object includes a person.
[0046] Optionally, the shooting environment of the photographed object includes at least one of the shooting location, shooting time, or ambient brightness of the photographed object. It should be noted that the shooting location may include multiple types, for example, the shooting location may be indoors or outdoors; for another example, the shooting location may be a longitude and latitude location; for another example, the shooting location may be a grassland, a city, a desert, etc. The shooting time may also include multiple types, for example, the shooting time may be daytime or nighttime; for another example, the shooting time may be a Gregorian calendar time, etc.
[0047] Optionally, the shooting parameters when the original image is shot may include at least one of exposure time, shooting mode (such as portrait mode, night scene mode, etc.), or focal length.
[0048] (3) Image processing pathway
[0049] The image processing path includes a plurality of image processing models. The image processing model is used to perform image processing, and the image processing model includes but is not limited to at least one of the following: an automatic white balance model, an automatic lens shading correction model, an automatic exposure model, a color noise removal model, a brightness noise removal model, a multi-frame denoising model, a high dynamic range model, a full dynamic range model, a dynamic range enhancement model, a global brightness mapping model, a face detection model, an image filtering algorithm model, or an image enhancement algorithm model.
[0050] (4) Processing parameters
[0051] The processing parameter is an input parameter of the image processing model. For example, when the image processing path includes an automatic white balance model, the processing parameter may include a cold adjustment parameter value or a warm adjustment parameter value of the automatic white balance model.
[0052] It should be noted that when the image processing path includes multiple image processing models, the processing parameters of the original image include processing parameters corresponding to the multiple image processing models respectively.
[0053] (5) Simulation image
[0054] The simulated image is an image obtained by processing the original image through an image processing channel. The simulated image can be in JPG or JPEG format without limitation.
[0055] In some optional implementations, the image simulation method mentioned in the embodiments of the present application can be applied to electronic devices, including but not limited to mobile phones, tablet computers, vehicle-mounted devices, personal digital assistants (PDAs), augmented reality (AR) and virtual reality (VR) devices, wearable devices (such as laptops, smart watches), etc.
[0056] like Figure 1 The figure shows a schematic diagram of the hardware structure of an electronic device. The electronic device may include: a processor, an external memory interface, an internal memory, a Universal Serial Bus (USB) interface, a charging management model, a power management model, a battery, an antenna 1, an antenna 2, a mobile communication model, a wireless communication model, a sensor model, a button, a motor, an indicator, a camera, a display screen, and a SIM card slot. The audio model may include a speaker, a receiver, a microphone, an earphone interface, and the like. The sensor model may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.
[0057] It is to be understood that the structures illustrated in the embodiments of the present application do not constitute specific limitations on the electronic device. In other embodiments, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0058] Among them, the processor may include one or more processing units, for example: the processor may include an application processor (AP), a modem processor (Modem), a central processing unit (CPU), a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a neural-network processing unit (NPU), etc. Different processing units can be independent devices or integrated into one or more processors. Optionally, the above-mentioned image processing model may include a chip platform algorithm model and a non-chip platform algorithm model. The chip platform algorithm model can be deployed in at least one of the ISP, CPU, or GPU, and the non-chip platform algorithm model can be deployed in at least one of the CPU or GPU. For example, chip platform algorithm models such as the automatic white balance model, automatic lens shading correction model, automatic exposure model, color noise removal model, brightness noise removal model, multi-frame denoising model, high dynamic range model, full dynamic range model, dynamic range enhancement model, or global brightness mapping model are deployed in the ISP, CPU, or GPU, and non-chip platform algorithm models such as the face detection model, image filtering algorithm model, or image enhancement algorithm model are deployed in the CPU or GPU.
[0059] A memory may also be provided in the processor for storing instructions and data. In some embodiments, the memory in the processor is a cache memory. The memory may store instructions or data that the processor has just used or is cyclically used. If the processor needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor, and thus improves the efficiency of the system.
[0060] The internal memory may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
[0061] Random access memory may include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, for example, the fifth generation DDR SDRAM is generally referred to as DDR5 SDRAM), etc.;
[0062] Non-volatile memory may include disk storage devices and flash memory.
[0063] Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage unit potential level; universal flash storage (UFS), embedded multi media Card (eMMC), etc. according to the storage specification.
[0064] Random access memory can be read and written directly by the processor. It can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data.
[0065] Non-volatile memory can also store executable programs and user and application data, etc., which can be loaded into random access memory in advance for direct reading and writing by the processor.
[0066] In the embodiment of the present application, the internal memory can support the storage of original images and processing parameters of the original images.
[0067] The external memory interface can be used to connect an external non-volatile memory to expand the storage capacity of the electronic device. The external non-volatile memory communicates with the processor through the external memory interface to realize the data storage function. For example, the original image and the processing parameters of the original image are saved in the external non-volatile memory.
[0068] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication model, wireless communication model, and Modem, etc. In some embodiments, antenna 1 of the electronic device is coupled with the mobile communication model, and antenna 2 is coupled with the wireless communication model, so that the electronic device can communicate with the network side device and other electronic devices through wireless communication technology.
[0069] Among them, the touch sensor is also called a "touch device". The touch sensor can be set on the display screen, and the touch screen composed of the touch sensor and the display screen is also called a "touch screen". The touch sensor is used to detect touch operations acting on or near it. The touch sensor can transmit the detected touch operation to the AP to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen. In other embodiments, the touch sensor can also be set on the surface of the electronic device, which is different from the position of the display screen. In an embodiment of the present application, the electronic device can detect whether there is a user operation acting on the display screen of the electronic device through the touch sensor. For example, after the touch sensor detects the touch operation, the electronic device can turn on the positioning function.
[0070] In addition, operating systems are running on the above components, such as the iOS operating system developed by Apple, the Android open source operating system developed by Google, and the Windows operating system developed by Microsoft.
[0071] The operating system of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to illustrate the software structure of the electronic device. It should be noted that although the embodiment of the present application is illustrated by taking the Android system as an example, its basic principle is also applicable to electronic devices based on operating systems such as iOS or Windows.
[0072] See also Figure 2, which is a software structure block diagram of an electronic device provided in an embodiment of the present application. The software structure adopts a layered architecture, which divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. Taking the Android system as an example, in some embodiments, the Android system is divided from top to bottom into an application layer, an application framework layer (Framework), a hardware abstraction layer (HAL), a kernel layer (Kernel), and a hardware layer.
[0073] The application layer may include a series of application packages, including camera, gallery, calendar, call, map, WLAN, Bluetooth, music, video, short message and other applications.
[0074] Among them, the application framework layer provides an application programming interface (Application Programming Interface, API) and a programming framework for the application of the application layer. The application framework layer includes some predefined functions. For example, the application framework layer can provide a camera API (Camera API), a camera service (Camera Service), a camera extension service (Camera Service Extra) and a hardware development kit (HW SDK), etc. Among them, the Camera API serves as an interface for the bottom layer (such as the hardware abstraction layer) to interact with the application layer. Specifically, the Camera API can also receive camera control instructions from the upper layer (such as the application layer), such as control instructions such as turning on the camera, starting image acquisition, and turning off the camera. Then, the uploaded camera control instructions are passed to the camera of the hardware layer through the application framework layer, the HAL layer, and the kernel layer. Optionally, in an embodiment of the present application, when the application layer interacts with the user and triggers the scene of image acquisition, the application layer can call the Camera API and pass the shooting instruction to the camera through the application framework layer, the HAL layer, and the kernel layer. The camera can respond to the shooting instruction, perform image acquisition, and obtain the original image. After the original image is obtained, it can also be passed to the application layer through the kernel layer, the HAL layer, and the application framework layer. Optionally, the image data passed to the application layer can be a simulated image obtained through image processing.
[0075] Among them, the hardware abstraction layer is an interface layer located between the kernel layer and the hardware, which can be used to abstract the hardware. In some embodiments, the hardware abstraction layer includes a hardware abstraction layer interface definition language (HIDL) interface. The HAL layer can perform data transparent transmission between the application framework layer and the kernel layer based on the HIDL interface. Alternatively, the HAL layer can also process the data from the kernel layer based on the HIDL interface and then transmit it to the application framework layer. For example, the HAL layer can convert the parameters of the hardware device in the kernel layer into a software program language recognizable by the application framework layer and the application layer. Optionally, the HAL layer may include a camera HAL. The Camera HAL can schedule the kernel layer to control the working state of the camera. In some embodiments, the hardware abstraction layer may include multiple non-chip platform algorithm models, for example, the hardware abstraction layer may include at least one of a face detection model, an image filtering algorithm model, or an image enhancement algorithm model.
[0076] The kernel layer is the foundation of the Android operating system, responsible for hardware drivers, network, power, system security, memory management and other functions. The kernel layer is an intermediate layer between hardware and software, and its function is to pass application requests to the hardware. The kernel layer contains at least camera drivers, sensor drivers, display drivers and audio drivers.
[0077] The hardware layer may include various hardware devices, such as processors, cameras (which may include lenses and image sensors), etc. In some embodiments, the processor may include at least one of an ISP, a GPU, or a CPU, and at least one chip platform algorithm model is deployed in the processor, which will not be described in detail.
[0078] The image simulation method provided in the embodiment of the present application is described in detail below. Figure 3 , Figure 3 A schematic diagram of a process flow of an image simulation method provided by an embodiment of the present application is shown, such as Figure 3 As shown, the image simulation method includes but is not limited to:
[0079] S101 . In response to a first instruction, obtain an original image from a storage area, and obtain processing parameters of the original image.
[0080] The first instruction is used to trigger the image simulation process. The first instruction may include the following three forms:
[0081] (1) The first instruction may be received from the outside, for example, the first instruction may be an adb shell command. In this embodiment, since the first instruction is introduced from the outside, the first instruction is independent of other control instructions in the electronic device, which can effectively prevent the first instruction from affecting the existing control logic in the electronic device.
[0082] (2) The first instruction may also be generated based on a touch operation in the shooting interface. Specifically, the electronic device may display the following: Figure 4 The shooting interface 41 of the camera application shown in the figure may include a simulation control 401. The electronic device may detect a touch operation (such as a click operation) acting on the simulation control 401, and generate a first instruction in response to the touch operation. The shooting interface 41 may also be replaced by a shooting interface of an instant messaging application or other application, without limitation. In this embodiment, since the first instruction is generated based on the newly added simulation control 401 in the shooting interface, the first instruction is independent of other control instructions of the camera application, which can effectively prevent the first instruction from affecting the existing control logic in the camera application.
[0083] (3) The first instruction may also be generated based on the existing controls in the shooting interface. For example, taking the shutter control 402 of the shooting interface 41 as an example, the electronic device may detect whether the camera application supports the simulation mode. If the camera application supports the simulation mode, when a touch operation (such as a click operation) acting on the shutter control 402 is detected, the first instruction is generated; if the camera application does not support the simulation mode, when a touch operation (such as a click operation) acting on the shutter control 402 is detected, a shooting instruction is generated, and the shooting instruction is used to trigger the image acquisition process. It should be noted that in other embodiments, the shutter control 402 may also be replaced by other existing controls in the shooting interface, without limitation. In this embodiment, since the first instruction is generated based on the existing controls in the shooting interface, there is no need to introduce new controls in the shooting interface, and the shooting interface is more concise. At the same time, the camera application may determine whether to generate the first instruction based on the simulation mode, which can effectively prevent the first instruction from affecting the existing control logic in the camera application. It should be noted that the simulation mode may be enabled based on the second instruction, and the second instruction may be received from the outside, for example, the second instruction may be an adb shell command.
[0084] Among them, at least one original image is stored in the storage area, and processing parameters corresponding to each original image are stored respectively. That is to say, after the original image is determined, the corresponding processing parameters can be determined. Optionally, the correspondence between the original image and the processing parameter can be established based on the identifier of the original image (such as the file name or file address of the original image) and the identifier of the processing parameter (such as the file name or file address of the processing parameter). For example, if the storage area stores an original image identified as "picture name_1.raw", an original image identified as "picture name_2.raw", a processing parameter identified as "picture name_1.meta", and a processing parameter identified as "picture name_2.meta", then the original image identified as "picture name_1.raw" corresponds to the processing parameter identified as "picture name_1.meta", and the original image identified as "picture name_2.raw" corresponds to the processing parameter identified as "picture name_2.meta". It should be noted that the correspondence between the original image and the processing parameter can also be established based on other methods, for example, based on key-value pairs, without limitation.
[0085] Optionally, the storage area involved in the embodiments of the present application may be a storage area inside an electronic device (such as a hard disk or memory of an electronic device), or an external storage area (such as a plug-in hard disk equipped on the electronic device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card)). In other implementations, the storage area may also be a storage area of other electronic devices, etc.
[0086] S102, inputting the original image and the processing parameters into the image processing path, and processing the original image based on the processing parameters through the image processing path to obtain a simulated image.
[0087] The processing parameters are related to the environmental information of the stored original image. The environmental information is used to describe at least one of the photographed object in the original image, the shooting environment where the photographed object is located, or the shooting parameters when the original image is shot. No further description is given here.
[0088] The image processing pipeline includes multiple image processing models. Figure 5A , Figure 5A FIG. 1 shows a schematic diagram of the structure of an image processing pipeline. Figure 5A As shown, the image processing pathway may include image processing model 1, image processing model 2 and image processing model 3, and image processing model 1 is connected to image processing model 2, image processing model 2 is connected to image processing model 1 and image processing model 3, and image processing model 3 is connected to image processing model 2. Figure 5AIn the image processing pathway shown, the simulated image is obtained by processing image processing model 1, image processing model 2 and image processing model 3 respectively. That is to say, step S102 may specifically include: s11, inputting the original image and the processing parameters of image processing model 1 into image processing model 1, processing the original image based on the processing parameters of image processing model 1 to obtain a first intermediate image; s12, inputting the first intermediate image and the processing parameters of image processing model 2 into image processing model 2, processing the first intermediate image based on the processing parameters of image processing model 2 to obtain a second intermediate image; s13, inputting the second intermediate image and the processing parameters of image processing model 3 into image processing model 3, processing the second intermediate image based on the processing parameters of image processing model 3 to obtain a simulated image. It should be noted that the image processing pathway is only an exemplary description. In other embodiments, the image processing pathway may also include a larger number of image processing models. For example, the image processing pathway may include image processing model 1, image processing model 2, image processing model 3 and image processing model 4; in other embodiments, the image processing pathway may also include multiple branches, for example, Figure 5B As shown, image processing model 1 is connected to image processing model 2 and image processing model 3, image processing model 2 is connected to image processing model 1 and image processing model 3, and image processing model 3 is connected to image processing model 1 and image processing model 2, without limitation.
[0089] Optionally, multiple image processing models may include chip platform algorithm models in ISP, CPU or GPU. In this case, the image processing pathway of the camera itself can be directly used for image simulation, without the need to configure a simulation platform for the chip platform, which can effectively avoid errors in simulation results due to configuration errors. Optionally, multiple image processing models may also include non-chip platform algorithm models in CPU or GPU. In this case, the image processing pathway of the camera itself can be directly used for image simulation, without the need to build an additional simulation environment for non-chip platform algorithm models, which is simpler and more convenient, and improves the efficiency of simulation debugging. Optionally, multiple image processing models may also include chip platform algorithm models in ISP, CPU or GPU, and non-chip platform algorithm models in CPU or GPU. In this case, the image processing pathway of the camera itself can be directly used for image simulation, without the need to configure a simulation platform for the chip platform, and without the need to build an additional simulation environment for non-chip platform algorithm models, which can improve the accuracy of simulation results while improving the efficiency of simulation debugging. At the same time, the present application solution can simulate the chip platform algorithm model and the non-chip platform algorithm model at the same time, and the final image can be obtained through a single simulation. There is no need to configure a simulation platform for the chip platform separately or to build a simulation environment for the non-chip platform algorithm model. This can effectively improve convenience and thus improve the efficiency of simulation debugging.
[0090] In some optional implementations, a dump node may be added to the image processing path to help quickly locate the abnormal cause of an abnormal simulation image (such as a flowery image due to image blur, a black image or a green image due to image color cast). Figure 5A Taking the image processing pathway shown as an example, a dump node 1 can be added between image processing model 1 and image processing model 2, and a dump node 2 can be added between image processing model 2 and image processing model 3. If the simulated image output by image processing model 3 is abnormal, the first intermediate image can be obtained from dump node 1 and the second intermediate image can be obtained from dump node 2. If the first intermediate image is abnormal, then the image processing model 1 is abnormal; if the second intermediate image is abnormal, then the image processing model 2 is abnormal; if both the first intermediate image and the second intermediate image are normal, then the image processing model 3 is abnormal.
[0091] In the embodiment of the present application, the electronic device inputs the original image and processing parameters in the storage area into the image processing path, and directly simulates and debugs the original image through the image processing path. The image processing path is built-in to the camera, and no additional simulation environment needs to be built, which can effectively improve the efficiency of simulation debugging. At the same time, the processing parameters are related to the environmental information of the stored original image, and the environmental information describes at least one of the photographed object in the original image, the shooting environment in which the photographed object is located, or the shooting parameters when the original image is taken. Only one photo needs to be taken to perform simulation debugging multiple times based on the environmental information, which can further improve the efficiency of simulation debugging.
[0092] In addition, the original image and processing parameters are at the forefront of the input image processing pipeline, and the image simulation process is not easily affected by the external environment, effectively avoiding result errors caused by the external environment.
[0093] Before obtaining the original image and the processing parameters of the original image from the storage area, the original image and the processing parameters of the original image need to be stored in the storage area. Based on this, the embodiment of the present application also provides another image simulation method, such as Figure 6 As shown, the image simulation method includes but is not limited to the following steps:
[0094] S201, collecting original images through a camera.
[0095] In order to better explain step S201, Figure 2 The software structure diagram details the interaction between various models involved in the electronic device collecting original images.
[0096] s21. The camera application at the application layer generates a shooting instruction.
[0097] For details, please refer to Figure 4 The related embodiments are not described in detail.
[0098] s22. The camera application at the application layer sends a shooting instruction to the camera service at the application framework layer.
[0099] That is to say, after the camera application generates a shooting instruction, it can send the shooting instruction to the camera service.
[0100] s23. The camera service of the application framework layer sends a shooting instruction to the camera HAL of the hardware abstraction layer.
[0101] That is to say, after receiving the shooting instruction, the camera service can send the shooting instruction to the camera HAL.
[0102] s24. The camera HAL of the hardware abstraction layer sends a shooting instruction to the camera driver of the kernel layer.
[0103] That is to say, after the camera HAL receives the shooting command, it can send the shooting command to the camera driver.
[0104] s25. The camera driver of the kernel layer sends a shooting instruction to the camera of the hardware layer.
[0105] That is to say, after receiving the shooting instruction, the camera driver can send the shooting instruction to the camera.
[0106] s26. In response to the shooting instruction, the original image is collected through the camera.
[0107] It is understandable that the specific process (such as step s21 to step s26) can also refer to relevant technical documents and will not be further explained here.
[0108] S202: Store the original image in a storage area.
[0109] Optionally, if the storage area is a storage area of an electronic device (including an internal storage area or an external storage area), the original image may be directly stored in the storage area.
[0110] Optionally, if the storage area is a storage area of another electronic device, step S202 specifically includes: sending the original image to the other electronic device, and when the other electronic device receives the original image, storing the original image in the storage area.
[0111] S203: Determine initial processing parameters based on the environmental information of the original image.
[0112] In an optional implementation, step S203 includes: based on the environmental information of the original image, selecting multiple image processing models from the image processing model set, and using the initial parameters (i.e., initial input parameters) corresponding to the selected multiple image processing models as initial processing parameters. The selected multiple image processing models are used to construct an image processing pathway. That is, when the image processing pathway includes multiple image processing models, the initial processing parameters include the initial parameters corresponding to the multiple image processing models.
[0113] For example, assume that the image processing model set includes an automatic white balance model, an automatic lens shading correction model, an automatic exposure model, a color noise removal model, a brightness noise removal model, a multi-frame denoising model, a high dynamic range model, a full dynamic range model, a dynamic range enhancement model, a global brightness mapping model, a face detection model, an image filtering algorithm model, or an image enhancement algorithm model; if the automatic white balance model, the automatic exposure model, the multi-frame denoising model, the face detection model, the image filtering algorithm model, and the image enhancement algorithm model of the image processing model set are selected as multiple image processing models, then the initial processing parameters include the initial parameters corresponding to the automatic white balance model, the initial parameters corresponding to the automatic exposure model, the initial parameters corresponding to the multi-frame denoising model, the initial parameters corresponding to the face detection model, the initial parameters corresponding to the image filtering algorithm model, and the initial parameters corresponding to the image enhancement algorithm model.
[0114] Optionally, the electronic device may select multiple image processing models from the image processing model set based on the correspondence between the environmental information of the original image and the image processing model, or may select multiple image processing models from the image processing model set based on a pre-trained algorithm model for determining the image processing model. It should be noted that in other implementations, the selected multiple image processing models may also be determined based on other methods, for example, obtained by default settings, or obtained based on user selection operations, without limitation.
[0115] In another optional implementation, step S203 may further include: determining an image processing path from a plurality of image processing paths based on the environment information of the original image, and using the initial parameters corresponding to each image processing model in the selected image processing path as the initial processing parameters. Figure 5A When the image processing pathway shown in the figure is selected, the initial parameters corresponding to the image processing model 1, the initial parameters corresponding to the image processing model 2, and the initial parameters corresponding to the image processing model 3 can be used as the initial processing parameters. Optionally, the electronic device can select the image processing pathway from the image processing pathway set according to the correspondence between the environmental information of the original image and the image processing pathway, or can select the image processing pathway from the image processing pathway set according to a pre-trained algorithm model for determining the image processing pathway. It should be noted that in other implementations, the selected multiple image processing pathways can also be determined based on other methods, for example, obtained by default settings, or obtained based on user selection operations, without limitation.
[0116] It should be noted that the initial parameters corresponding to the multiple image processing models can be default settings or can be set based on historical experience without limitation.
[0117] S204a, using the initial processing parameters as processing parameters of the original image.
[0118] S204b, based on the image processing degree required for image optimization, the initial processing parameters are updated to obtain updated processing parameters, and the updated processing parameters are used as processing parameters of the original image.
[0119] In an optional implementation, step S204b may include: based on the image processing degree required for image optimization, updating the initial parameters corresponding to the multiple image processing models respectively, obtaining updated input parameters corresponding to the multiple image processing models respectively, and using the updated input parameters as updated processing parameters. The updated input parameters have a different image processing degree from the initial parameters. For example, taking the automatic white balance model as an example, the initial parameters may be cold-tone parameter values, and the updated input parameters may be warm-tone parameter values. It should be noted that when the processing parameters of the original image include input parameters of multiple image processing models, each update may update the input parameters of some or all of the image processing models.
[0120] Optionally, the degree of image processing required for image optimization may be manually determined, that is, the updated processing parameters may be obtained based on user input operations. In this implementation, the user may actively adjust the processing parameters of the original image based on experience, and may obtain a more optimal simulation result more quickly.
[0121] Optionally, the degree of image processing required for image optimization can be determined based on the simulation image output by the last simulation process. That is, the updated processing parameters (i.e., the processing parameters of the second simulation) are determined based on the initial processing parameters (i.e., the processing parameters of the first simulation) and the simulation image output by the first simulation. Similarly, the processing parameters of the i+1th simulation process can be determined based on the simulation image output by the i-th simulation and the processing parameters of the i-th simulation, where i is a positive integer. See Figure 7 As shown, Figure 7 FIG. 2 shows a schematic diagram of the process of two consecutive image simulations. Figure 7As shown, in the ith simulation process, the original image and the processing parameters of the ith simulation can be input into the image processing path, and the original image is processed based on the processing parameters of the ith simulation through the image processing path to obtain the ith output simulation image. The image processing degree required for image optimization is determined based on the simulated image output for the ith time, and the processing parameters of the ith simulation are updated based on the image processing degree required for image optimization to obtain the processing parameters of the i+1 simulation processing. In the i+1 simulation process, the original image and the processing parameters of the i+1 simulation can be input into the image processing path, and the original image is processed based on the processing parameters of the i+1 simulation through the image processing path to obtain the i+1 output simulation image. In this implementation, the image processing degree required for image optimization can be determined based on the simulated image output by the previous simulation process, which is more convenient and intelligent. It should be noted that in other implementations, the first simulation process can also be regarded as a conventional photo processing process. It should be noted that since the simulated image processing path has not changed, if the processing parameters of the two simulations are the same, the simulated images output by the two simulations are also consistent.
[0122] S205: Store the processing parameters of the original image in a storage area.
[0123] Optionally, if the storage area is a storage area of an electronic device (including an internal storage area or an external storage area), the processing parameters of the original image may be directly stored in the storage area.
[0124] Optionally, if the storage area is a storage area of another electronic device, step S205 specifically includes: sending the processing parameters of the original image to the other electronic device, and when the other electronic device receives the processing parameters of the original image, the other electronic device stores the processing parameters of the original image in the storage area.
[0125] In some optional implementations, the electronic device may also store the environmental information of the original image in a storage area. Optionally, the correspondence between the original image and the environmental information may be established based on the identifier of the original image (such as the file name or file address of the original image) and the identifier of the environmental information (such as the file name or file address of the environmental information). For example, if the storage area stores an original image identified as "Picture Name_1.raw", an original image identified as "Picture Name_2.raw", environmental information identified as "Picture Name_1.info", and environmental information identified as "Picture Name_2.info", then the original image identified as "Picture Name_1.raw" corresponds to the environmental information identified as "Picture Name_1.info", and the original image identified as "Picture Name_2.raw" corresponds to the environmental information identified as "Picture Name_2.info". It should be noted that the correspondence between the original image and the environmental information may also be established based on other methods, for example, based on a key-value pair, without limitation. It should be noted that for the relevant description of the environmental information of the original image, please refer to the previous text, which will not be repeated here. In this implementation, the environment information of the original image is stored in the storage area. When multiple simulations are performed on the original image, the same image processing path can be determined based on the same environment information. The image processing path remains unchanged during multiple simulations, so that only one photo is needed to perform multiple simulation debugging based on the environment information, which can improve the efficiency of simulation debugging. At the same time, since the environment information of the original image is stored, the dependence of the test verification process of the subjective environment on the subjective environment can be effectively reduced, and the efficiency of simulation debugging can be effectively improved.
[0126] S206 . In response to the first instruction, obtain the original image from the storage area, and obtain processing parameters of the original image.
[0127] S207, inputting the original image and the processing parameters into the image processing path, and processing the original image based on the processing parameters through the image processing path to obtain a simulated image.
[0128] It should be noted that for detailed description of step S206 and step S207, please refer to Figure 3 Step S101 and step S102 are not described in detail.
[0129] In an embodiment of the present application, before image simulation, the original image can be captured by a camera, and the processing parameters of the original image can be determined based on the environmental information of the original image, and the original image and the processing parameters can be stored in a storage area, which is conducive to the image simulation process to directly obtain the original image and processing parameters from the storage area.
[0130] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0131] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
Claims
1. An image simulation method, characterized in that: The method comprises: In response to the first instruction, acquiring the original image from the storage area; Based on the environmental information of the original image, multiple image processing models are selected from the image processing model set, and initial parameters corresponding to the selected multiple image processing models are used as initial processing parameters; the environmental information is used to describe at least one of the photographed object in the original image, the shooting environment where the photographed object is located, or the shooting parameters when the original image is shot; the shooting environment includes the shooting location and / or the shooting time, and the shooting parameters include the shooting mode and / or the focal length; Based on the image processing degree required for image optimization, the initial processing parameters are updated to obtain the processing parameters of the original image; the image processing degree required for image optimization is determined based on the simulation image output most recently from the current moment within a historical time period; The original image and the processing parameters are input into an image processing path, and the original image is processed based on the processing parameters through the image processing path to obtain a simulated image; the image processing path is provided by a camera of an electronic device.
2. The method according to claim 1, characterized in that The image processing path includes a plurality of image processing models; the plurality of image processing models are respectively deployed in an image signal processor, a central processing unit, or a graphics processor.
3. The method according to claim 1, characterized in that Before acquiring the original image from the storage area, the method further includes: Collecting the original image through a camera; The original image is stored in the storage area.
4. The method according to any one of claims 1 to 3, characterized in that Before acquiring the original image from the storage area in response to the first instruction, the method further includes: Check if the camera app supports emulation mode; If the simulation mode is supported, the first instruction is generated when a touch operation acting on the shutter control is detected.
5. An electronic device, characterized in that: include: One or more processors, one or more memories; the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, when the one or more processors execute the computer instructions, the electronic device executes the method as described in any one of claims 1-4.
6. A computer-readable storage medium, characterized in that: The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 1 to 4.
7. A chip system, characterized in that: The method comprises a processing circuit and an interface circuit, wherein the interface circuit is used to receive code instructions and transmit the code instructions to the processing circuit, and the processing circuit is used to run the code instructions to execute the method according to any one of claims 1 to 4.
