Image processing method and device
By creating virtual images in the image processing software to avoid image duplication, the problem of lagging and abnormal exit caused by excessive memory usage of the image processing software is solved, and more efficient memory management and storage resource saving are achieved.
Patent Information
- Application Number
- PCT/CN2024/078253
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-27
- Filing Date
- 2024-02-23
- Publication Date
- 2024-09-06
AI Technical Summary
Image processing software is prone to lags and abnormal exits during processing, mainly due to insufficient resources caused by excessive memory usage.
By creating a virtual image in the memory, the business party receives and processes instructions through the virtual image pointer, and directly processes the physical image, avoiding the copying of the image, thereby reducing memory usage, and realizing the processing of the physical image through virtual image management and processing instructions. Comprehensive judgment and prioritization.
It effectively reduces the memory and hard disk occupancy of image processing software, reduces the occurrence of lags and abnormal exits, reduces the development complexity and costs caused by changes in the number of business parties, and saves storage resources.
Smart Images

Figure CN2024078253_06092024_PF_FP
Abstract
Description
Image processing method and device
[0001] This application claims priority to Chinese Patent Application No. 202310189430.1 filed on February 27, 2023, and the contents of the above-mentioned Chinese patent application disclosure are hereby incorporated by reference in their entirety as a part of this application. Technical Field
[0002] The embodiments of the present disclosure relate to an image processing method and device. Background Art
[0003] With the rapid development of computer software, people can process images through image processing software. For example, photo editing software can perform image processing operations such as sharpening, adjusting brightness, adding filters, and blurring the background.
[0004] When image processing software processes an image, it is necessary to first load the image to be processed into the memory and perform the operations corresponding to the above-mentioned image processing operations to obtain a processed image; then, the processed image is rendered, and the processed image can also be stored in the memory for reuse.
[0005] However, the above image processing process has problems such as lag or even abnormal software exit.
[0006] Summary of the Invention
[0007] Embodiments of the present disclosure provide an image processing method and device, which can reduce the lag and abnormal exit of image processing software.
[0008] In a first aspect, an embodiment of the present disclosure provides an image processing method, the method comprising:
[0009] Create a virtual image based on the physical image in memory;
[0010] receiving an image processing instruction from a business party through the virtual image, wherein the business party holds a pointer to the virtual image;
[0011] In response to the image processing instruction, the physical image is processed by the virtual image.
[0012] In a second aspect, an embodiment of the present disclosure provides an image processing device, the device comprising:
[0013] A virtual image creation module, used to create a virtual image based on a physical image in memory;
[0014] An instruction receiving module, configured to receive an image processing instruction from a business party through the virtual image, wherein the business party holds a pointer to the virtual image;
[0015] An image processing module is configured to process the physical image through the virtual image in response to the image processing instruction.
[0016] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: at least one processor and a memory;
[0017] The memory stores computer-executable instructions;
[0018] The at least one processor executes the computer-executable instructions stored in the memory, so that the electronic device implements the method according to the first aspect.
[0019] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the computing device implements the method described in the first aspect.
[0020] In a fifth aspect, an embodiment of the present disclosure provides a computer program, which is used to implement the method described in the first aspect.
[0021] The disclosed embodiments provide an image processing method and device. The method includes: creating a virtual image based on a physical image in memory; receiving image processing instructions from a business party through the virtual image, with the business party holding a pointer to the virtual image; and processing the physical image through the virtual image in response to the image processing instructions. The disclosed embodiments can store a single physical image in memory, allowing different business parties to access the physical image through the virtual image without copying the image. This effectively reduces memory usage and reduces image processing software lags and unexpected exits. Furthermore, comprehensive judgment of the physical image is performed entirely by the virtual image. When adding a new business party, only that business party needs to hold the virtual image; when removing a business party, only that business party needs to stop holding the virtual image. Therefore, there is no need to modify the processing logic of the virtual image, reducing development complexity and costs caused by changes in the number of business parties. Furthermore, as the number of business parties increases, only the processing code for holding the virtual image needs to be added, reducing code usage on memory and hard disks, conserving storage resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, a brief introduction will be given below to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0023] FIG1 is a schematic diagram of an image processing scenario for multiple business parties;
[0024] FIG2 is a schematic diagram of another image processing scenario with multiple business parties;
[0025] FIG3 is a schematic diagram of an image processing scenario for multiple business parties provided by an embodiment of the present disclosure;
[0026] FIG4 is a flowchart of the steps of an image processing method provided by an embodiment of the present disclosure;
[0027] Figures 5 and 6 are schematic diagrams of two image processing processes;
[0028] FIG7 is a structural block diagram of an image processing device provided by an embodiment of the present disclosure; and
[0029] FIG8 is a structural block diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0031] The disclosed embodiment is applied to image processing software. FIG1 is a schematic diagram of an image processing scenario for multiple business parties. Referring to FIG1 , for an image P, multiple business parties need to process it. For example, business parties B1, B2, and B3 shown in FIG1 all need to process image P. Each business party B1, B2, and B3 needs to copy image P respectively to obtain images P1, P2, and P3 corresponding to each business party. In this way, each business party B1, B2, and B3 can process its own corresponding images P1, P2, and P3, so that multiple business parties can process image P at the same time.
[0032] The aforementioned business parties can be understood as software modules that need to process images. For example, business parties B1, B2, and B3 in Figure 1 can be the editing module, draft module, and network module of the image processing software, respectively. The editing module is used to edit images, the draft module is used to store images as drafts, and the network module is used to send images over the network.
[0033] However, the above solution causes multiple identical images to be stored in memory simultaneously, resulting in excessive memory usage, which can cause the image processing software to freeze or even exit unexpectedly due to insufficient memory. Furthermore, as more business parties are involved, the memory usage increases, making freezes and even abnormal exits more prominent.
[0034] Figure 2 illustrates another image processing scenario involving multiple business parties. As shown in Figure 2, business parties B1, B2, and B3 all directly access image P in memory, and any two business parties can sense each other to receive image processing instructions from each other. Each business party can receive image processing instructions from all other business parties and determine its own processing of image P based on these instructions, thus avoiding conflicts and duplication in processing the same image P.
[0035] It can be seen that the image processing scenario shown in Figure 2 above can prevent different business parties from copying the same image. There is always a copy of the image in the memory, which is equivalent to the original image P in Figure 1. It can effectively reduce the memory usage of the image and reduce freezes and abnormal exits.
[0036] In order to reduce the memory usage of images, the embodiments of the present disclosure refer to images actually stored in the memory or external storage as physical images. For example, images P, P1, P2, and P3 in Figure 1 are all physical images. Image P can be understood as the original image, and P1 to P3 can be understood as copied images. Based on this, a virtual image is created for the physical image. The virtual image points to the physical image and is used to process the physical image. Each business party needs to process the physical image while holding the virtual image. Therefore, there is only one physical image in the memory, which can greatly reduce the memory usage of the image, save memory, and thus reduce freezes and even abnormal exits.
[0037] Figure 3 is a schematic diagram of an image processing scenario for multiple business parties, provided by an embodiment of the present disclosure. As shown in Figure 3 , a virtual image points to a physical image. Business parties B1, B2, and B3 all hold virtual images. Thus, the virtual images can perform comprehensive judgments based on the image processing instructions from business parties B1, B2, and B3 to process the physical image. The physical image in Figure 3 can be understood as the original image P in Figure 1 . The present embodiment does not require copying the original image P, and thus, the present embodiment does not contain copied images P1, P2, and P3.
[0038] It can be seen that in the image processing scenario of multiple business parties shown in Figure 2, when adding or reducing business parties, it is necessary to adjust the processing logic of each business party so that any two business parties can perceive each other. However, in the embodiment of the present disclosure, the comprehensive judgment of physical images is implemented by virtual images. When adding a new business party, only the business party needs to hold the virtual image; when reducing a business party, the business party only needs to stop holding the virtual image. Therefore, there is no need to modify the processing logic of the virtual image, which can reduce the development complexity and cost caused by changes in the number of business parties.
[0039] Furthermore, in the image processing scenario with multiple business parties shown in Figure 2, increasing the number of business parties results in an increase in the amount of business party code, which significantly occupies memory, hard disk, and other storage resources, wasting storage resources. However, in the disclosed embodiment, as the number of business parties increases, only the processing code required to hold virtual images needs to be increased, reducing the memory and hard disk usage and conserving storage resources.
[0040] The following detailed description of the technical solutions of the embodiments of the present disclosure and how the technical solutions of the present disclosure solve the above-mentioned technical problems is provided with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The embodiments of the present disclosure will be described below in conjunction with the accompanying drawings.
[0041] Based on the image processing scenario shown in FIG3 above, FIG4 is a flowchart of the steps of an image processing method provided by an embodiment of the present disclosure. Referring to FIG4 , the image processing method includes:
[0042] S201: Creating a virtual image for a physical image in memory.
[0043] Specifically, the instance corresponding to the physical image can be input into the virtual image creation interface to obtain a virtual image. The virtual image can be understood as an instance used to uniformly process the physical image.
[0044] It should be noted that after the virtual image is created, the physical object can be processed through the virtual image or based on the virtual image. That is, when the business party needs to process the physical object, the virtual image is required to process the physical image.
[0045] S202: Receive an image processing instruction from a business party through a virtual image, and the business party holds a pointer to the virtual image.
[0046] The business party holding the pointer to the virtual image can be understood as the business party obtaining access to the virtual image. The business parties here can be business parties B1, B2, and B3, as shown in Figure 3. Image processing instructions are sent to these business parties to process the physical image. Image processing instructions from different business parties may be duplicate or conflicting. The virtual image can deduplicate and resolve these conflicts.
[0047] The embodiment of the present disclosure can realize the management and operation of physical images through virtual images, so the above-mentioned image processing instructions may include at least one of the following: a first instruction instructing to retain the physical image in the memory, a second instruction instructing to copy the physical image from the memory to the external memory and delete it from the memory, a third instruction instructing to copy the physical image from the external memory to the memory, and a fourth instruction instructing to edit the physical image.
[0048] Different business parties can send the same or different image processing instructions, allowing them to perform the same or different processing on the physical image. When a business party sends the first instruction, it indicates that the business party needs to use the physical image and therefore refuses to delete the physical image. When a business party sends the second instruction, it indicates that the business party no longer needs the physical image and therefore allows it to be deleted from memory. When a business party sends the third instruction, it indicates that the business party needs to use the physical image, but the physical image does not exist in memory and needs to copy the physical image from external storage.
[0049] It should be noted that image processing software edits images in the form of multiple layers, which will cause the physical images of multiple layers of the same original image to be stored in the memory. In image processing software, sticker layers can take up 2.4MB of memory. Filter layers, original image layers, map layers, etc. are related to their own resolution. As the resolution increases, it can even reach 4MB or even 64MB, which will result in a particularly large memory usage. For example, when entering the "original image room" such as portrait, gameplay, and background blur, according to business logic, all layers outside the original image will be hidden. At this time, the layers outside the original image are unnecessary physical images. The physical image can be moved from the memory to the external storage and the physical image in the memory can be deleted.
[0050] In addition, there will be some cached images in the memory, which will also cause excessive memory usage. Figure 5 is a schematic diagram of the image processing process. As shown in Figure 5, the input image P4 is the image to be processed. A certain layer of the input image P4 is processed in sequence by the filter units F1 and F2 to obtain the output image P5. In order to reduce the image calculation complexity and processing efficiency, the output image P5 can be cached and processed through the processing flow shown in Figure 6. As shown in Figure 6, the output image P5 of Figure 5 replaces the input image P4 in Figure 6, so that the layer of the output image P5 is used as the output image P6. The output image P6 here is the same as P5.
[0051] As can be seen, after executing the process shown in FIG5 once to obtain output image P5, output image P5 can be cached so that the next time output image P5 is needed, the process shown in FIG6 can be used. The process of FIG6 does not require a filtering unit, so the computational complexity is lower than that of FIG5, which can improve processing efficiency.
[0052] To address the memory usage issues associated with multiple layers, the disclosed embodiment can use the second instruction to move a layer's physical image from internal memory to an external storage device when it's no longer needed, saving memory. When the image is needed, a third instruction can be used to copy the image from the external storage device to internal memory, ensuring normal processing of the physical image by the business side.
[0053] It is understandable that since different business parties will not copy images in the memory, the memory occupancy of the physical image is reduced. Therefore, when the physical image is moved to the external memory through the second instruction, it will not cause the existence of a copied physical image in the external memory, which can reduce the storage space of the external memory.
[0054] In some examples, each business party corresponds to a control object. For example, the business parties B1, B2, and B3 shown in Figure 3 correspond to control objects C1, C2, and C3, respectively. Each business party can call the image processing interface through the corresponding control object to send image processing instructions to the virtual image. Correspondingly, the image processing instructions sent by the control object corresponding to the business party called the image processing interface are received through the virtual image. Therefore, different business parties can perform different processing logic on the image at different times through different control objects, and the independence of the business parties in processing the image can be achieved. However, these different control objects can share the same set of image processing interfaces to reduce the software code as much as possible on the basis of ensuring that the business party processing logics are independent of each other, saving the storage resources required for storing the software code.
[0055] S203: In response to the image processing instruction, the physical image is processed through the virtual image.
[0056] It can be understood that the virtual image can record all image processing instructions that have been performed by all business parties on the physical image, and receive all image processing instructions to be executed. Therefore, the virtual image can make a comprehensive judgment based on these image processing instructions to avoid instruction conflicts that may cause some business parties to process the physical image incorrectly.
[0057] For example, if business parties B1, B2, and B3 respectively send a first instruction to retain the physical image in memory, a second instruction to copy the physical image from memory to external storage and delete it from memory, and a third instruction to copy the physical image from external storage to memory to the virtual image, it can be seen that the first and third instructions conflict with the second instruction. In other words, business parties B1 and B3 need to store the physical image in memory because they need to process it, while business party B2 does not need to process the physical image and therefore wants to delete the physical image from memory. In this case, executing the second instruction will cause business parties B1 and B3 to fail to process the physical image.
[0058] When there is only one business party, there will be no conflict in the image processing instructions, and the virtual image can directly execute the image processing instructions of the business party. It can also be understood that the image processing instruction with the highest priority is the only image processing instruction.
[0059] When there are at least two business parties, there may be conflicts and / or duplications in image processing instructions. In this case, the image processing instruction with the highest priority is determined from the image processing instructions corresponding to the business parties using the virtual image; and the image processing instruction with the highest priority is executed on the physical image using the virtual image.
[0060] Specifically, priorities can be set in advance for all image processing operations supported by the image processing software. For example, the fourth instruction indicating editing the physical image has the highest priority, the first instruction indicating retaining the physical image in the memory has the second highest priority, the third instruction indicating copying the physical image from the external memory to the internal memory has the third highest priority, and the second instruction indicating copying the physical image from the internal memory to the external memory and deleting it from the internal memory has the lowest priority.
[0061] It can be understood that the priority can be determined according to whether the processing between image processing instructions affects each other. If the processing of the physical image by the first image processing instruction O1 affects the processing of the second image processing instruction O2, for example, after the execution of the first image processing instruction O1, it will cause the second image processing instruction O2 to have a processing error or even be unable to process the physical image, then the priority of the first image processing instruction O1 is higher than that of the second image processing instruction O2.
[0062] According to the above priority determination strategy, the priority order between any two image processing instructions can be determined. Therefore, the priority order of all image processing instructions can be used. The processing of the physical image by the image processing instruction with a higher priority will not affect the processing of the physical image by the image processing instruction with a lower priority, but the processing of the physical image by the image processing instruction with a lower priority will affect the processing of the physical image by the image processing instruction with a higher priority.
[0063] The embodiment of the present disclosure can determine the priority based on whether the processing between image processing instructions affects each other, so as to avoid the abnormal processing of physical images by the business party as much as possible on the basis of avoiding conflicts between image processing instructions.
[0064] Optionally, before determining the highest-priority image processing instruction, the virtual image may further deduplicate multiple received image processing instructions, determine the highest-priority image processing instruction based on the deduplicated image processing instructions, and execute the corresponding processing. In this way, the fewer image processing instructions are targeted when determining the highest-priority image processing instruction, the more efficient the determination of the highest-priority image processing instruction can be, thereby improving image processing efficiency.
[0065] In some implementations, the image processing instruction with the highest priority can be determined based on the situation where the image processing instructions of multiple business parties include a first instruction, a second instruction, and a third instruction. Specifically, there are three scenarios.
[0066] In the first scenario, if the image processing instructions corresponding to at least two business parties include the first instruction, the virtual image determines the first instruction as the highest-priority image processing instruction. In other words, if at least one business party requests to retain the physical image in memory, it means that the business party needs to use the physical image in memory. Deleting the physical image in memory will prevent the business party from using the physical image. Therefore, in this case, no matter what instructions are sent by the other business parties, the physical image cannot be deleted from memory.
[0067] In the second scenario, if the image processing instructions corresponding to at least two business parties include the second instruction but not the first instruction, the second instruction is determined as the highest-priority image processing instruction through the virtual image. In other words, all business parties request that the physical image in memory be deleted and moved to external storage, indicating that all business parties no longer use the physical image in memory, allowing the second instruction to be executed.
[0068] In the second scenario described above, the highest priority image processing instruction can be further determined in conjunction with preset deletion conditions. Specifically, if the image processing instructions corresponding to at least two business parties include the second instruction but not the first instruction, and the preset deletion conditions are met, the second instruction is determined as the highest priority image processing instruction through the virtual image. The preset deletion conditions include at least one of the following: the storage space size of the external memory is greater than or equal to the size of the physical image, and no other business parties hold pointers to the virtual image. The other business parties include business parties other than the business party that sent the image processing instruction.
[0069] The storage space size of the external memory is greater than or equal to the size of the physical image, which can ensure that the physical image is successfully stored in the external memory and avoid the business party being unable to process the physical image due to loss of the physical image.
[0070] In the case that the second business party does not hold a pointer to the virtual image, deleting the physical image from the memory can avoid the second business party holding a null pointer and causing code execution abnormality.
[0071] In the third scenario, the image processing instructions corresponding to at least two business parties include the third instruction. In this case, the third instruction is determined as the highest-priority image processing instruction through the virtual image. In other words, at least one business party requires the physical image to be copied from external storage to internal memory. This business party needs to use the physical image. In this case, the third instruction must be executed to ensure normal use of the image by the business party.
[0072] In some implementations, the disclosed embodiments can also delete physical images that are not used by all business parties from the memory and external storage. Specifically, first, the number of business parties holding the virtual image is sensed through the virtual image; then, it is determined whether the number of business parties is less than or equal to 0. If it is less than or equal to 0, the virtual image is used to determine that all business parties do not use the physical image corresponding to the virtual image. At this time, the physical image is deleted from the memory and external storage to further save storage resources and reduce the lag and abnormal exit of the image processing software; otherwise, the virtual image is used to determine that there is a business party using the physical image corresponding to the virtual image. At this time, the virtual image will not delete the physical image from the memory and external storage to avoid the failure of the business party's operation on the physical image.
[0073] Optionally, the virtual image can sense the number of business parties holding the virtual image by the following steps: when any business party starts holding the virtual image, the virtual image increases a counter corresponding to the number of business parties. When any business party stops holding the virtual image, the virtual image decreases the counter corresponding to the number of business parties.
[0074] When any business party starts to hold a virtual image, that is, when the business party references the virtual image, the virtual image can perceive the processing operation and thereby increase the counter. For example, if the counter is initially 0, the counter can be increased by 1. Conversely, if the business party stops holding the virtual image, that is, when the business party releases the reference to the virtual image, the virtual image can also perceive it and thereby decrease the counter. For example, the counter can be decreased by 1.
[0075] The disclosed embodiment can use a counter to sense the virtual image's holding status to accurately determine whether there is a business party using the physical image. If not, the memory and external storage occupied by the physical image can be released to minimize the image's storage resources, conserve storage resources, and reduce image processing software lags and abnormal exits. If so, the memory and external storage occupied by the physical image cannot be released to avoid failure in the execution of the business party's image processing instructions.
[0076] Of course, after the physical image is deleted from the memory and the disk, the virtual image corresponding to the physical image may also be deleted to further save storage resources.
[0077] Corresponding to the image processing method of the above embodiment, FIG7 is a structural block diagram of an image processing device provided by an embodiment of the present disclosure. For ease of explanation, only the parts related to the embodiment of the present disclosure are shown. Referring to FIG7, the above-mentioned image processing device 400 includes:
[0078] A virtual image creation module 401 is used to create a virtual image for a physical image in memory;
[0079] The instruction receiving module 402 is configured to receive an image processing instruction from a business party through the virtual image, where the business party holds a pointer to the virtual image.
[0080] The image processing module 403 is configured to process the physical image through the virtual image in response to the image processing instruction.
[0081] Optionally, when there are at least two business parties, the image processing module 403 is further configured to:
[0082] Determining, by using the virtual image, an image processing instruction with the highest priority from the image processing instructions corresponding to the business party;
[0083] The image processing instruction with the highest priority is executed on the physical image through the virtual image.
[0084] Optionally, the image processing instruction includes at least one of the following: a first instruction instructing to retain the physical image in the memory, a second instruction instructing to copy the physical image from the memory to an external memory and delete it from the memory, and a third instruction instructing to copy the physical image from the external memory to the memory.
[0085] Optionally, the image processing module 403 is further configured to:
[0086] If the image processing instructions corresponding to at least two of the business parties include the first instruction, the first instruction is determined as the image processing instruction with the highest priority through the virtual image.
[0087] Optionally, the image processing module 403 is further configured to:
[0088] If the image processing instructions corresponding to at least two of the business parties include the second instruction but do not include the first instruction, the second instruction is determined as the image processing instruction with the highest priority through the virtual image.
[0089] Optionally, the image processing module 403 is further configured to:
[0090] If the image processing instructions corresponding to at least two of the business parties include the third instruction, the third instruction is determined as the image processing instruction with the highest priority through the virtual image.
[0091] Optionally, the image processing module 403 is further configured to:
[0092] If the image processing instructions corresponding to at least two of the business parties include the second instruction but do not include the first instruction, and meet the preset deletion conditions, the second instruction is determined as the image processing instruction with the highest priority through the virtual image, and the preset deletion conditions include at least one of the following: the storage space size of the external memory is greater than or equal to the size of the physical image, there is no other business party holding a pointer to the virtual image, and the business parties include business parties other than the business party that sent the image processing instruction.
[0093] Optionally, it also includes:
[0094] A business party quantity sensing module, configured to sense the number of business parties holding the virtual image through the virtual image;
[0095] A physical image deletion module is configured to delete the physical image from the internal memory and the external storage via a virtual image if the number of the business parties is less than or equal to 0.
[0096] Optionally, the business party quantity perception module is further configured to:
[0097] When any business party starts to hold the virtual image, a counter corresponding to the number of business parties is increased through the virtual image;
[0098] When any business party stops holding the virtual image, the counter corresponding to the number of business parties is reduced through the virtual image.
[0099] Optionally, each of the business parties corresponds to a control object, and the instruction receiving module 402 is further configured to:
[0100] The image processing instruction sent by calling the image processing interface by the control object corresponding to the business party is received through the virtual image.
[0101] The image processing device provided in this embodiment can be used to execute the technical solution of the method embodiment shown in Figure 4 above. Its implementation principle and technical effects are similar and will not be described in detail in this embodiment.
[0102] FIG8 is a block diagram of an electronic device according to an embodiment of the present disclosure. The electronic device 600 includes a memory 602 and at least one processor 601.
[0103] The memory 602 stores computer-executable instructions.
[0104] At least one processor 601 executes the computer-executable instructions stored in the memory 602 , so that the electronic device 601 implements the method in FIG. 4 .
[0105] In addition, the electronic device may further include a receiver 603 and a transmitter 604. The receiver 603 is configured to receive information from other devices or equipment and forward it to the processor 601. The transmitter 604 is configured to send the information to the other devices or equipment.
[0106] In a first example of the first aspect, an embodiment of the present disclosure provides an image processing method, the method including:
[0107] Create a virtual image based on the physical image in memory;
[0108] receiving an image processing instruction from a business party through the virtual image, wherein the business party holds a pointer to the virtual image;
[0109] In response to the image processing instruction, the physical image is processed by the virtual image.
[0110] Based on the first example of the first aspect, in the second example of the first aspect, when there are at least two business parties, processing the physical image by using the virtual image includes:
[0111] Determining, by using the virtual image, an image processing instruction with the highest priority from the image processing instructions corresponding to the business party;
[0112] The image processing instruction with the highest priority is executed on the physical image through the virtual image.
[0113] Based on the second example of the first aspect, in the third example of the first aspect, the image processing instruction includes at least one of the following: a first instruction instructing to retain the physical image in the memory, a second instruction instructing to copy the physical image from the memory to an external memory and delete it from the memory, and a third instruction instructing to copy the physical image from the external memory to the memory.
[0114] Based on the third example of the first aspect, in the fourth example of the first aspect, determining, by using the virtual image, the image processing instruction with the highest priority from the image processing instructions corresponding to the business party includes:
[0115] If the image processing instructions corresponding to at least two of the business parties include the first instruction, the first instruction is determined as the image processing instruction with the highest priority through the virtual image.
[0116] Based on the third example of the first aspect, in the fifth example of the first aspect, determining, by using the virtual image, the image processing instruction with the highest priority from the image processing instructions corresponding to the business party includes:
[0117] If the image processing instructions corresponding to at least two of the business parties include the second instruction but do not include the first instruction, the second instruction is determined as the image processing instruction with the highest priority through the virtual image.
[0118] Based on the third example of the first aspect, in a sixth example of the first aspect, determining, by using the virtual image, an image processing instruction with the highest priority from the image processing instructions corresponding to the business party includes:
[0119] If the image processing instructions corresponding to at least two of the business parties include the third instruction, the third instruction is determined as the image processing instruction with the highest priority through the virtual image.
[0120] Based on the fifth example of the first aspect, in the seventh example of the first aspect, if the image processing instructions corresponding to at least two of the business parties include the second instruction but do not include the first instruction, determining, by using the virtual image, the second instruction as the image processing instruction with the highest priority includes:
[0121] If the image processing instructions corresponding to at least two of the business parties include the second instruction but do not include the first instruction, and meet the preset deletion conditions, the second instruction is determined as the image processing instruction with the highest priority through the virtual image, and the preset deletion conditions include at least one of the following: the storage space size of the external memory is greater than or equal to the size of the physical image, and there are no other business parties holding pointers to the virtual image, and the other business parties include business parties other than the business party that sent the image processing instruction.
[0122] Based on any one of the third to seventh examples of the first aspect, in an eighth example of the first aspect, the further comprising:
[0123] sensing the number of business parties holding the virtual image through the virtual image;
[0124] If the number of business parties is less than or equal to 0, the physical image is deleted from the internal memory and the external memory through the virtual image.
[0125] Based on the eighth example of the first aspect, in a ninth example of the first aspect, the sensing, through the virtual image, the number of business parties holding the virtual image includes:
[0126] When any business party starts to hold the virtual image, a counter corresponding to the number of business parties is increased by the virtual image;
[0127] When any business party stops holding the virtual image, the counter corresponding to the number of business parties is reduced by the virtual image.
[0128] Based on any one of the third to seventh examples of the first aspect, in a tenth example of the first aspect, each of the business parties corresponds to a control object, and receiving an image processing instruction from the business party through the virtual image includes:
[0129] In a first example of the second aspect, an image processing apparatus is provided, the apparatus comprising a virtual image, the virtual image comprising:
[0130] A virtual image creation module, used to create a virtual image based on a physical image in memory;
[0131] An instruction receiving module, configured to receive an image processing instruction from a business party through the virtual image, wherein the business party holds a pointer to the virtual image;
[0132] An image processing module is configured to process the physical image through the virtual image in response to the image processing instruction.
[0133] Based on the first example of the second aspect, in the second example of the second aspect, when there are at least two business parties, the image processing module is further configured to:
[0134] Determining, by using the virtual image, an image processing instruction with the highest priority from the image processing instructions corresponding to the business party;
[0135] The image processing instruction with the highest priority is executed on the physical image through the virtual image.
[0136] Based on the second example of the second aspect, in the third example of the second aspect, the image processing instruction includes at least one of the following: a first instruction instructing to retain the physical image in the memory, a second instruction instructing to copy the physical image from the memory to an external memory and delete it from the memory, and a third instruction instructing to copy the physical image from the external memory to the memory.
[0137] Based on the third example of the second aspect, in a fourth example of the second aspect, the image processing module is further configured to:
[0138] If the image processing instructions corresponding to at least two of the business parties include the first instruction, the first instruction is determined as the image processing instruction with the highest priority through the virtual image.
[0139] Based on the third example of the second aspect, in a fifth example of the second aspect, the image processing module is further configured to:
[0140] If the image processing instructions corresponding to at least two of the business parties include the second instruction but do not include the first instruction, the second instruction is determined as the image processing instruction with the highest priority through the virtual image.
[0141] Based on the third example of the second aspect, in a sixth example of the second aspect, the image processing module is further configured to:
[0142] If the image processing instructions corresponding to at least two of the business parties include the third instruction, the third instruction is determined as the image processing instruction with the highest priority through the virtual image.
[0143] Based on the fifth example of the second aspect, in a seventh example of the second aspect, the image processing module is further configured to:
[0144] If the image processing instructions corresponding to at least two of the business parties include the second instruction but do not include the first instruction, and meet the preset deletion conditions, the second instruction is determined as the image processing instruction with the highest priority through the virtual image, and the preset deletion conditions include at least one of the following: the storage space size of the external memory is greater than or equal to the size of the physical image, there is no other business party holding a pointer to the virtual image, and the business parties include business parties other than the business party that sent the image processing instruction.
[0145] Based on any one of the third to seventh examples of the second aspect, in an eighth example of the second aspect, the further comprising:
[0146] A business party quantity sensing module, configured to sense the number of business parties holding the virtual image through the virtual image;
[0147] A physical image deletion module is configured to delete the physical image from the internal memory and the external storage via a virtual image if the number of the business parties is less than or equal to 0.
[0148] Based on the eighth example of the second aspect, in a ninth example of the second aspect, the business party quantity perception module is further configured to:
[0149] When any business party starts to hold the virtual image, a counter corresponding to the number of business parties is increased through the virtual image;
[0150] When any business party stops holding the virtual image, the counter corresponding to the number of business parties is reduced through the virtual image.
[0151] Based on any one of the third to seventh examples of the second aspect, in a tenth example of the second aspect, each of the business parties corresponds to a control object, and the instruction receiving module is further configured to:
[0152] The image processing instruction sent by calling the image processing interface by the control object corresponding to the business party is received through the virtual image.
[0153] In a third aspect, according to one or more embodiments of the present disclosure, an electronic device is provided, comprising: at least one processor and a memory.
[0154] The memory stores computer-executable instructions.
[0155] The at least one processor executes the computer-executable instructions stored in the memory, so that the electronic device implements the method according to any one of the first aspects.
[0156] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the computing device implements the method described in any one of the first aspects.
[0157] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program is provided, wherein the computer program is used to implement the method described in any one of the first aspects.
[0158] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0159] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0160] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. An image processing method, comprising: Create a virtual image for the physical image in memory; Receiving an image processing instruction from a business party through the virtual image, wherein the business party holds a pointer to the virtual image; In response to the image processing instruction, the physical image is processed by the virtual image.
2. The method according to claim 1, wherein: When there are at least two business parties, the processing of the physical image by using the virtual image includes: Determine, by using the virtual image, an image processing instruction with the highest priority from the image processing instructions corresponding to the business party; The image processing instruction with the highest priority is executed on the physical image through the virtual image.
3. The method according to claim 2, wherein: The image processing instruction includes at least one of the following: a first instruction instructing to retain the physical image in the memory, a second instruction instructing to copy the physical image from the memory to an external memory and delete it from the memory, and a third instruction instructing to copy the physical image from the external memory to the memory.
4. The method according to claim 3, wherein: The determining, by using the virtual image, an image processing instruction with the highest priority from the image processing instructions corresponding to the business party includes: If the image processing instructions corresponding to at least two of the business parties include the first instruction, the first instruction is determined as the image processing instruction with the highest priority through the virtual image.
5. The method according to claim 3, wherein: The determining, by using the virtual image, an image processing instruction with the highest priority from the image processing instructions corresponding to the business party includes: If the image processing instructions corresponding to at least two of the business parties include the second instruction but do not include the first instruction, the second instruction is determined as the image processing instruction with the highest priority through the virtual image.
6. The method according to claim 3, wherein: The determining, by using the virtual image, an image processing instruction with the highest priority from the image processing instructions corresponding to the business party includes: If the image processing instructions corresponding to at least two of the business parties include the third instruction, the third instruction is determined as the image processing instruction with the highest priority through the virtual image.
7. The method according to claim 5, wherein: If the image processing instructions corresponding to at least two of the business parties include the second instruction but do not include the first instruction, determining the second instruction as the image processing instruction with the highest priority through the virtual image includes: If the image processing instructions corresponding to at least two of the business parties include the second instruction but do not include the first instruction, and meet the preset deletion conditions, the second instruction is determined as the image processing instruction with the highest priority through the virtual image, and the preset deletion conditions include at least one of the following: the storage space size of the external memory is greater than or equal to the size of the physical image, and there are no other business parties holding pointers to the virtual image, and the other business parties include business parties other than the business party that sends the image processing instruction.
8. The method according to any one of claims 3 to 7, further comprising: sensing the number of business parties holding the virtual image through the virtual image; If the number of business parties is less than or equal to 0, the physical image is deleted from the internal memory and the external memory through the virtual image.
9. The method according to claim 8, wherein: The sensing, through the virtual image, of the number of business parties holding the virtual image includes: When any business party starts to hold the virtual image, a counter corresponding to the number of business parties is increased through the virtual image; When any business party stops holding the virtual image, the counter corresponding to the number of business parties is reduced by the virtual image.
10. The method according to any one of claims 3 to 9, wherein: Each of the business parties corresponds to a control object, and the receiving of an image processing instruction from the business party through the virtual image includes: The image processing instruction sent by calling the image processing interface by the control object corresponding to the business party is received through the virtual image.
11. An image processing device, comprising: A virtual image creation module, configured to create a virtual image for a physical image in memory; an instruction receiving module, configured to receive an image processing instruction from a business party through the virtual image, wherein the business party holds a pointer to the virtual image; The image processing module is configured to process the physical image through the virtual image in response to the image processing instruction.
12. An electronic device comprising at least one processor and a memory, wherein: The memory is configured to store computer-executable instructions; When the at least one processor executes the computer-executable instructions stored in the memory, the electronic device implements the image processing method according to any one of claims 1 to 10.
13. A computer-readable storage medium, wherein: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the computing device implements the image processing method according to any one of claims 1 to 10.
Citation Information
Patent Citations
System and method for migration of data clones
CN103620580A
Virtual point in time access between snapshots
CN106021016A
Camera resource access method, operating system, terminal and virtual camera
CN112749022A
Display device and data sharing method
CN114302199A
Data storage method and device
CN115034953A
