Image processing method, electronic equipment, chip system and readable storage medium

By detecting interruptions in the camera application's background operation interface, the issue of electronic device lag was resolved, ensuring smoothness and user experience, and achieving efficient image processing.

CN121888085APending Publication Date: 2026-04-17HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-10
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Electronic devices may experience lag when the camera application processes the initial image in the background, affecting the user experience.

Method used

When the camera application is processing the initial image in the background, the processing is interrupted when an interface operation is detected to avoid competing for resources with the foreground camera application. Multiple frames are processed by fusion and processing is performed when resources are sufficient.

Benefits of technology

Ensure smooth operation of the foreground camera application, prevent lag, improve user experience, reduce waiting time, and handle glitches.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121888085A_ABST
    Figure CN121888085A_ABST
Patent Text Reader

Abstract

The invention provides an image processing method, electronic equipment, a chip system and a readable storage medium, the method is applied to the electronic equipment, and the method comprises the steps that a first interface is displayed, the first interface is an interface of a camera application program, and the first interface comprises a shooting control; in response to a first operation on the shooting control, obtaining an initial image, the first operation being used for instructing the camera application to shoot an image through the camera; and performing first processing on the initial image at the background through a first module, and during the process of performing the first processing on the initial image, if it is detected that the camera application also displays an interface of the camera application and any operation on the interface of the camera application is detected, interrupting the first processing on the initial image. Therefore, by interrupting the first processing, the electronic equipment can be prevented from being stuck as much as possible, and the user experience is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, specifically to an image processing method, electronic device, chip system, and readable storage medium. Background Technology

[0002] As mobile phones and other electronic devices become more feature-rich, camera applications have become an indispensable tool for these devices.

[0003] Currently, after a camera application in an electronic device acquires an initial image through the camera, it enters a background processing flow to further process the initial image.

[0004] However, even if the camera app exits the foreground after acquiring the initial image, the image processing will continue until the photo-taking event is completed. During the background processing of the initial image, the electronic device may experience lag or other issues, affecting the user experience. Summary of the Invention

[0005] This application provides an image processing method, an electronic device, a chip system, and a readable storage medium, which can minimize lag in electronic devices and ensure a better user experience.

[0006] In a first aspect, this application provides an image processing method applied to an electronic device, the electronic device including a camera application, the method comprising:

[0007] Display a first interface, which is the interface of a camera application, and the first interface includes a shooting control; in response to a first operation on the shooting control, acquire an initial image, the first operation being used to instruct the camera application to capture an image through the camera; perform a first processing on the initial image in the background through a first module, wherein, during the first processing of the initial image, if it is detected that the camera application is still displaying the camera application interface, and any operation (usually the first operation) is detected on the camera application interface, the first processing of the initial image is interrupted.

[0008] In the above method, if the camera application is still displaying its interface and any user operation on the camera application is detected during the first processing of the initial image in the background by the first module, then the first processing of the entire initial image is interrupted. Thus, by interrupting the first processing of the initial image in advance, the first processing of the initial image by the first module in the background no longer competes with the camera application running in the foreground for memory resources, thereby ensuring the smoothness of the camera application running in the foreground.

[0009] In conjunction with the first aspect, in some implementations of the first aspect, the initial image includes a first image captured by the camera when the camera application receives the first operation, a Q-frame second image captured by the camera before the camera application receives the first operation, and / or a P-frame third image captured by the camera after the camera application receives the first operation, where Q and P are both positive integers greater than or equal to 1, and the first processing is a fusion processing that fuses the first image, the Q-frame second image, and the P-frame third image.

[0010] In the above method, the first image, the Q-frame second image, and the P-frame third image are fused through the first processing, which can ensure the quality of the initial image and avoid the first image becoming unclear due to jitter in the electronic device.

[0011] In conjunction with the first aspect, in some implementations of the first aspect, the first module performs a first process on the initial image in the background, including:

[0012] Determine whether the system resource information at the current moment meets the first condition. The system resource information includes the temperature of the electronic device, the first storage space occupancy of the electronic device's memory, the second storage space occupancy of the central processing unit's runtime memory, and / or the third storage space occupancy of the graphics processing unit's runtime memory. The first condition includes the temperature being less than or equal to a temperature threshold, the first storage space occupancy being less than or equal to a first storage space threshold, the second storage space occupancy being less than or equal to a second storage space threshold, and / or the third storage space occupancy being less than or equal to a third storage space threshold. When it is determined that the system resources meet the first condition, the initial image is processed in the background by the first module.

[0013] In the above method, when the system resource information meets the first condition, it indicates that the current operating state of the electronic device is stable, and the first module can perform the first processing on the initial image in the background. Thus, when the system resource information meets the first condition, the electronic device can perform the first processing on the initial image in the background through the first module, thereby ensuring that the first processing is executed as stably as possible.

[0014] In conjunction with the first aspect, in some implementations of the first aspect, the first module performs a first process on the initial image in the background, including:

[0015] In the processing queue, the image identifier of the initial image is recorded; in the background, the first module creates N first threads, and the N first threads perform the first processing on the N initial images associated with the N image identifiers in the processing queue.

[0016] In the above method, the camera application can continuously receive multiple first operations and acquire multiple initial images. The processing queue may include N image identifiers. Therefore, it is necessary to create N threads to perform first processing on all N initial images associated with the N image identifiers in the processing queue.

[0017] In conjunction with the first aspect, in certain implementations of the first aspect, interrupting the first processing of the initial image includes:

[0018] Send a first termination flag to the first algorithm. The first algorithm is the algorithm executed by the first processing node. The first processing node includes the processing node of each of the N first threads. The first termination flag is used to terminate the operation of the first algorithm. The first algorithm is the algorithm used by the first processing.

[0019] In the above method, a first termination flag can be used to terminate the first algorithm, thereby terminating the first processing of the initial image.

[0020] In conjunction with the first aspect, in certain implementations of the first aspect, interrupting the first processing of the initial image includes:

[0021] Send a second termination flag to the first processing node. The first processing node includes the processing node for each of the N first threads. The second termination flag is used to terminate the operation of the N first threads.

[0022] In the above method, a second termination flag can be used to terminate the running of N first threads, thereby terminating the first processing of the initial image.

[0023] In conjunction with the first aspect, in some implementations of the first aspect, the image identifier of the initial image is recorded, including:

[0024] The method records the image identifier and image type of the initial image, which are associated. The image type includes a first type and a second type. The first type indicates that the initial image was captured in portrait mode. If the initial image was captured in portrait mode, the first process includes a first sub-process and a second sub-process. The first sub-process is a fusion process, and the second sub-process is a process using a first model algorithm. When the first model algorithm is running, the fourth storage space occupancy of the memory is greater than or equal to the fourth storage space threshold. The second type indicates that the initial image was captured in non-portrait mode. If the initial image was captured in non-portrait mode, the first process includes the first sub-process. The method further includes: if it is detected that the camera application is still displaying the camera application interface, and no other information is detected on the camera... During any operation of the application's interface, the N image identifiers in the processing queue are traversed. If the first identifier is encountered, it is determined whether the first module is performing the first sub-processing on the fourth image in the background. The first identifier is any one of the N image identifiers in the processing queue that belongs to the first type of initial image, and the fourth image is the initial image associated with the first identifier. When it is determined that the first module is performing the first sub-processing on the fourth image in the background, it is determined whether there is a first application running in the foreground. The first application is a non-camera application, and the first application is an application running using the second model algorithm. When the second model algorithm is running, the fifth storage space of the memory occupancy is greater than or equal to the fourth storage space threshold. If there is a first application running in the foreground, the first processing of the fourth image is interrupted.

[0025] In the above method, if the first identifier is reached and the first module performs the first sub-processing on the fourth image in the background, there is a first application running in the foreground. The first application is a non-camera application and is an application running using the second model algorithm. The second model algorithm occupies a large amount of memory space. Therefore, the first processing of the fourth image can be interrupted in advance, so that the first processing of the initial image in the background by the first module no longer competes with the first application running in the foreground for storage space resources, thus ensuring the smoothness of other large model applications running in the foreground.

[0026] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes:

[0027] If the second identifier is encountered during traversal, it is determined whether the system resource information meets the first condition. The second identifier is any one of the N image identifiers in the processing queue that belongs to the second type of initial image. If it is determined that the system resources do not meet the first condition, the first processing of the fifth image is interrupted. The fifth image is the initial image associated with the second identifier.

[0028] In the above method, if the second identifier is encountered and it is determined that the system resource information does not meet the first condition, it indicates that the current operating state of the electronic device is unstable and not suitable for the first module to perform the first processing on the fifth image in the background. Therefore, the first processing on the fifth image can be interrupted. Thus, by interrupting the first processing on the fifth image in advance, the first processing on the fifth image in the background by the first module no longer competes with the camera application running in the foreground for storage space resources, ensuring the smoothness of the camera application running in the foreground.

[0029] In conjunction with the first aspect, in certain implementations of the first aspect, interrupting the first processing of the fourth image when a first application is running in the foreground includes:

[0030] When a first application is running in the foreground, the image identifier of the fourth image is recorded in the interrupt queue; when it is determined that the system resources do not meet the first condition, the first processing of the fifth image is interrupted, including: when it is determined that the system resources do not meet the first condition, the image identifier of the fifth image is recorded in the interrupt queue; the method further includes: when the N image identifiers in the processing queue are traversed, the first processing of the initial image associated with all image identifiers in the interrupt queue is interrupted.

[0031] In the above method, when there is a first application running in the foreground, the image identifier of the fourth image is recorded in the interrupt queue. When it is determined that the system resources do not meet the first condition, the image identifier of the fifth image is recorded in the interrupt queue. When the N image identifiers in the processing queue are traversed, the first processing of the initial image associated with all image identifiers in the interrupt queue is interrupted. This allows for simultaneous interruption of the fourth and fifth images, thereby improving the efficiency of interrupting the fourth and fifth images.

[0032] In conjunction with the first aspect, in some implementations of the first aspect, after acquiring the initial image in response to a first operation on the shooting control, the method further includes:

[0033] The method further includes: displaying a second interface, which is the display interface of the initial image in the gallery application; deleting the initial image in response to a second operation on the initial image; the method also includes: interrupting the first processing of the initial image if a second operation on the initial image is received during the first processing of the initial image.

[0034] In the above method, if the first processing of the initial image has not yet been completed and a deletion operation for the initial image is received, the first processing of the initial image can be interrupted. It is not necessary to wait for the first processing of the initial image to be completed before performing the deletion operation on the target image obtained by the first processing. In this way, the initial image can be deleted in advance, reducing the user's waiting time and ensuring the user's user experience.

[0035] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes:

[0036] If a second operation on the initial image is received before the initial image is processed, the initial image is deleted.

[0037] In the above method, if the initial image has not yet undergone the first processing and a deletion operation for the initial image is received, the initial image can be deleted in advance. It is not necessary to wait for the initial image to complete the first processing before performing the deletion operation on the target image obtained from the first processing. In this way, the initial image can be deleted in advance, reducing the user's waiting time and ensuring the user's user experience.

[0038] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes:

[0039] If the number of processing failures during the initial processing of the initial image is greater than or equal to the preset number, the initial image will be deleted.

[0040] In the above method, if the number of processing failures (i.e., database crashes) during the first processing of the initial image is greater than or equal to the preset number, the initial image can be deleted in advance based on the image identifier. This can solve the problem of abnormal situations occurring during the generation of the target image from the initial image, avoid the problem of frequent crashes and freezes of camera applications that may occur when users use electronic devices, and ensure user experience.

[0041] In conjunction with the first aspect, in certain implementations of the first aspect, in response to a first operation on the shooting control, acquiring an initial image includes:

[0042] In response to a first operation on the shooting control, the camera application sequentially sends multiple shooting requests to the camera. The first operation instructs the camera application to continuously capture images through the camera. Based on the multiple shooting requests, the camera sequentially acquires multiple initial images and sequentially sends the multiple initial images to the camera application. The camera application receives the multiple initial images. When the first operation ends, if it is determined that the number of multiple shooting requests is greater than the number of multiple initial images received, a sixth image is deleted. The sixth image is the initial image corresponding to the shooting request that the camera application has sent to the camera but has not received at the end of the first operation.

[0043] In the above method, if it is determined that the number of multiple shooting requests is greater than the number of multiple initial images received, the sixth image can be deleted, that is, the initial images corresponding to the redundant shooting requests can be deleted in advance, saving system resources.

[0044] In a second aspect, this application provides an electronic device comprising: one or more processors, and a memory; the memory is coupled to one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, and the one or more processors invoking the computer instructions to cause the electronic device to perform the methods of the first aspect and any possible implementation thereof.

[0045] Thirdly, this application provides a chip system applied to an electronic device. The chip system includes one or more processors, which are used to invoke computer instructions to cause the electronic device to perform the methods in the first aspect and any possible implementation thereof.

[0046] Fourthly, this application provides a computer-readable storage medium including instructions that, when executed on an electronic device, cause the electronic device to perform the methods of the first aspect and any possible implementation thereof.

[0047] Fifthly, this application provides a computer program product that, when run on a computer, causes the computer to perform the methods of the first aspect and any possible implementation thereof.

[0048] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

[0049] Figure 1 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application;

[0050] Figure 2A schematic diagram of the software architecture of an electronic device provided in an embodiment of this application;

[0051] Figure 3 A schematic flowchart of an image processing method provided in an embodiment of this application;

[0052] Figure 4 A human-computer interaction interface diagram provided in one embodiment of this application;

[0053] Figure 5 A schematic flowchart of an image processing method provided in an embodiment of this application;

[0054] Figure 6 A human-computer interaction interface diagram provided in one embodiment of this application;

[0055] Figure 7 This is a schematic flowchart of an image processing method provided in an embodiment of this application. Detailed Implementation

[0056] In this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the first transformation relationship of the related objects, indicating that three relationships can exist. For example, A and / or B can mean: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c alone can mean: a alone, b alone, c alone, a combination of a and b, a combination of a and c, a combination of b and c, or a, b, and c, where a, b, and c can be single or multiple. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0057] As mobile phones and other electronic devices become more feature-rich, camera applications have become an indispensable tool for these devices.

[0058] Currently, after a camera application in an electronic device acquires an initial image through the camera, it enters a background processing flow to further process the initial image and obtain the processed target image.

[0059] However, even if the camera app exits the foreground after acquiring the initial image, the image processing will continue until the photo-taking event is completed. During the background processing of the initial image, the electronic device may experience lag or other issues, affecting the user experience.

[0060] To address the aforementioned issues, this application provides an image processing method, electronic device, chip system, computer-readable storage medium, and computer program product. After a camera application acquires an initial image, if the camera application remains open and an operation on the camera application can be detected during further processing of the initial image in the background, the processing of the initial image can be interrupted. This ensures the smooth operation of the camera application in the foreground, prevents lag in electronic devices, and guarantees a superior user experience.

[0061] The initial image typically includes a first image captured by the camera when the camera application receives the shooting operation, a second Q-frame image captured by the camera before the camera application receives the shooting operation, and a third P-frame image captured by the camera after the camera application receives the shooting operation.

[0062] The processing of the initial image may include the fusion processing of the first image, the Q-frame second image, and the P-frame third image. The processing of the initial image may also include the processing of the fused image obtained by the fusion processing through the large model algorithm.

[0063] Large model algorithms are typically those whose memory storage space usage is greater than or equal to a preset threshold during runtime.

[0064] Among them, the aforementioned electronic devices can be electronic devices with display screen hardware and corresponding software support, and with camera application, camera hardware and corresponding software support.

[0065] Among them, the aforementioned electronic devices can be mobile phones, tablets, in-vehicle devices, laptops, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), smart cars, smart TVs, robots, and other devices.

[0066] It should be noted that in some possible implementations, the electronic device may also be referred to as a terminal device (station), user equipment (UE), etc., and the embodiments of this application do not limit this.

[0067] For ease of explanation, Figure 1 In the example below, we will use a mobile phone as an example of electronic device 100.

[0068] like Figure 1As shown, in some embodiments, the electronic device 100 may include a processor 101, a communication module 102, a display screen 103, a camera 104, a sensor 105, an internal memory 106, a USB interface 107, an external memory interface 108, a charging management module 109, a power management module 110, and a battery 111, etc.

[0069] The processor 101 may include one or more processing units, such as an application processor (AP), a modem processor, a graphics processor, an image signal processor (ISP), a controller, a memory, a video stream codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors 101.

[0070] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.

[0071] The processor 101 may also include a memory for storing instructions and data.

[0072] The communication module 102 may include antenna 1 and antenna 2, a mobile communication module, and / or a wireless communication module.

[0073] The display screen 103 is used to display images, videos, etc. The display screen 103 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 103, where N is a positive integer greater than 1.

[0074] Camera 104 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element may be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. In some embodiments, electronic device 100 may include one or N cameras 104, where N is a positive integer greater than 1.

[0075] Optionally, the electronic device 100 may also include peripheral devices, such as a mouse, buttons, indicator lights, keyboard, speaker, microphone, etc.

[0076] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 100.

[0077] In other embodiments, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0078] Please refer to Figure 2 This is a schematic diagram of the software architecture of an electronic device provided in an embodiment of this application. The image processing method provided in this embodiment is applied to... Figure 1 When the electronic device 100 is shown, the software in the electronic device 100 can be divided into, for example: Figure 2 The application layer 201, application framework layer (FWK) 202, hardware abstraction layer (HAL) 203, and driver layer 204 are shown.

[0079] Multiple applications can be installed in application layer 201.

[0080] For example, application layer 201 includes camera applications and gallery applications.

[0081] The application framework layer 202 provides a set of basic functions and services for the application layer 201 to call and use.

[0082] The Hardware Abstraction Layer 203 is a software located between the operating system kernel and the hardware circuitry. It is typically used to abstract the hardware to enable interaction between the operating system and the hardware circuitry at the logic layer.

[0083] The hardware abstraction layer 203 includes a data storage module, a state awareness module, an instruction decision module, and an instruction execution module.

[0084] The data storage module is used to store unprocessed initial images captured by the camera application through the camera. It is also used to delete the stored initial images when a deletion command is received. Furthermore, it is used to process the initial image data read by the instruction execution module when the instruction execution module needs to process the initial images. Additionally, it is used to process data such as the number of database crashes edited by the instruction execution module in the data storage module.

[0085] The state awareness module is used to receive various parameters sent by the operating system from the application framework layer 202, such as deletion operation information, the number of shooting requests and the number of images captured, system resource information, camera status information, foreground application information, and other parameters.

[0086] The instruction decision module includes a deletion and processing instruction decision module and an interrupt instruction decision module.

[0087] The deletion and processing instruction decision module is used to record the corresponding image identifier in the deletion queue and send the deletion instruction and deletion queue to the deletion instruction execution module when it receives a deletion instruction, the number of image capture requests exceeds the number of images captured, or there are initial images with more than a set threshold of database crashes. The deletion and processing instruction decision module is also used to record the image identifier and image type in the processing queue when system resource information meets set conditions, and send the processing queue and processing instruction to the processing instruction execution module, so that the processing instruction execution module can perform corresponding processing on the images associated with the image identifiers in the processing queue.

[0088] The interrupt command decision module is used to send an interrupt command to the interrupt command execution module when the camera application is open and an operation on the camera application is detected. It can also record the image identifier of the corresponding initial image in the interrupt queue and send the interrupt queue and interrupt command to the interrupt command execution module when the system resources do not meet the set conditions, such as when a deletion command is received, the initial image is processed in the background using a large model algorithm while other large model applications are running in the foreground, or the initial image is processed in the background using a non-large model algorithm for a non-large model task type. This allows the interrupt command execution module to interrupt the processing of the initial image corresponding to the aforementioned interrupt command.

[0089] The instruction execution module includes a delete instruction execution module, an interrupt instruction execution module, and a process instruction execution module.

[0090] The deletion instruction decision module is used to send deletion instructions and deletion queues to the data storage module when it receives deletion instructions and deletion queues, so that the data storage module responds to the deletion instructions and deletes the images associated with the image identifiers in the deletion queues.

[0091] The interrupt instruction execution module is used to interrupt each node in the thread that processes the initial image, or to interrupt the algorithm in each node of the thread that processes the initial image, when an interrupt instruction is received.

[0092] The processing instruction execution module is used to create threads when processing instructions and processing queues are received. The threads process the images associated with the image identifiers in the processing queue so that the target image can be obtained from the initial image.

[0093] Multiple drivers for driving hardware can be installed in driver layer 204.

[0094] It should be noted that the application layer 201, application framework layer 202, hardware abstraction layer 203, and driver layer 204 may also include other content, which is not specifically limited here.

[0095] Based on the above scenario description, the image processing method provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings and application scenarios.

[0096] Please see Figure 3 , Figure 3 A schematic flowchart of an image processing method provided in an embodiment of this application is shown.

[0097] like Figure 3 As shown, the image processing method provided in this application may include:

[0098] S11, The camera application sends the initial image to the data storage module.

[0099] The camera application can be a system camera application or a third-party camera application; this application does not limit the type of camera application.

[0100] The initial images include image 1 captured by the camera when the camera application receives the shooting operation, Q-frame image 2 captured by the camera before the camera application receives the shooting operation, and P-frame image 3 captured by the camera after the camera application receives the shooting operation.

[0101] The initial image is a camera image captured by the camera application through the camera, without the first processing. The first processing includes a first sub-process, or includes a first sub-process and a second sub-process. The first sub-process is a fusion process of image 1, Q-frame image 2, and P-frame image 3. The second sub-process is a process of processing the fused image obtained from the first sub-process using a large model algorithm.

[0102] Typically, if the camera application receives a shooting operation and the shooting mode is portrait mode, the first processing includes a first sub-process and a second sub-process; if the camera application receives a shooting operation and the shooting mode is non-portrait mode, the first processing includes a first sub-process.

[0103] Large model algorithms are algorithms used in machine learning and artificial intelligence to handle large-scale datasets and complex tasks. They typically involve techniques such as deep learning and neural networks, and usually require a significant amount of storage space in electronic devices during runtime.

[0104] In other words, large model algorithms can usually be seen as algorithms that occupy more storage space in the electronic device's memory than a preset storage threshold during runtime.

[0105] For example, large model algorithms can include beautification, makeup enhancement, shape enhancement, stylization, etc.

[0106] The electronic device can acquire the initial image in various ways and send the initial image to the data storage module.

[0107] In some embodiments, the electronic device includes a camera application. After receiving an operation triggered by the user on the icon of the application (such as a click, double-click, or long-press operation), the electronic device can display an interface, which is a shooting interface. The shooting interface includes shooting controls. After receiving the user's operation on the shooting controls, the electronic device can acquire an initial image and send the initial image to the data storage module.

[0108] For details on the implementation of the shooting interface, please refer to [link / reference]. Figure 4 The description of the display interface of interface 11 in the document; for the specific implementation of the shooting control, please refer to [link / reference]. Figure 4 The description of control 101 in interface 11 is not detailed here.

[0109] In other embodiments, the electronic device also includes a voice assistant application. After receiving a specific wake-up word input by the user's voice, the electronic device can wake up the voice assistant application. After the voice assistant application is woken up, if it receives a user's voice command to open the camera, the electronic device can display an interface, which is a shooting interface. Then, if it receives a user's voice command to take a picture, the electronic device can acquire an initial image and send the initial image to the data storage module.

[0110] S12. The data storage module sends a decision execution request to the deletion and processing instruction decision module.

[0111] Among them, the decision execution request is used to request the deletion and processing instruction decision module to execute S13.

[0112] S13. The deletion and processing instruction decision module determines whether a deletion instruction has been received.

[0113] Typically, after the camera application obtains the initial image, it performs initial processing on the initial image while simultaneously storing the initial image in the gallery application. A thumbnail of the initial image is then displayed in the preview window of the camera application's shooting interface. After the camera application performs initial processing on the initial image to obtain the target image, the target image is stored in the gallery application, replacing the previously stored initial image.

[0114] Therefore, after the gallery application stores the initial image, it may receive a user-instructed action to delete the image before the camera application returns the target image.

[0115] For details on how the preview box is implemented, please refer to [link / reference]. Figure 4 The description of control 102 in interface 11 is not detailed here.

[0116] The operating system can monitor parameters such as deletion operation information, the number of shooting requests and the number of initial images captured, and system resource information. It can also send the aforementioned parameters to the state awareness module of the hardware abstraction layer through the application framework layer.

[0117] If the gallery application receives an operation to delete the initial image, the operating system can detect the operation, record the deletion operation information, and send the deletion operation information to the status awareness module. When the status awareness module receives the deletion operation information, it can send the deletion operation information to the deletion and processing instruction decision module. The deletion operation information may include the deletion instruction and the image identifier of the initial image associated with the deletion instruction.

[0118] When a deletion operation message is received, the deletion and processing instruction decision module can determine that a deletion instruction has been received, and the deletion and processing instruction decision module can execute S14; when no deletion operation message is received, the deletion and processing instruction decision module can determine that no deletion instruction has been received, and the deletion and processing instruction decision module can execute S15.

[0119] Alternatively, upon receiving a decision execution request, the deletion and processing instruction decision module can obtain deletion operation information from the status awareness module. If the deletion operation information can be obtained, it means that the library application has received the operation to delete the initial image, the operating system has detected the operation to delete the initial image, and has sent the deletion operation information to the status awareness module. The deletion and processing instruction decision module can then execute S14. If the deletion operation information is not obtained, the deletion and processing instruction decision module can execute S15.

[0120] S14. The deletion and processing instruction decision module records the image identifier of the initial image associated with the deletion instruction in the deletion queue.

[0121] The deletion queue is a queue used to store image identifiers of images to be deleted.

[0122] The image identifier of the initial image is used to uniquely identify the initial image, and the image identifier of the initial image can be the image name of the initial image.

[0123] The initial image can be named according to a preset naming rule, which is to name the image according to the shooting time and date.

[0124] For example, the image identifier of the initial image is the name of the initial image. The name of the initial image can be a name that follows a preset naming rule. The name of the initial image is: IMG_20240918_093000.jpg; where IMG is the name prefix in the preset naming rule, 20240918 indicates that the shooting date is September 18, 2024, 093000 indicates that the shooting time is 9:30:00 AM, and jpg is the suffix in the preset naming rule, indicating that the image file format of the initial image is Joint Photographic Experts Group (JPG) format.

[0125] S15, The number of shooting requests in the deletion and processing instruction decision module is greater than the number of initial images to be captured.

[0126] It should be understood that, in burst shooting scenarios, when a burst shooting operation is received (such as a long press operation on the shooting control), the camera application will send a shooting request to the camera through the hardware abstraction layer. The camera will then return the initial image to the camera application through the hardware abstraction layer, and the camera application will then send a shooting request to the camera through the hardware abstraction layer again.

[0127] In other words, after the initial image is returned, the camera application may send another shooting request to the camera through the hardware abstraction layer. Before the camera application receives the next initial image, the burst shooting ends (long press operation of the shooting control). As a result, the camera application cannot receive the next initial image. That is, the number of shooting requests is greater than the number of initial images taken, and the number of burst images displayed on the camera application interface is less than the number of shooting requests.

[0128] Therefore, if the number of shooting requests exceeds the number of initial images captured, it indicates that there are redundant shooting requests, and the initial images corresponding to the redundant shooting requests need to be deleted.

[0129] When the number of shooting requests is greater than the number of initial images to be captured, the deletion and processing instruction decision module can execute S16; when the number of shooting requests is equal to the number of initial images to be captured, the deletion and processing instruction decision module can execute S17.

[0130] S16. The deletion and processing instruction decision module records the image identifier of the initial image corresponding to the redundant shooting request in the deletion queue.

[0131] Among them, S16 and Figure 3 The implementation of S14 in the illustrated embodiment is similar and will not be repeated here.

[0132] S17. The deletion and processing instruction decision module determines whether there is an initial image corresponding to the number of database crashes exceeding the threshold 1 during the first processing.

[0133] Among them, "database crash" refers to a situation where a failure occurs during the first processing of the initial image corresponding to the image identifier in the processing queue by thread 1.

[0134] The threshold 1 is pre-designed; for example, the threshold 1 is 2 times.

[0135] When it is determined that there is an initial image corresponding to a number of database crashes greater than the threshold 1, the deletion and processing instruction decision module can execute S18; when it is determined that there is no initial image corresponding to a number of database crashes greater than the threshold 1, the deletion and processing instruction decision module can execute S19.

[0136] S18. The deletion and processing instruction decision module records the image identifier of the initial image corresponding to the number of database crashes exceeding the threshold 1 in the deletion queue.

[0137] Among them, S18 and Figure 3 The implementation of S14 in the illustrated embodiment is similar and will not be repeated here. S19: The deletion and processing instruction decision module sends the deletion instruction and deletion queue to the deletion instruction execution module.

[0138] The delete command is used to request the deletion of the initial image corresponding to the image identifier in the delete queue.

[0139] Any of steps S13, S15, and S17 can be optional.

[0140] S20. The deletion instruction execution module sends a deletion instruction and a deletion queue to the data storage module.

[0141] Since the initial image captured by the camera application is stored in the data storage module, after the deletion and processing instruction decision module sends the deletion instruction and deletion queue to the deletion instruction execution module, the deletion instruction execution module needs to send the deletion instruction and deletion queue to the data storage module so that the data storage module can delete the image identified as the initial image in the deletion queue according to the deletion instruction.

[0142] S21. The data storage module sends a deletion completion message to the deletion and processing instruction decision module.

[0143] The deletion completion message indicates that the data storage module has completed deleting the initial image associated with the image identifier in the deletion queue.

[0144] After deleting the initial image associated with the image identifier in the deletion queue, the data storage module can send a deletion completion message to the deletion and processing instruction decision module to notify the data storage module that it has completed deleting the initial image associated with the image identifier in the deletion queue.

[0145] S13-S21 are optional steps.

[0146] It should be understood that there are situations where, after capturing the initial image, the user actively deletes the initial image from the gallery application.

[0147] Based on this, in S13-S21, S13-S14 and S19-S21 can be executed. When a deletion instruction is received, the deletion and processing instruction decision module can record the image identifier of the initial image corresponding to the deletion instruction in the deletion queue. Thus, the deletion and processing instruction decision module can also send the deletion instruction and the deletion queue to the deletion instruction execution module. The deletion and processing instruction decision module sends the deletion instruction and the deletion queue to the data storage module, and the data storage module deletes the image corresponding to the image identifier in the deletion queue.

[0148] Therefore, this application does not require waiting for the target image to be generated from the initial image before performing the operation of deleting the target image. The data storage module can delete the initial image in advance, reducing the user's waiting time.

[0149] It should be understood that in burst shooting scenarios, the number of shooting requests is greater than the number of initial images captured, and the number of burst images displayed on the camera application interface is less than the number of shooting requests.

[0150] Based on this, in S13-S21, S15-S16 and S19-S21 can be executed. When the number of shooting requests is greater than the number of initial images to be shot, the deletion and processing instruction decision module records the image identifiers of the initial images corresponding to the extra shooting requests in the deletion queue. The deletion and processing instruction decision module can also send deletion instructions and deletion queues to the deletion instruction execution module. The deletion and processing instruction decision module sends deletion instructions and deletion queues to the data storage module, and the data storage module deletes the images corresponding to the image identifiers in the deletion queue.

[0151] Therefore, this application can delete the initial images corresponding to redundant shooting requests in advance, saving system resources.

[0152] It should be understood that due to issues with the underlying code or algorithm processing, some initial images may experience problems such as database crashes during the first processing stage. If this situation is not addressed, users may experience frequent crashes and freezes in camera applications when using electronic devices, severely impacting the user experience.

[0153] Based on this, in S13-S21, S17-S18 and S19-S21 can be executed. When it is determined that there is an initial image corresponding to the number of database crashes exceeding the threshold 1 during the first processing, the deletion and processing instruction decision module records the image identifier of the initial image corresponding to the number of database crashes exceeding the threshold 1 in the deletion queue. The deletion and processing instruction decision module can also send a deletion instruction and a deletion queue to the deletion instruction execution module. The deletion and processing instruction decision module sends a deletion instruction and a deletion queue to the data storage module, and the data storage module deletes the initial image associated with the image identifier in the deletion queue.

[0154] Therefore, by deleting the initial images corresponding to the number of database crashes exceeding the threshold of 1 in advance, this application can solve the problem of abnormal situations occurring during the generation of target images from initial images, avoid the problem of frequent crashes and freezes of camera applications that users may encounter when using electronic devices, and ensure user experience.

[0155] S22. The deletion and processing instruction decision module obtains system resource information from the status awareness module.

[0156] The system resource information includes, but is not limited to, the temperature of the electronic device, the first storage space occupancy of the memory, the second storage space occupancy of the central processing unit (CPU) runtime memory, the third storage space occupancy of the graphics processing unit (GPU) runtime memory, and the power consumption.

[0157] S23. The deletion and processing instruction decision module determines whether the system resource information meets condition 1.

[0158] Condition 1 is pre-designed based on system resource information; Condition 1 includes, but is not limited to, rules 11, 12, 13 and 14.

[0159] Rule 11 is that the temperature of the electronic device is less than or equal to the temperature threshold; Rule 12 is that the first storage space occupancy is less than or equal to the first storage space threshold; Rule 13 is that the second storage space occupancy is less than or equal to the second storage space threshold; Rule 14 is that the third storage space occupancy is less than or equal to the third storage space threshold.

[0160] If the system resource information includes the temperature of the electronic device, the first storage space occupancy of the memory, the second storage space occupancy of the CPU runtime memory, and the third storage space occupancy of the GPU runtime memory, then condition 1 includes rules 11, 12, 13, and 14.

[0161] When it is determined that rules 11, 12, 13, and 14 are met, the deletion and processing instruction decision module determines that the system resource information meets condition 1; when it is determined that any one of rules 11, 12, 13, and 14 is not met, the deletion and processing instruction decision module determines that the system resource information does not meet condition 1.

[0162] The order of judgment for rules 11, 12, 13 and 14 is not important; they can be executed sequentially or simultaneously.

[0163] When the judgment order of rules 11, 12, 13 and 14 is executed, if the deletion and processing instruction decision module judges rule 11 first, for rule 11, the deletion and processing instruction decision module can judge whether the temperature of the electronic device is less than or equal to the temperature threshold. If it is determined that the temperature of the electronic device is greater than the temperature threshold, the deletion and processing instruction decision module determines that the system resource information does not meet condition 1, and does not execute rules 12, 13 and 14.

[0164] When the temperature of the electronic device is determined to be less than or equal to the temperature threshold, the deletion and processing instruction decision module can continue to judge rule 12, that is, the deletion and processing instruction decision module can judge whether the first storage space occupancy is less than or equal to the first storage space threshold. When it is determined that the first storage space occupancy is greater than the first storage space threshold, the deletion and processing instruction decision module determines that the system resource information does not meet condition 1, and no longer executes rule 13 and rule 14.

[0165] When it is determined that the first storage space occupancy is less than or equal to the first storage space threshold, the deletion and processing instruction decision module can continue to judge rule 13, that is, the deletion and processing instruction decision module can judge whether the second storage space occupancy is less than or equal to the second storage space threshold. When it is determined that the second storage space occupancy is greater than the second storage space threshold, the deletion and processing instruction decision module determines that the system resource information does not meet condition 1 and no longer executes rule 14.

[0166] When it is determined that the second storage space occupancy is less than or equal to the second storage space threshold, the deletion and processing instruction decision module can continue to judge rule 14, that is, the deletion and processing instruction decision module can judge whether the third storage space occupancy is less than or equal to the third storage space threshold. When it is determined that the third storage space occupancy is greater than the third storage space threshold, the deletion and processing instruction decision module determines that the system resource information does not meet condition 1.

[0167] Once it is determined that the amount of third storage space occupied is less than or equal to the third storage space threshold, the deletion and processing instruction decision module determines that the system resource information meets condition 1.

[0168] When it is determined that the system resource information meets condition 1, the deletion and processing instruction decision module can execute S24; when it is determined that the system resource information does not meet condition 1, the deletion and processing instruction decision module can execute S22 again after a duration of 1, until the system resource information meets condition 1.

[0169] S24. The deletion and processing instruction decision module records the image identifier and image type of the initial image in the processing queue.

[0170] The processing queue is a queue that stores the image identifiers and image types of the initial images to be processed.

[0171] The initial image is categorized as either a large model task or a non-large model task. If the initial image is processed using a large model algorithm, then the initial image type is a large model task; if the initial image is not processed using a large model algorithm, then the initial image type is a non-large model task.

[0172] If the initial image is taken when the camera application is in portrait mode, then the initial image is processed using the large model algorithm, and the initial image type is large model type; if the initial image is taken when the camera application is in a mode other than portrait mode, then the initial image is not processed using the large model algorithm, and the initial image type is non-large model task.

[0173] S25. The deletion and processing instruction decision module sends the processing queue and processing instructions to the processing instruction execution module.

[0174] The processing instruction is used to request the processing instruction execution module to perform the first processing on the initial image associated with the image identifier in the processing queue.

[0175] like Figure 5 As shown, when a processing instruction is received, the processing instruction execution module can execute S51-S54.

[0176] S51. The processing instruction execution module creates N threads 1, where N is the number of image identifiers in the processing queue.

[0177] For example, if the processing queue includes one image identifier 1, then the number of threads 1 is 1.

[0178] For example, if the processing queue contains two image identifiers, namely image identifier 1 and image identifier 2, then the number of threads 1 is 2, namely the processing thread for the image corresponding to image identifier 1 and the processing thread for the image corresponding to image identifier 2.

[0179] S52. The processing instruction execution module performs the first processing on the initial images associated with the N image identifiers in the processing queue through N threads 1.

[0180] For example, the processing queue includes one image identifier 1 and one thread 1; the processing instruction execution module can perform the first processing on the initial image associated with the image identifier through this one thread.

[0181] S53. The processing instruction execution module determines whether a database crash occurs during the first processing of the initial image associated with the image identifier in the processing queue by thread 1.

[0182] If a failure occurs during the first processing of the initial image corresponding to the image identifier in the processing queue by thread 1, it can be determined that a database crash occurred during the processing of the image associated with the image identifier in the processing queue by thread 1.

[0183] If no failure occurs during the first processing of the initial image corresponding to the image identifier in the processing queue by thread 1, it can be determined that no database crash occurred during the processing of the image associated with the image identifier in the processing queue by thread 1.

[0184] When a database crash occurs, the processing instruction execution module can execute S54; when no database crash occurs, the initial image can be generated into the target image normally, and the processing instruction execution module does not need to execute any steps.

[0185] S54. The instruction execution module records the number of database crashes in the data storage module.

[0186] The number of database crashes refers to the number of times a failure occurred during the initial processing.

[0187] In some embodiments, each time the processing instruction execution module determines that a database crash has occurred, it can send a database crash notification to the data storage module. The database crash notification carries an image identifier of the initial image that crashed during the processing. Thus, the data storage module can record the number of database crashes for each initial image during the processing based on the image identifier, that is, associate the number of database crashes with each initial image.

[0188] S26. The instruction execution module sends an image processing notification to the status awareness module.

[0189] Among them, the image processing notification is used to notify the status awareness module that the processing instruction execution module is performing the first processing on the initial image associated with the image identifier in the processing queue.

[0190] S51 and S26 can be executed simultaneously or sequentially. When executed sequentially, S51 is usually executed first, followed by S26.

[0191] S27. The status awareness module sends the awareness parameters to the interrupt instruction decision module.

[0192] Based on S13, the operating system can also monitor parameters such as camera status information and foreground application information, and can also send the aforementioned parameters to the status awareness module of the hardware abstraction layer through the application framework layer.

[0193] The camera status information indicates whether the camera application is open or closed.

[0194] Foreground application information includes scene information and foreground running application information.

[0195] Scene information includes whether an action on the camera application was detected or not when the split-screen / floating window function displays the interface of an application other than the camera application.

[0196] Foreground running application information includes multiple applications in an electronic device. If the background is processing images using a large model algorithm, and other applications using the large model algorithm besides the camera application are running in the foreground, the foreground running application information is used to indicate that the background is processing images using a large model algorithm and there are other large model applications besides the camera application running in the foreground. Otherwise, the foreground running application information is used to indicate that there are no other large model applications besides the camera application running in the foreground.

[0197] Upon receiving an image processing notification, if the camera status information received by the state perception module from the operating system meets rule 21, the scene information meets rule 22, the foreground running application information meets rule 23, the deletion operation information meets rule 24, or the system resource information meets rule 25, the state perception module can send perception parameters such as camera status information, scene information, foreground running application information, deletion operation information, and system resource information to the interrupt instruction decision module.

[0198] Rule 21 indicates that the camera application is open; Rule 22 indicates that an operation on the camera application has been detected; Rule 23 indicates that the background is processing images using a large model algorithm and that there are other large model applications running in the foreground besides the camera application; Rule 24 indicates that a deletion operation has been received; and Rule 25 indicates that the system resource information meets condition 1.

[0199] For example, if the state awareness module receives camera state information from the operating system but does not receive other parameters, the camera state information indicates that the camera application is open, satisfying rule 21. Then, the state awareness module sends camera state information, scene information, foreground running application information, deletion operation information, and system resource information to the interrupt command decision module. The camera state information indicates that the camera application is open, the scene information indicates that no operation was detected on the camera application, the foreground running application information indicates that there are no other large model applications running in the foreground besides the camera application, the deletion operation information indicates that no deletion command was received, and the system resource information indicates that condition 1 is satisfied.

[0200] For example, if the state awareness module receives camera state information and scene information from the operating system, but does not receive other parameters, the camera state information indicates that the camera application is open, satisfying rule 21, and the scene information indicates that an operation has been detected on the camera application, satisfying rule 22. Then, the state awareness module sends the camera state information, scene information, foreground running application information, deletion operation information, and system resource information to the interrupt instruction decision module. The camera state information indicates that the camera application is open, the scene information indicates that an operation has been detected on the camera application, the foreground running application information indicates that there are no other large model applications running in the foreground besides the camera application, the deletion operation information indicates that no deletion instruction has been received, and the system resource information indicates that condition 1 is satisfied.

[0201] S28, The interrupt instruction decision module determines whether the camera application interface is open.

[0202] It should be understood that the camera application may close (exit) based on user operation after taking one or more initial images. In this case, if the camera status information in the received perception parameters indicates that the camera application interface is open, that is, the camera application is still displaying the camera application's shooting interface, the camera application may also be in a continuous shooting state, running in the foreground. In this case, the camera status information indicates that the camera application interface is open.

[0203] When it is determined that the camera application interface is open, the interrupt instruction decision module can execute S29; when it is determined that the camera application interface is not open, the interrupt instruction decision module can execute S31.

[0204] S29, The interrupt instruction decision module determines whether an operation on the camera application is detected at the current moment.

[0205] It should be understood that electronic devices may have floating window or split-screen functions. The electronic device may open another application through the floating window or split-screen function while opening the camera application. If the user operates on the interface of the other application at this time, the scene information in the received perception parameters indicates that no operation on the camera application is detected. If the user operates on the interface of the camera application at this time (the user's focus is on the camera), the scene information in the received perception parameters indicates that the operation on the camera application is detected.

[0206] For scenarios where the user operates within the interface of another application, please refer to... Figure 6 The description, Figure 6 While the camera application is open, the electronic device can open another application through the floating window 103, which displays the interface of the other application. Thus, the user can operate on the interface of the other application.

[0207] Based on this, the interrupt instruction decision module can determine whether to receive an operation from the camera application based on the scene information.

[0208] If no operation is detected on the camera application, the interrupt instruction decision module can execute S31; if an operation is detected on the camera application, it means that the camera application is running in the foreground and in the background at the same time, and there is a competition for memory space resources between the foreground and background of the camera application, and the interrupt instruction decision module can execute S30.

[0209] S30, The interrupt instruction decision module sends interrupt instruction 1 to the interrupt instruction execution module.

[0210] Interrupt instruction 1 is used to request an interruption of the first processing of all initial images.

[0211] Among them, such as Figure 5 As shown, S61-S621 or S61-S622 can be executed after S30.

[0212] S31, The interrupt instruction decision module determines whether a deletion instruction has been received.

[0213] As can be seen from S13, the operating system can detect deletion operations, record deletion operation information, and send deletion operation information to the state awareness module. When the state awareness module receives the deletion operation information, it can send perception parameters to the deletion and processing instruction decision module. Among the received perception parameters, the deletion operation information can include the deletion instruction and the image identifier of the initial image corresponding to the deletion instruction.

[0214] The state awareness module can receive deletion operation information and send it to the deletion and processing instruction decision module before the initial image is processed, that is, before the deletion and processing instruction decision module sends the processing queue and processing instruction to the processing instruction execution module, as shown in S13. It can also receive deletion operation information and send it to the interrupt instruction decision module during the initial image processing, that is, it may receive deletion operation information at the current moment.

[0215] When a deletion operation message is received, the interrupt instruction decision module can determine that a deletion instruction has been received, and the deletion and processing instruction decision module can execute S32; when no deletion operation message is received, the deletion and processing instruction decision module can execute S33.

[0216] S32. The interrupt instruction decision module records the image identifier of the initial image associated with the deletion instruction in the interrupt queue.

[0217] The interrupt queue is a queue used to store image identifiers that need to be interrupted.

[0218] Among them, S32 and Figure 3 The implementation of S14 in the illustrated embodiment is similar and will not be repeated here.

[0219] After S31 is executed, the interrupt instruction decision module can traverse the processing queue and, based on the image type in the processing queue, execute S33 for the initial image of the large model task type and execute S36 for the initial image of the non-large model task type.

[0220] S33, The interrupt instruction decision module determines whether the background is processing image 4 using the large model algorithm at the current moment.

[0221] Image 4 is the initial image corresponding to any large model task type in the processing queue.

[0222] The interrupt instruction decision module can execute S33 sequentially for the initial image corresponding to each large model task, according to the recorded order of image identifiers and image types in the processing queue.

[0223] For example, image 4 is the initial image corresponding to the first large model task type in the processing queue. Based on the foreground application information in the received perception parameters, if it is determined that the background is processing image 4 through the large model algorithm at the current moment, the interrupt instruction decision module can execute step S34; if it is determined that the background is not processing image 4 through the large model algorithm at the current moment, the interrupt instruction decision module can not execute any steps.

[0224] S34, the interrupt instruction decision module determines whether there are other large model applications running in the foreground besides the camera application.

[0225] It should be understood that electronic devices may have floating window or split-screen functions. An electronic device may open another application simultaneously with the camera application via the floating window or split-screen function. This other application may be a large model application other than the camera application. If the electronic device opens another large model application via the floating window or split-screen function, the received perception parameters indicating that the background is currently processing image 4 using a large model algorithm, and that there is another large model application running in the foreground besides the camera application, will be present. Otherwise, the received perception parameters indicating that there is no other large model application running in the foreground besides the camera application will be present.

[0226] Based on this, the interrupt instruction decision module can determine whether there are other large model applications running in the foreground besides the camera application, according to the foreground application information.

[0227] If other large model applications besides the camera application are running in the foreground, the interrupt instruction decision module can execute S35; if no other large model applications besides the camera application are running in the foreground, it means that there are no other large model applications competing with the camera application for memory space resources, and the interrupt instruction decision module can skip any steps.

[0228] S35. The interrupt instruction decision module records the image identifier of image 4 in the interrupt queue.

[0229] Among them, S35 and Figure 3 The implementation of S32 in the illustrated embodiment is similar and will not be repeated here.

[0230] S36. The interrupt instruction decision module determines whether the system resource information meets condition 1.

[0231] Among them, S36 and Figure 3 The implementation of S23 in the illustrated embodiment is similar and will not be repeated here.

[0232] Based on the system resource information in the received sensing parameters, if the system resource information does not meet condition 1, the interrupt instruction decision module can execute S37; if the system resource information meets condition 1, it means that there is no memory space resource contention problem, and the interrupt instruction decision module can skip any steps.

[0233] S37. The interrupt instruction decision module records the image identifier of image 5 in the interrupt queue.

[0234] Among them, image 5 is any non-large model task type in the processing queue, and the system's Western information does not meet the initial image corresponding to condition 1 during the first processing.

[0235] The interrupt instruction decision module can execute S37 sequentially for the initial image corresponding to each non-large model task, according to the recorded order of image identifiers and image types in the processing queue.

[0236] For example, image 5 is the first non-large model task type in the processing queue, and the system's Western information does not meet the initial image corresponding to condition 1 during the first processing.

[0237] S38. When the interrupt instruction decision module finishes traversing the processing queue, it sends the interrupt queue and interrupt instruction 2 to the interrupt instruction execution module.

[0238] Interrupt instruction 2 is used to request an interruption of the processing of the initial image associated with the image identifier in the interrupt queue.

[0239] Among them, such as Figure 5 As shown, S61-S621 or S61-S622 can be executed after S38.

[0240] It should be understood that the camera application uses a foreground-background mechanism to capture images. When a shooting operation is received, the foreground will quickly return the initial image (thumbnail), but the camera application still performs the first processing of the initial image in the background to obtain the target image (real image). At this time, if a shooting operation is detected on the camera application, the camera shooting may lag. This can be understood as the camera application's first processing behavior in the background affecting the smoothness of the foreground camera application.

[0241] Based on this, in S28-S30, when it is determined that the camera application is open and an operation on the camera application is detected, the interrupt instruction decision module can send interrupt instruction 1 to the interrupt instruction decision module. The interrupt instruction decision module executes S61-S621 / S622, causing the camera application to terminate the first processing of all initial images in the background.

[0242] Therefore, this application can interrupt the first processing of all initial images in advance, eliminating the need to perform subsequent steps such as detecting database crashes, thus ensuring the smoothness of the camera application when it is running in the foreground.

[0243] It should be understood that there may be situations where the user actively deletes the initial image from the gallery application after the initial image is captured. This situation may occur before the initial image is processed, as shown in S13, or it may occur during the initial image processing, as shown in S31.

[0244] Based on this, in S31-S32, when it is determined that the camera application is open, no operation is detected on the camera application, and a deletion command is received, or when it is determined that the camera application is not open, and a deletion command is received, the interrupt command decision module can record the image identifier associated with the deletion command in the interrupt queue. This facilitates the subsequent execution of S61-S621 / S622 by the interrupt command decision module after it sends interrupt command 2 to the interrupt command decision module, thereby terminating the first processing of all initial images by the camera application in the background.

[0245] Therefore, this application can interrupt the first processing of the initial image corresponding to the image identifier associated with the deletion instruction in advance, preventing the camera application running in the background from competing with other large model applications running in the foreground for memory space resources, and ensuring the smoothness of other large model applications running in the foreground.

[0246] It should be understood that there is competition for storage space resources between applications in electronic devices. As the imaging capabilities of electronic devices continue to improve, a significant amount of system resources are required during the shooting process to ensure the effectiveness of the algorithm. This is especially true for some large-scale imaging algorithms, which consume substantial CPU / GPU and neural processing unit (NPU) resources. Simultaneously, other applications also compete for limited system resources. After a user takes an initial image using the camera application, if they then open other applications such as voice assistant applications (e.g., YoYo) or other high-load applications, resource contention between applications occurs because the camera application is still processing the initial image in the background. This resource contention can lead to problems such as lag and overheating in electronic devices.

[0247] Based on this, in S33-S35, at the current moment, image 4 is processed in the background by the large model algorithm, and there are other large model applications besides the camera application running in the foreground. The interrupt instruction decision module can record the image identifier of image 4 in the interrupt queue, so that after the interrupt instruction decision module sends interrupt instruction 2, the interrupt instruction decision module executes S61-S621 / S622, thereby terminating the camera application's first processing of image 4 in the background.

[0248] Therefore, this application can interrupt the first processing of image 4 in advance, preventing the camera application running in the background from competing for storage space resources with other large model applications running in the foreground, and ensuring the smoothness of other large model applications running in the foreground.

[0249] It should be understood that during the process of the camera application processing the initial images of non-large model tasks, there may be other applications competing with the camera application for memory resources, which may cause the system resource information to fail to meet condition 1.

[0250] Based on this, in S36-S37, if the system resource information does not meet condition 1, it indicates that there may be other applications competing with the camera application for storage space resources. The interrupt instruction decision module can record the image identifier of image 5 in the interrupt queue, so that after the interrupt instruction decision module sends interrupt instruction 2, the interrupt instruction decision module executes S61-S621 / S622, thereby terminating the camera application from performing the first processing on image 5 in the background.

[0251] Therefore, this application can interrupt the first processing of image 5 in advance, preventing the camera application running in the background from competing for storage space resources with other large model applications running in the foreground, and ensuring the smoothness of other large model applications running in the foreground.

[0252] S61, The interrupt instruction execution module determines the thread 2 corresponding to the initial image of the interrupt instruction.

[0253] Among them, thread 2 is the processing thread for the initial image corresponding to the interrupt instruction among N threads 1.

[0254] If S61 is executed after S30, then the interrupt instruction here is interrupt instruction 1; based on S30, interrupt instruction 1 is used to request the interruption of the first processing of all initial images, then thread 2 includes N threads 1.

[0255] If S61 is executed after S38, then the interrupt instruction here is interrupt instruction 2. Based on S38, interrupt instruction 2 is used to request the interruption of the first processing of the initial image associated with the image identifier in the interrupt queue. Therefore, thread 2 includes N threads from thread 1 that process the initial image associated with the image identifier in the interrupt queue.

[0256] S621, The interrupt instruction execution module sends a stop flag to the algorithm of each processing node of thread 2.

[0257] Thread 2 includes multiple processing nodes (plugins). The interrupt instruction execution module can implement the first processing through multiple processing nodes, and each processing node is equipped with an algorithm related to the first processing.

[0258] After determining thread 2, the interrupt instruction execution module can issue a termination flag to the algorithm of each processing node in thread 2, thereby interrupting the algorithm running at each node in thread 2, which also interrupts the first processing of the initial image corresponding to the interrupt instruction.

[0259] Based on S61, if thread 2 includes N threads 1, the interrupt instruction execution module sends a termination flag to the algorithms of each of the multiple processing nodes of each of the N threads 1, thereby interrupting the algorithms of the aforementioned multiple processing nodes, that is, interrupting the first processing of all initial images corresponding to interrupt instruction 1.

[0260] Based on S61, if thread 2 includes N threads 1 that process the initial image associated with the image identifier in the interrupt queue, then the interrupt instruction execution module issues a termination flag to the algorithms of each of the multiple processing nodes of the aforementioned threads, thereby interrupting the algorithms of each of the aforementioned multiple processing nodes, that is, interrupting the first processing of the initial image associated with the image identifier in the interrupt queue corresponding to interrupt instruction 2.

[0261] Therefore, the above-mentioned algorithm interruption method sends a termination flag, or termination signal, to the algorithm in each processing node through layer-by-layer calls. At the same time, there are multiple detection nodes inside the algorithm. The algorithm checks whether it has received a termination signal every time it passes through a node, so that the algorithm can be interrupted in time when it receives a termination signal. In addition, algorithm delays are set for different algorithm processing nodes to ensure that the current background processing can be canceled in time.

[0262] S622, The interrupt instruction execution module sends termination information (which can be EOS_MSG) to each processing node of thread 2.

[0263] Thread 2 includes multiple processing nodes, and the interrupt instruction execution module can perform the first processing through multiple processing nodes.

[0264] After determining thread 2, the interrupt instruction execution module can send termination information to each processing node of thread 2 to interrupt thread 2, that is, to interrupt the first processing of the initial image corresponding to the interrupt instruction.

[0265] Based on S61, if thread 2 includes N threads 1, the interrupt instruction execution module sends termination information to multiple processing nodes of each of the N threads 1, thereby interrupting the aforementioned multiple processing nodes, that is, interrupting the first processing of all initial images corresponding to interrupt instruction 1.

[0266] Based on S61, if thread 2 includes N threads 1 that process the initial image associated with the image identifier in the interrupt queue, then the interrupt instruction execution module sends termination information to multiple processing nodes of the aforementioned threads to interrupt the aforementioned multiple processing nodes, that is, to interrupt the first processing of the initial image associated with the image identifier in the interrupt queue corresponding to interrupt instruction 2.

[0267] Therefore, the above-mentioned method of using software interruption mainly aims to terminate the operation of all processing nodes in advance. It can send a termination message to each processing node, notifying the runtime engine to terminate the background processing pipeline in advance. After receiving the termination message, the pipeline will call the termination function of all processing nodes to terminate the processing of all processing nodes in advance.

[0268] In the image processing method of this application, if during the first processing, it is detected that the camera application is still displaying the camera application interface and any operation by the user on the camera application is detected, then the first processing of all initial images is interrupted. Thus, this application can interrupt the first processing of the initial image in advance, so that the first processing of the initial image by the processing instruction execution module in the background no longer competes with the camera application running in the foreground for memory resources, thus ensuring the smoothness of the camera application running in the foreground.

[0269] While the image is being processed in the background using a large model algorithm, if the interrupt instruction execution module determines that another large model application (besides the camera application) is running in the foreground, it can record the image identifier of that image in the interrupt queue. This allows for early interruption of the initial processing of that image, preventing the initial image processing by the processing instruction execution module in the background from competing for storage resources with other large model applications running in the foreground, thus ensuring the smooth operation of those foreground applications. Alternatively, if system resource information does not meet condition 1, indicating potential issues such as other applications competing for storage resources with the camera application, the image identifier of that image can be recorded in the interrupt queue, thereby ensuring the smooth operation of the camera application.

[0270] Based on this, by adding an interrupt instruction execution module, decisions are made on the current system's operating state and the algorithm's resource requirements, and an interrupt result suitable for the current scenario is output. Through the interrupt mechanism, granular interruption can be supported, and all or part of the initial images being processed can be selectively interrupted.

[0271] Before processing, if a deletion command is received, the image identifier of the initial image associated with the deletion command can be recorded in the deletion queue. This allows the image associated with the deletion command to be deleted in advance, eliminating the need to wait until the target image is generated from the initial image before deleting it. The data storage module can achieve early deletion of the initial image, reducing user waiting time. Alternatively, during processing, if a deletion command is received, the image identifier associated with the deletion command is recorded, and the first processing of the initial image corresponding to that image identifier is interrupted in advance. This prevents the camera application running in the background from competing for storage space resources with other large model applications running in the foreground, ensuring the smooth operation of other large model applications running in the foreground.

[0272] For continuous shooting scenarios, when the number of shooting requests exceeds the number of initial images to be captured, the image identifiers of the initial images corresponding to the extra shooting requests are recorded in the deletion queue. This allows the initial images corresponding to the extra shooting requests to be deleted in advance, saving system resources.

[0273] When system resource information meets condition 1, it means that the image acquired at this time can be processed normally. The image identifier and image type can be recorded in the processing queue, and the image can be processed. If the number of database crashes is greater than or equal to threshold 1 during the first processing, the image identifier of the initial image is recorded in the deletion queue for the initial image with the number of database crashes greater than or equal to threshold 1. Thus, it is possible to delete the image in advance based on the image identifier. This can solve the problem of abnormalities occurring during the generation of the target image from the initial image, and can avoid the problem of frequent crashes and freezes of the camera application when users use electronic devices, thus ensuring the user experience.

[0274] Based on the foregoing embodiments, the image processing method provided in this application is described below.

[0275] For example, this application provides an image processing method.

[0276] For ease of explanation, the image processing method provided in this application can be derived from... Figure 2 The electronic device 100 in the device performs the operation, and the electronic device 100 includes a camera application.

[0277] Please see Figure 7 , Figure 7 A schematic flowchart of an image processing method provided in an embodiment of this application is shown.

[0278] like Figure 7 As shown, the image processing method provided in this application may include:

[0279] S301. Display the first interface, which is the interface of the camera application and includes shooting controls.

[0280] For details on the implementation of the first interface, please refer to [link / reference]. Figure 3 Description of the camera interface of the S11.

[0281] For details on the implementation of the shooting control, please refer to [link / reference]. Figure 3 Description of the shooting controls for the S11.

[0282] For details on the implementation of S301, please refer to [link / reference]. Figure 3 The description of the shooting interface in the S11 is not repeated here.

[0283] S302, In response to a first operation on the shooting control, acquire an initial image, the first operation being used to instruct the camera application to capture an image through the camera.

[0284] For details on the implementation of the first operation, please refer to [link / reference]. Figure 3 Description of the operation of the shooting control in S11.

[0285] For details on how the initial image is implemented, please refer to [link / reference]. Figure 3 Description of the operations on the initial image in S11.

[0286] In some embodiments, the initial image includes a first image captured by the camera when the camera application receives the first operation, a Q-frame second image captured by the camera before the camera application receives the first operation, and / or a P-frame third image captured by the camera after the camera application receives the first operation, where Q and P are both positive integers greater than or equal to 1, and the first processing is a fusion processing of the first image, the Q-frame second image and the P-frame third image.

[0287] For details on the implementation of S302, please refer to [link / reference]. Figure 3 The description of obtaining the initial image in S11 will not be repeated here.

[0288] S303. The first module performs first processing on the initial image in the background. During the first processing of the initial image, if it is detected that the camera application is still displaying the camera application interface and any operation on the camera application interface is detected, the first processing of the initial image is interrupted.

[0289] For details on the implementation of the first module, please refer to [link / reference]. Figure 3 Description of the instruction execution module.

[0290] For details on the implementation of the first processing step, please refer to [link / reference]. Figure 5 The description of the first process in S52 of the document.

[0291] For details on the implementation of S303, please refer to [link / reference]. Figure 3 S52, and Figure 3 The descriptions of S28-S30 in the document will not be repeated here.

[0292] The image processing method of this application, if during the first processing of the initial image in the background by the first module, it is detected that the camera application is still displaying its interface and that the user is performing any operation on the camera application, then the first processing of the entire initial image is interrupted. Thus, by interrupting the first processing of the initial image in advance, the first processing of the initial image by the first module in the background no longer competes with the camera application running in the foreground for memory resources, ensuring the smoothness of the camera application running in the foreground. In some embodiments, the image processing method provided in this application may include:

[0293] Determine whether the system resource information at the current moment meets the first condition. The system resource information includes the temperature of the electronic device, the first storage space occupancy of the electronic device's memory, the second storage space occupancy of the central processing unit's runtime memory, and / or the third storage space occupancy of the graphics processing unit's runtime memory. The first condition includes the temperature being less than or equal to a temperature threshold, the first storage space occupancy being less than or equal to a first storage space threshold, the second storage space occupancy being less than or equal to a second storage space threshold, and / or the third storage space occupancy being less than or equal to a third storage space threshold. When it is determined that the system resources meet the first condition, the initial image is processed in the background by the first module.

[0294] For details on the implementation of system resource information, please refer to [link / reference]. Figure 3 The description of system resource information in S22.

[0295] For details on how the first condition is implemented, please refer to [link / reference]. Figure 3 The description of condition 1 in S23.

[0296] For details on how to implement the above steps, please refer to [link / reference]. Figure 3 S22-S23, and Figure 5 The description of S52 in the document will not be repeated here.

[0297] In some embodiments, the image processing method provided in this application may include:

[0298] In the processing queue, the image identifier of the initial image is recorded; in the background, the first module creates N first threads, and the N first threads perform the first processing on the N initial images associated with the N image identifiers in the processing queue.

[0299] For details on the implementation of the processing queue, please refer to [link / reference]. Figure 3 The description of the processing queue in S24 of the document.

[0300] For details on the implementation of N first threads, please refer to [link / reference]. Figure 5 The description of N threads in S51.

[0301] For details on how to implement the above steps, please refer to [link / reference]. Figure 3 S24-S26, and Figure 5 The descriptions of S51-S52 in the document will not be repeated here.

[0302] In some embodiments, the image processing method provided in this application may include:

[0303] Send a first termination flag to the first algorithm. The first algorithm is the algorithm executed by the first processing node. The first processing node includes the processing node of each of the N first threads. The first termination flag is used to terminate the operation of the first algorithm. The first algorithm is the algorithm used by the first processing.

[0304] For details on the implementation of the first algorithm, please refer to [link / reference]. Figure 5 The description of the algorithm for each processing node of thread 2 in S621.

[0305] For details on the implementation of the first termination identifier, please refer to [link / reference]. Figure 5 The description of the termination mark in S621.

[0306] For details on how to implement the above steps, please refer to [link / reference]. Figure 5 The description of S621 in the document will not be repeated here.

[0307] In some embodiments, the image processing method provided in this application may include:

[0308] Send a second termination flag to the first processing node. The first processing node includes the processing node for each of the N first threads. The second termination flag is used to terminate the operation of the N first threads.

[0309] For details on the implementation of the second termination identifier, please refer to [link / reference]. Figure 5 The description of termination information in S622 of the document.

[0310] For details on how to implement the above steps, please refer to [link / reference]. Figure 5 The description of S622 in the document will not be repeated here.

[0311] In some embodiments, the image processing method provided in this application may include:

[0312] The method records the image identifier and image type of the initial image, which are associated. The image type includes a first type and a second type. The first type indicates that the initial image was captured in portrait mode. If the initial image was captured in portrait mode, the first process includes a first sub-process and a second sub-process. The first sub-process is a fusion process, and the second sub-process is a process using a first model algorithm. When the first model algorithm is running, the fourth storage space occupancy of the memory is greater than or equal to the fourth storage space threshold. The second type indicates that the initial image was captured in non-portrait mode. If the initial image was captured in non-portrait mode, the first process includes the first sub-process. The method further includes: if it is detected that the camera application is still displaying the camera application interface, and no other information is detected on the camera... During any operation of the application's interface, the N image identifiers in the processing queue are traversed. If the first identifier is encountered, it is determined whether the first module is performing the first sub-processing on the fourth image in the background. The first identifier is any one of the N image identifiers in the processing queue that belongs to the first type of initial image, and the fourth image is the initial image associated with the first identifier. When it is determined that the first module is performing the first sub-processing on the fourth image in the background, it is determined whether there is a first application running in the foreground. The first application is a non-camera application, and the first application is an application running using the second model algorithm. When the second model algorithm is running, the fifth storage space of the memory occupancy is greater than or equal to the fourth storage space threshold. If there is a first application running in the foreground, the first processing of the fourth image is interrupted.

[0313] For details on the implementation of image types, please refer to [link / reference]. Figure 3 The description of the image type in S24.

[0314] For details on the implementation of the first type, please refer to [link / reference]. Figure 3 The description of the large model task type in S24.

[0315] For details on the implementation of the second type, please refer to [link / reference]. Figure 3 The description of non-large model task types in S24.

[0316] For details on how to implement the above steps, please refer to [link / reference]. Figure 3 S33-S35, S38, and Figure 5 The descriptions of S61-S622 in the document will not be repeated here.

[0317] In this application, the first processing of the fourth image can be interrupted in advance, so that the first processing of the initial image in the background by the first module no longer competes with the first application running in the foreground and occupying a large amount of storage space for storage resources, thus ensuring the smoothness of other large model applications running in the foreground.

[0318] In some embodiments, the image processing method provided in this application may include:

[0319] If the second identifier is encountered during traversal, it is determined whether the system resource information meets the first condition. The second identifier is any one of the N image identifiers in the processing queue that belongs to the second type of initial image. If it is determined that the system resources do not meet the first condition, the first processing of the fifth image is interrupted. The fifth image is the initial image associated with the second identifier.

[0320] For details on how to implement the above steps, please refer to [link / reference]. Figure 3 S36-S37, S38, and Figure 5 The descriptions of S61-S622 in the document will not be repeated here.

[0321] In this application, by interrupting the first processing of the fifth image in advance, the first processing of the fifth image in the background by the first module no longer competes with the camera application running in the foreground for storage space resources, thus ensuring the smoothness of the camera application running in the foreground.

[0322] In some embodiments, the image processing method provided in this application may include:

[0323] When a first application is running in the foreground, the image identifier of the fourth image is recorded in the interrupt queue; when it is determined that the system resources do not meet the first condition, the first processing of the fifth image is interrupted, including: when it is determined that the system resources do not meet the first condition, the image identifier of the fifth image is recorded in the interrupt queue; the method further includes: when the N image identifiers in the processing queue are traversed, the first processing of the initial image associated with all image identifiers in the interrupt queue is interrupted.

[0324] For details on how to implement the above steps, please refer to [link / reference]. Figure 3 S35, S37, S38, and Figure 5 The descriptions of S61-S622 in the document will not be repeated here.

[0325] In some embodiments, the image processing method provided in this application may include:

[0326] The method further includes: displaying a second interface, which is the display interface of the initial image in the gallery application; deleting the initial image in response to a second operation on the initial image; the method also includes: interrupting the first processing of the initial image if a second operation on the initial image is received during the first processing of the initial image.

[0327] For details on how the deletion operation is implemented, please refer to [link / reference]. Figure 3 The description of the operation of deleting the initial image in S31.

[0328] For details on how to implement the above steps, please refer to [link / reference]. Figure 3 S31-S32 in the middle, and Figure 5 The descriptions of S61-S622 in the document will not be repeated here.

[0329] In this application, if a deletion operation on the initial image is received before the first processing of the initial image has been completed, the first processing of the initial image can be interrupted. It is not necessary to wait for the first processing of the initial image to be completed before performing the deletion operation on the target image obtained by the first processing. In this way, the initial image can be deleted in advance, reducing the user's waiting time and ensuring the user's user experience.

[0330] In some embodiments, the image processing method provided in this application may include:

[0331] If a second operation on the initial image is received before the initial image is processed, the initial image is deleted.

[0332] For details on how the deletion operation is implemented, please refer to [link / reference]. Figure 3 The description of the operation of deleting the initial image in S13.

[0333] For details on how to implement the above steps, please refer to [link / reference]. Figure 3 S13-S14, S19-S21, and Figure 5 The descriptions of S61-S622 in the document will not be repeated here.

[0334] In this application, if the initial image has not yet undergone the first processing, and a deletion operation for the initial image is received, the initial image can be deleted in advance. It is not necessary to wait for the initial image to complete the first processing before performing the deletion operation on the target image obtained from the first processing. In this way, the initial image can be deleted in advance, reducing the user's waiting time and ensuring the user's user experience.

[0335] In some embodiments, the image processing method provided in this application may include:

[0336] If the number of processing failures during the initial processing of the initial image is greater than or equal to the preset number, the initial image will be deleted.

[0337] For details on how to handle faults, please refer to [link / reference]. Figure 3 The description of database crash in S17 of the document.

[0338] For details on how to implement the above steps, please refer to [link / reference]. Figure 3 The descriptions of S17-S21 in the document will not be repeated here.

[0339] In this application, if the number of processing failures (i.e., database crashes) during the first processing of the initial image is greater than or equal to the preset number, then the target image cannot be obtained through the first processing. The initial image can be deleted in advance based on the image identifier, which can solve the problem of abnormal situations occurring during the generation of the target image from the initial image. It can also avoid the problem of frequent crashes and freezes of camera applications that users may encounter when using electronic devices, thus ensuring a good user experience.

[0340] In some embodiments, the image processing method provided in this application may include:

[0341] In response to a first operation on the shooting control, the camera application sequentially sends multiple shooting requests to the camera. The first operation instructs the camera application to continuously capture images through the camera. Based on the multiple shooting requests, the camera sequentially acquires multiple initial images and sequentially sends the multiple initial images to the camera application. The camera application receives the multiple initial images. At the end of the first operation, if it is determined that the number of multiple shooting requests is greater than the number of received initial images, a sixth image is deleted. The sixth image is the initial image corresponding to the shooting requests that the camera application has sent to the camera but has not received at the end of the first operation.

[0342] For details on the implementation of the first operation, please refer to [link / reference needed]. Figure 3 The description of continuous shooting operation in S15.

[0343] For details on how to implement a shooting request, please refer to [link / reference]. Figure 3 The description of the shooting request in S15.

[0344] For details on how to implement the above steps, please refer to [link / reference]. Figure 3 The descriptions of S15-S16 and S19-S21 in the document will not be repeated here.

[0345] In this application, if it is determined that the number of multiple shooting requests is greater than the number of multiple initial images received, the sixth image can be deleted, that is, the initial images corresponding to the extra shooting requests can be deleted in advance, saving system resources.

[0346] For example, this application provides an electronic device including a processor; when the processor executes computer code or instructions in memory, the electronic device performs the image processing method described in the preceding embodiments.

[0347] It is understood that, in order to achieve the above-mentioned functions, electronic devices include hardware and / or software modules that perform the respective functions. Based on the algorithmic steps of the examples described in the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by 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 conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.

[0348] This embodiment can divide the electronic device into functional modules according to the above method example. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated modules can be implemented in hardware. It should be noted that the module division in this embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.

[0349] When functional modules are divided according to their respective functions, the electronic device 100 involved in the above embodiments may further include: a data storage module, a state perception module, an instruction decision module, and an instruction execution module. These modules can cooperate with each other to support the electronic device in performing the above steps and / or other processes related to the technology described herein.

[0350] It should be noted that all relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.

[0351] For example, this application provides an electronic device including: a memory and a processor; the memory is coupled to the processor and is used to store program code or instructions; the processor is used to call the program code or instructions in the memory to cause the electronic device to execute the image processing method in the preceding embodiments.

[0352] For example, this application provides a chip system applied to an electronic device including a memory, a display screen, and a sensor; the chip system includes: one or more interface circuits and one or more processors; the interface circuits and processors are interconnected via lines; the interface circuits are used to receive signals from the memory and send signals to the processors, the signals including computer code or instructions stored in the memory; when the processor executes the computer code or instructions, the electronic device executes the image processing method in the preceding embodiments.

[0353] For example, this application provides a computer-readable storage medium storing code or instructions that, when executed on an electronic device, cause the electronic device to implement the image processing method described in the preceding embodiments.

[0354] For example, this application provides a computer program product that, when run on a computer, enables an electronic device to implement the image processing method described in the preceding embodiments.

[0355] In this embodiment, the electronic device, chip system, computer-readable storage medium, or computer program product are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0356] In the above embodiments, all or part of the functionality can be implemented by software, hardware, or a combination of software and hardware. When implemented using software, it can be implemented wholly or partially in the form of a computer program product. A computer program product includes one or more computer codes or instructions. When the computer program code or instructions are loaded and executed on a computer, all or part of the flow or functionality according to this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer code or instructions can be stored in a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0357] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

Claims

1. An image processing method, characterized in that, Applied to an electronic device, including a camera application, the method includes: Display a first interface, which is the interface of the camera application, and the first interface includes shooting controls; In response to a first operation on the shooting control, an initial image is acquired, the first operation being used to instruct the camera application to capture an image via the camera; The first module performs a first process on the initial image in the background. During the first processing of the initial image, if it is detected that the camera application is still displaying its interface and any operation on the camera application's interface is detected, the first processing of the initial image is interrupted.

2. The method according to claim 1, characterized in that, The initial image includes a first image captured by the camera when the camera application receives the first operation, a Q-frame second image captured by the camera before the camera application receives the first operation, and / or a P-frame third image captured by the camera after the camera application receives the first operation, where Q and P are both positive integers greater than or equal to 1, and the first processing is a fusion processing that merges the first image, the Q-frame second image, and the P-frame third image.

3. The method according to claim 2, characterized in that, The first processing of the initial image in the background via the first module includes: Determine whether the system resource information at the current moment meets the first condition. The system resource information includes the temperature of the electronic device, the first storage space occupancy of the electronic device's memory, the second storage space occupancy of the memory when the central processing unit is running, and / or the third storage space occupancy of the memory when the graphics processor is running. The first condition includes the temperature being less than or equal to a temperature threshold, the first storage space occupancy being less than or equal to a first storage space threshold, the second storage space occupancy being less than or equal to a second storage space threshold, and / or the third storage space occupancy being less than or equal to a third storage space threshold. When it is determined that the system resources meet the first condition, the first module performs the first processing on the initial image in the background.

4. The method according to claim 3, characterized in that, The first processing of the initial image in the background via the first module includes: The image identifier of the initial image is recorded in the processing queue; In the background, the first module creates N first threads, and the N first threads perform the first processing on the N initial images associated with the N image identifiers in the processing queue.

5. The method according to claim 4, characterized in that, The interruption of the first processing of the initial image includes: A first termination flag is sent to the first algorithm, which is an algorithm executed by the first processing node. The first processing node includes the processing node of each of the N first threads. The first termination flag is used to terminate the operation of the first algorithm, which is the algorithm used by the first processing.

6. The method according to claim 4, characterized in that, The interruption of the first processing of the initial image includes: A second termination flag is sent to the first processing node, which includes the processing node for each of the N first threads. The second termination flag is used to terminate the operation of the N first threads.

7. The method according to any one of claims 4 to 6, characterized in that, The image identifier that records the initial image includes: The image identifier and image type of the initial image are recorded. The image identifier and the image type are associated. The image type includes a first type and a second type. The first type is used to indicate that the initial image was captured in portrait mode. If the initial image was captured in portrait mode, the first process includes a first sub-process and a second sub-process. The first sub-process is the fusion process, and the second sub-process is the processing using a first model algorithm. When the first model algorithm is running, the fourth storage space occupancy of the memory is greater than or equal to the fourth storage space threshold. The second type is used to indicate that the initial image was captured in non-portrait mode. If the initial image was captured in non-portrait mode, the first process includes a first sub-process. The method further includes: If it is detected that the camera application is still displaying its interface, and no operation is detected on the camera application's interface, then the N image identifiers in the processing queue are traversed. If the first identifier is encountered during traversal, it is determined whether the first module performs the first sub-processing on the fourth image in the background. The first identifier is any one of the image identifiers of the first type of the initial image among the N image identifiers in the processing queue. The fourth image is the initial image associated with the first identifier. When it is determined that the first module is performing the first sub-processing on the fourth image in the background, it is determined whether there is a first application running in the foreground. The first application is not the camera application. The first application is an application running using the second model algorithm. When the second model algorithm is running, the fifth storage space occupancy of the memory is greater than or equal to the fourth storage space threshold. If the first application is running in the foreground, interrupt the first processing of the fourth image.

8. The method according to claim 7, characterized in that, The method further includes: If the second identifier is encountered during traversal, it is determined whether the system resource information satisfies the first condition. The second identifier is any one of the N image identifiers in the processing queue that belongs to the second type of the initial image. When it is determined that the system resources do not meet the first condition, the first processing of the fifth image, which is the initial image associated with the second identifier, is interrupted.

9. The method according to claim 8, characterized in that, The step of interrupting the first processing of the fourth image when the first application is running in the foreground includes: When the first application is running in the foreground, the image identifier of the fourth image is recorded in the interrupt queue; When it is determined that the system resources do not meet the first condition, the first processing of the fifth image is interrupted, including: When it is determined that the system resources do not meet the first condition, the image identifier of the fifth image is recorded in the interrupt queue; The method further includes: When the process is completed, the first processing of the initial image associated with all image identifiers in the interruption queue is interrupted.

10. The method according to any one of claims 1 to 9, characterized in that, After acquiring an initial image in response to a first operation on the shooting control, the method further includes: Display a second interface, which is the display interface of the initial image in the gallery application; In response to a second operation on the initial image, the initial image is deleted, wherein the second operation is a deletion operation on the initial image; The first processing of the initial image in the background via the first module includes: If a second operation is received on the initial image during the first processing of the initial image, the first processing of the initial image is interrupted.

11. The method according to claim 10, characterized in that, The method further includes: If the second operation on the initial image is received before the first processing of the initial image, the initial image is deleted.

12. The method according to any one of claims 1 to 11, characterized in that, The first processing of the initial image in the background via the first module includes: If the number of processing failures during the first processing of the initial image is greater than or equal to a preset number, the initial image is deleted.

13. The method according to any one of claims 1 to 12, characterized in that, The step of acquiring an initial image in response to a first operation on the shooting control includes: In response to a first operation on the shooting control, the camera application sequentially sends multiple shooting requests to the camera, wherein the first operation is used to instruct the camera application to continuously capture images through the camera. Based on the multiple shooting requests, the camera sequentially captures multiple initial images and sequentially sends the multiple initial images to the camera application; The camera application receives the multiple initial images; When the first operation ends, if it is determined that the number of the plurality of shooting requests is greater than the number of the plurality of initial images received, the sixth image is deleted. The sixth image is the initial image corresponding to the shooting request that the camera application has sent to the camera but has not received when the first operation ends.

14. An electronic device, characterized in that, The electronic device includes: one or more processors, and a memory; the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 13.

15. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the one or more processors being used to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 13.

16. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1 to 13.