Image processing method, device, equipment and medium
By filtering out irrelevant layers and obtaining the background layer when taking screenshots on the terminal device, the problem of low efficiency and low purity of full-screen screenshots is solved, achieving more efficient and clearer screenshot generation.
Patent Information
- Application Number
- CN202111617552.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-12-27
AI Technical Summary
The screenshot method of existing terminal devices is full-screen screenshot, which results in low screenshot efficiency and low purity. Especially when it is necessary to intercept part of the content in the interface, irrelevant content such as the system status bar and volume bar affects the purity and efficiency of the screenshot.
By filtering out irrelevant layers when taking screenshots, obtaining the corresponding background layer based on the transparency of the target layer, and generating screenshots, the purity and efficiency of the screenshots can be improved and the recognizability of the content can be ensured.
On the basis of improving the purity and efficiency of screenshots, the computing power consumption of screenshot generation is reduced, ensuring the recognizability of screenshot content.
Smart Images

Figure CN114332324B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to an image processing method, device, equipment and medium. Background Art
[0002] With the popularization of terminal devices such as smart phones, the function of taking screenshots on terminals has also become common. For example, you can take screenshots of documents on your mobile phone.
[0003] In the related art, the terminal device screenshot mode is full-screen screenshot, that is, Figure 1 As shown, if the interface currently displayed on the terminal device is a bilingual document, all the contents on the document interface will be screenshoted.
[0004] However, in many application scenarios, only a part of the content in the interface currently displayed on the terminal device is needed. The full-screen screenshot method not only affects the purity of the screenshot, but also slows down the efficiency of the screenshot. Figure 1 For the document shown, only the text part is needed. Other content such as the system status bar, volume bar, floating ball, etc. are irrelevant, which affects the purity of the screenshot and slows down the efficiency of the screenshot. Summary of the invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides an image processing method, device, equipment and medium, which filter out irrelevant layers when taking screenshots, and obtain corresponding background layers based on the transparency of relevant layers to jointly generate screenshots, thereby improving the purity and efficiency of the screenshots and ensuring the recognizability of the content in the screenshots.
[0006] An embodiment of the present disclosure provides an image processing method, the method comprising: determining a target layer from multiple candidate layers of a current application interface according to a preset layer screening condition, and acquiring first rendering data of the target layer; acquiring transparency information of the target layer, and determining whether the transparency information satisfies a preset background layer adding condition; if the background layer adding condition is satisfied, acquiring second rendering data of the background layer in the multiple candidate layers; and generating a target screenshot of the target layer according to the second rendering data and the first rendering data.
[0007] The disclosed embodiment also provides an image processing device, which includes: a determination module, used to determine a target layer from multiple candidate layers of a current application interface according to a preset layer screening condition; a first acquisition module, used to acquire first rendering data of the target layer; a judgment module, used to acquire transparency information of the target layer according to the first rendering data, and judge whether the transparency information satisfies a preset background layer adding condition; a second acquisition module, used to acquire second rendering data of the background layer from the multiple candidate layers when the background layer adding condition is met; and a generation module, used to generate a target screenshot of the target layer according to the second rendering data and the first rendering data.
[0008] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the image processing method provided by the embodiment of the present disclosure.
[0009] The embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the image processing method provided by the embodiment of the present disclosure.
[0010] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0011] The screenshot processing solution provided by the embodiment of the present disclosure determines the target layer from multiple candidate layers of the current application interface according to the preset layer screening conditions, and obtains the first rendering data of the target layer, and then obtains the transparency information of the target layer, and determines whether the transparency information meets the preset background layer adding conditions. If the background layer adding conditions are met, the second rendering data of the background layer in the multiple candidate layers is obtained, and the target screenshot of the target layer is generated according to the second rendering data and the first rendering data. In this way, irrelevant layers are screened out when taking screenshots, and the corresponding background layers are obtained based on the transparency of the relevant layers to jointly generate screenshots. On the basis of improving the purity and generation efficiency of the screenshots, the identifiability of the content in the screenshots is guaranteed, and the computing power consumption of screenshot generation is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0013] Figure 1 A schematic diagram of a screenshot scene in the prior art provided in an embodiment of the present disclosure;
[0014] Figure 2 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0015] Figure 3 A schematic diagram of a screenshot scenario provided in an embodiment of the present disclosure;
[0016] Figure 4 A schematic diagram of another screenshot scenario provided in an embodiment of the present disclosure;
[0017] Figure 5 A schematic diagram of another screenshot scenario provided in an embodiment of the present disclosure;
[0018] Figure 6 A schematic diagram of another screenshot scenario provided in an embodiment of the present disclosure;
[0019] Figure 7 A schematic diagram of another screenshot scenario provided in an embodiment of the present disclosure;
[0020] Figure 8 A flowchart of another image processing method provided by an embodiment of the present disclosure;
[0021] Fig. 9 A flowchart of another image processing method provided by an embodiment of the present disclosure;
[0022] Fig.10 A schematic diagram of the structure of an image processing device provided by an embodiment of the present disclosure;
[0023] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0024] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0025] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0026] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0027] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0028] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0029] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0030] In order to solve the problem that the screenshot method in the above-mentioned terminal device is full-screen screenshot, which leads to slow screenshot efficiency and low purity of the screenshot, the embodiment of the present disclosure provides an image processing method, in which only the content required for the screenshot can be automatically screenshoted. While improving the purity of the screenshot, the efficiency of the screenshot is also improved due to the reduction of the amount of screenshot data.
[0031] The method is introduced below in conjunction with specific embodiments.
[0032] Figure 2 The following is a flow chart of an image processing method provided by an embodiment of the present disclosure. The method can be executed by an image processing device, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 2 As shown, the method includes:
[0033] Step 201: determine a target layer from a plurality of candidate layers of the current application interface according to a preset layer screening condition, and obtain first rendering data of the target layer.
[0034] It should be noted that if Figure 3As shown, the interface visually seen on the current application interface is actually composed of multiple layers superimposed on each other. Therefore, each layer corresponds to the Surface corresponding to each window in the application. It can be understood that the content corresponding to the screenshot is only displayed in one or more layers. Therefore, in the embodiments of the present disclosure, in order to reduce the amount of screenshot data, the target layer is determined from the multiple candidate layers of the current application interface. The target layer can be understood as the layer containing the screenshot content, and other irrelevant layers are screened.
[0035] It should be noted that in different application scenarios, the preset layer screening conditions for determining the target layer from multiple candidate layers in the current application interface are different, as shown in the following examples:
[0036] In one embodiment of the present disclosure, considering that the layer where the content corresponding to the screenshot is located can be roughly determined according to the screenshot scene, in this embodiment, the target layer is determined based on the layer identifier, wherein the layer identifier can be any layer information in the application interface that can uniquely identify the current application, including but not limited to the layer name, layer type, etc.
[0037] In this embodiment, the layer identifier of each candidate layer on the current application interface is obtained, and then the layer identifier is matched with the preset layer identifier of the target application, and the candidate layer corresponding to the successfully matched layer identifier is determined as the target layer.
[0038] Among them, the preset layer identifier is pre-set according to the scene requirements, or it can be pre-specified by the user. In some possible implementations, if the screenshot scene is optical character recognition (OCR), then according to big data, the layer identifier of the layer where the corresponding text content is located may be the layer type: TYPE_BASE_APPLICATION. Therefore, the candidate layer with the layer type of TYPE_BASE_APPLICATION can be screened out as the target layer.
[0039] In another embodiment of the present disclosure, in order to improve the user's sense of participation, layer description information can be set in advance for each layer, and the layer description information is used to indicate the approximate content of each layer. For example, the layer description information can be "text display layer", "status bar display layer", etc. Figure 4 As shown, multiple layer description information of multiple candidate layers in the current application interface is displayed to the user in a pop-up window or the like, and the candidate layer corresponding to the layer description information triggered by the user is determined as the target layer.
[0040] Furthermore, since the final image of each layer is rendered based on rendering data such as content elements, element size, position information, etc., in this embodiment, in order to finally obtain a screenshot corresponding to the target layer, the first rendering data of the target layer is also obtained, wherein the first rendering data includes the above-mentioned content elements, element size, position information, rendering area, etc.
[0041] In one embodiment of the present disclosure, if the application uses software tools such as SurfaceFlinger to combine all layers together and display them on the screen, the preset cache location corresponding to the first rendering data can be determined according to the rendering logic of SurfaceFlinger, and the first rendering data of the target layer can be read from the preset cache location.
[0042] In another embodiment of the present disclosure, the underlying code corresponding to the target layer may also be extracted, and the corresponding first rendering data may be obtained based on the underlying code.
[0043] Step 202, obtaining transparency information of the target layer, and determining whether the transparency information satisfies a preset background layer adding condition.
[0044] It should be understood that if only the target layer is screenshoted and other screenshots are filtered out, the screenshot may not be clear, thus failing to meet scene requirements such as OCR recognition of the target layer. The clarity is related to the transparency information of the target layer.
[0045] For example, if Figure 2 If the English document shown has a high transparency, the alpha channel corresponding to the target layer may be removed due to the compression method used by the terminal device when taking screenshots, causing the transparent area to be filled with black. As a result, the screenshot corresponding to the target layer may be Figure 5 As shown, the black text part and the filled black area are merged together, making them unrecognizable.
[0046] For example, Figure 6 As shown, when the colors of the content elements and background elements in the target layer are close (different colors are represented by grayscale in the figure), in order to enhance the contrast between the content elements and the background elements when displaying the current application interface, the background elements are set to be semi-transparent, and the other colors of the layers under the target layer are allowed to pass through the semi-transparent background area. If only the target layer is screenshoted, it is obviously impossible to clearly distinguish the content elements and background elements in the target layer.
[0047] Therefore, in an embodiment of the present disclosure, in order to ensure the identifiability of the relevant content in the target layer, the transparency information of the target layer is obtained, the transparency information includes arbitrary information indicating the degree of transparency of the background area of the target layer, and it is determined whether the transparency information satisfies a preset background layer adding condition, wherein the preset background layer adding condition is used to determine whether only taking a screenshot of the target layer has the risk of unclear content display.
[0048] In different application scenarios, the methods for determining the transparency information of the target layer are different. In some possible embodiments, the corresponding transparency information can be extracted from the first rendering data; in other possible embodiments, the layer identifier of the target layer can be obtained, and the preset database can be queried based on the layer representation to obtain the corresponding transparency information.
[0049] Step 203: if the background layer adding condition is met, the second rendering data of the background layer in the plurality of candidate layers is obtained.
[0050] In this embodiment, if the conditions for adding a background layer are met, it means that only screenshotting the target layer has the risk of unclear content display. Therefore, second rendering data of the background layer among multiple candidate layers is obtained, and the second rendering data includes content elements, element size, color, etc. in the background layer. Among them, the background layer can be determined according to the layer type, etc. For example, the layer with a layer type of wallpaer layer is determined to be the background layer. For another example, the layer adjacent to the target layer is determined to be the background layer. The background layer can be one or more, and the adjacent layers can be all adjacent or partially adjacent.
[0051] Step 204: Generate a target screenshot of the target layer according to the second rendering data and the first rendering data.
[0052] In this embodiment, a target screenshot of the target layer is jointly generated based on the second rendering data and the first rendering data. In some possible embodiments, a candidate screenshot of the target layer is generated based on the first rendering data, and then a background layer is rendered at the bottom of the candidate screenshot based on the second rendering data to generate the target screenshot. When there are multiple background layers, they can be rendered in the order on the current application interface.
[0053] In some other possible embodiments, a candidate screenshot of the target layer is generated according to the first rendering data, and then a target screenshot is generated according to the second rendering data, and the target screenshot and the candidate screenshot are superimposed to generate the target screenshot.
[0054] Therefore, on the one hand, screenshots are generated only based on the target layer and the background layer. Compared with the original solution of generating screenshots for all layers, the amount of data generated for the screenshots is reduced, thereby improving the screenshot efficiency. On the other hand, the corresponding background layer is selected according to the transparency information of the target layer, and the screenshot is generated together with the background layer, thereby ensuring the recognizability of the screenshot.
[0055] For example, continuing with Figure 6 Take the scenario shown as an example, Figure 7 As shown, when the colors of the content elements and background elements in the target layer are close (different colors are represented by grayscale in the figure), when displaying the current application interface, in order to enhance the contrast between the content elements and the background elements, after determining the background layer of the target layer, a screenshot is generated based on the target layer and the background layer, and the generated screenshot is clearer.
[0056] In another embodiment of the present disclosure, if the background layer adding condition is not met, it indicates that only screenshotting the target layer does not have the hidden danger of unclear content display. Therefore, in order to further improve the efficiency of screenshot generation, only the target screenshot of the target layer is generated according to the first rendering data.
[0057] In the actual execution process, a screenshot generation tool GraphicBuffer can be created according to the screenshot needs. After screening out the target layer from multiple candidate layers, the first rendering data of the target layer is obtained, and the rendering area, color, etc. of the target layer are configured according to the first rendering data. The target layer is rendered into GraphicBuffer to generate a target screenshot.
[0058] Generating a target screenshot based on the first rendering data and the second rendering data may also be achieved through GraphicBuffer, which will not be described in detail here.
[0059] In summary, the image processing method of the disclosed embodiment determines the target layer from multiple candidate layers of the current application interface according to the preset layer screening conditions, and obtains the first rendering data of the target layer. Then, the transparency information of the target layer is obtained according to the first rendering data, and it is determined whether the transparency information satisfies the preset background layer adding conditions. If the background layer adding conditions are met, the second rendering data of the background layer in the multiple candidate layers is obtained, and a target screenshot of the target layer is generated according to the second rendering data and the first rendering data. Thus, irrelevant layers are screened out when taking screenshots, and the corresponding background layers are obtained based on the transparency of the relevant layers to jointly generate screenshots. On the basis of improving the purity and generation efficiency of the screenshots, the recognizability of the content in the screenshots is guaranteed, and the computing power consumption of screenshot generation is reduced.
[0060] Based on the above embodiments, in actual operation, according to different application scenarios, the methods for determining whether the transparency information meets the preset background layer adding conditions are different, and the examples are as follows:
[0061] In one embodiment of the present disclosure, Figure 8 As shown, judging whether the transparency information meets the preset background layer adding conditions includes:
[0062] Step 801, determining the layer transparency of the target layer according to the transparency information.
[0063] In this embodiment, the transparency of each pixel in the background area of the target layer can be determined according to the transparency information, and then the average transparency of all pixels is calculated as the layer transparency of the target layer.
[0064] Step 802, determining whether the layer transparency is greater than a preset transparency threshold, wherein if it is greater than the preset transparency threshold, it is determined that the background layer adding condition is met.
[0065] Among them, the preset transparency threshold is calibrated according to experimental data to determine whether the layer transparency is less than the preset transparency threshold. If it is greater than the preset transparency threshold, it indicates that the target layer may be relatively transparent, which may cause the content in the target layer to be unclear when taking a screenshot. Therefore, it is determined that the target layer meets the conditions for adding a background layer.
[0066] In one embodiment of the present disclosure, Fig. 9 As shown, judging whether the transparency information meets the preset background layer adding conditions includes:
[0067] Step 901, determining the transparent area of the target layer according to the transparency information.
[0068] In this embodiment, the transparency value of each pixel in the target layer can be determined based on the transparency information, and it can be judged whether the transparency value of each pixel is greater than a preset value, wherein the preset value is calibrated based on experimental data, and pixels with transparency values greater than the preset value are determined to be transparent pixels, and the area connected by the transparent pixels is determined to be a transparent area.
[0069] Step 902, calculating a first area of the transparent region and determining a second area of the target layer.
[0070] Step 903: Calculate the area ratio of the first area to the second area.
[0071] In this embodiment, the first area of the transparent area is calculated, and the second area of the target layer is determined. The area ratio of the first area to the second area is calculated, and the area ratio represents the distribution of the transparent area in the target layer.
[0072] Step 904, determining whether the area ratio is greater than a preset ratio threshold, wherein if it is greater than the preset ratio threshold, it is determined that the background layer adding condition is met.
[0073] In this embodiment, it is determined whether the area ratio is greater than a preset ratio threshold, wherein the preset ratio threshold is calibrated based on experimental data. If it is greater than the preset ratio threshold, it indicates that there are more transparent areas in the target layer. If all of them are filled with black when taking a screenshot, it may cause difficulty in identifying the target layer. Therefore, it is determined that the conditions for adding a background layer are met. Conversely, if the area ratio is not greater than the preset ratio threshold, it indicates that there are fewer transparent areas in the target layer. If all of them are filled with black when taking a screenshot, it may not cause difficulty in identifying the target layer. Therefore, it is determined that the conditions for adding a background layer are not met.
[0074] In this embodiment, in order to further avoid misjudgment, after determining that the cross-sectional area ratio is not greater than the preset ratio threshold, it is not directly considered that the background layer adding condition is not met. The distance between the edge of the transparent area and the edge of the content area in the target layer can also be calculated (the content element is binarized to obtain the corresponding content area, etc.). If the ratio of the area of the transparent area with a distance greater than or equal to 0 to the total area of all transparent areas is greater than the preset threshold, it is considered that even if the transparent area is filled with black, it is at a distance from the content element and therefore does not affect the recognition of the content. Therefore, it is considered that the target layer does not meet the background layer adding condition.
[0075] In summary, the image processing method of the embodiment of the present disclosure can use different methods to determine whether the transparency information meets the preset background layer adding conditions in different scenarios, thereby improving the flexibility of determining whether to add a background layer.
[0076] In order to implement the above embodiments, the present disclosure also proposes an image processing device. Fig.10 is a schematic diagram of the structure of an image processing device according to an embodiment of the present disclosure. Fig.10 As shown, the image processing device includes: a determination module 1010, a first acquisition module 1020, a judgment module 1030, a second acquisition module 1040 and a generation module 1050, wherein the determination module 1010 is used to determine a target layer from multiple candidate layers of the current application interface according to a preset layer screening condition;
[0077] A first acquisition module 1020, used to acquire first rendering data of a target layer;
[0078] The determination module 1030 is used to obtain the transparency information of the target layer and determine whether the transparency information meets the preset background layer adding condition;
[0079] The second acquisition module 1040 is used to acquire second rendering data of the background layer from the plurality of candidate layers when the background layer adding condition is met;
[0080] The generating module 1050 is configured to generate a target screenshot of a target layer according to the second rendering data and the first rendering data.
[0081] The image processing device provided in the embodiments of the present disclosure can execute the image processing method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0082] In order to implement the above embodiments, the present disclosure also proposes a computer program product, including a computer program / instruction, which implements the image processing method in the above embodiments when executed by a processor. The implementation principle is similar and will not be repeated here.
[0083] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure.
[0084] The following specific reference Fig.11 , which shows a schematic diagram of the structure of an electronic device 1100 suitable for implementing the embodiment of the present disclosure. The electronic device 1100 in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.11 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0085] like Fig.11 As shown, the electronic device 1100 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage device 1108 to a random access memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the electronic device 1100 are also stored. The processing device 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0086] Typically, the following devices may be connected to the I / O interface 1105: an input device 1106 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1107 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1108 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1109. The communication device 1109 may allow the electronic device 1100 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.11 The electronic device 1100 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0087] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 1109, or installed from a storage device 1108, or installed from a ROM 1102. When the computer program is executed by the processing device 1101, the above-mentioned functions defined in the image processing method of the embodiment of the present disclosure are executed.
[0088] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0089] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0090] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0091] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0092] According to the preset layer screening conditions, the target layer is determined from the multiple candidate layers of the current application interface, and the first rendering data of the target layer is obtained. Then, the transparency information of the target layer is obtained, and it is determined whether the transparency information meets the preset background layer adding conditions. If the background layer adding conditions are met, the second rendering data of the background layer in the multiple candidate layers is obtained, and the target screenshot of the target layer is generated according to the second rendering data and the first rendering data. In this way, irrelevant layers are screened out when taking screenshots, and the corresponding background layers are obtained based on the transparency of the relevant layers to jointly generate screenshots. On the basis of improving the purity and generation efficiency of the screenshots, the identifiability of the content in the screenshots is guaranteed, and the computing power consumption of screenshot generation is reduced.
[0093] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0094] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0095] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0096] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0097] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0098] According to one or more embodiments of the present disclosure, the present disclosure provides an image processing method, comprising: determining a target layer from a plurality of candidate layers of a current application interface according to a preset layer screening condition, and acquiring first rendering data of the target layer;
[0099] Obtaining transparency information of the target layer, and determining whether the transparency information satisfies a preset background layer adding condition;
[0100] If the background layer adding condition is met, obtaining second rendering data of the background layer in the multiple candidate layers;
[0101] A target screenshot of the target layer is generated according to the second rendering data and the first rendering data.
[0102] According to one or more embodiments of the present disclosure, in the image processing method provided by the present disclosure, determining the target layer from multiple candidate layers of the current application interface according to a preset layer screening condition includes:
[0103] Obtaining a layer identifier of each candidate layer;
[0104] The layer identifier is matched with a preset layer identifier of the target application, and the candidate layer corresponding to the successfully matched layer identifier is determined to be the target layer.
[0105] According to one or more embodiments of the present disclosure, in the image processing method provided by the present disclosure, the layer identification includes:
[0106] At least one of layer name and layer type.
[0107] According to one or more embodiments of the present disclosure, in the image processing method provided by the present disclosure, the step of obtaining the first rendering data of the target layer includes:
[0108] Obtaining a preset cache location of the first rendering data;
[0109] The first rendering data of the target layer is read in the preset cache location.
[0110] According to one or more embodiments of the present disclosure, in the image processing method provided by the present disclosure, the step of determining whether the transparency information satisfies a preset background layer adding condition includes:
[0111] Determine the layer transparency of the target layer according to the transparency information;
[0112] It is determined whether the transparency of the layer is greater than a preset transparency threshold, wherein if it is greater than the preset transparency threshold, it is determined that the background layer adding condition is met.
[0113] According to one or more embodiments of the present disclosure, in the image processing method provided by the present disclosure, the step of determining whether the transparency information satisfies a preset background layer adding condition includes:
[0114] Determine the transparent area of the target layer according to the transparency information;
[0115] Calculating a first area of the transparent area and determining a second area of the target layer;
[0116] calculating an area ratio of the first area to the second area;
[0117] It is determined whether the area ratio is greater than a preset ratio threshold, wherein if it is greater than the preset ratio threshold, it is determined that the background layer adding condition is met.
[0118] According to one or more embodiments of the present disclosure, in the image processing method provided by the present disclosure, generating a target screenshot of the target layer according to the second rendering data and the first rendering data includes:
[0119] generating a candidate screenshot of the target layer according to the first rendering data;
[0120] Generate the Beijing layer according to the second rendering data;
[0121] The target screenshot is generated according to the background layer and the candidate screenshots.
[0122] According to one or more embodiments of the present disclosure, in the image processing method provided by the present disclosure, after determining whether the transparency information satisfies a preset background layer adding condition, the method further includes:
[0123] If the background layer adding condition is not met, a target screenshot of the target layer is generated according to the first rendering data.
[0124] According to one or more embodiments of the present disclosure, the present disclosure provides an image processing device, including:
[0125] A determination module, used to determine a target layer from multiple candidate layers in the current application interface according to a preset layer screening condition;
[0126] A first acquisition module, used to acquire first rendering data of the target layer;
[0127] A judgment module, used for obtaining transparency information of the target layer and judging whether the transparency information satisfies a preset background layer adding condition;
[0128] A second acquisition module, configured to acquire second rendering data of a background layer from among the plurality of candidate layers when the background layer adding condition is met;
[0129] A generating module is used to generate a target screenshot of the target layer according to the second rendering data and the first rendering data.
[0130] According to one or more embodiments of the present disclosure, in the image processing device provided by the present disclosure, the determining module is specifically used to:
[0131] Obtaining a layer identifier of each candidate layer;
[0132] The layer identifier is matched with a preset layer identifier of the target application, and the candidate layer corresponding to the successfully matched layer identifier is determined to be the target layer.
[0133] According to one or more embodiments of the present disclosure, in the image processing device provided by the present disclosure, the layer identification includes:
[0134] At least one of layer name and layer type.
[0135] According to one or more embodiments of the present disclosure, in the image processing device provided by the present disclosure, the first acquisition module is specifically used to: acquire a preset cache location of the first rendering data;
[0136] The first rendering data of the target layer is read in the preset cache location.
[0137] According to one or more embodiments of the present disclosure, in the image processing device provided by the present disclosure, the determination module is used to:
[0138] Determine the layer transparency of the target layer according to the transparency information;
[0139] It is determined whether the transparency of the layer is greater than a preset transparency threshold, wherein if it is greater than the preset transparency threshold, it is determined that the background layer adding condition is met.
[0140] According to one or more embodiments of the present disclosure, in the image processing device provided by the present disclosure, the determination module is used to:
[0141] Determine the transparent area of the target layer according to the transparency information;
[0142] Calculating a first area of the transparent area and determining a second area of the target layer;
[0143] calculating an area ratio of the first area to the second area;
[0144] It is determined whether the area ratio is greater than a preset ratio threshold, wherein if it is greater than the preset ratio threshold, it is determined that the background layer adding condition is met.
[0145] According to one or more embodiments of the present disclosure, in the image processing device provided by the present disclosure, the generating module is used to:
[0146] generating a candidate screenshot of the target layer according to the first rendering data;
[0147] The background layer is generated according to the second rendering data; and the target screenshot is generated according to the background layer and the candidate screenshots.
[0148] According to one or more embodiments of the present disclosure, in the image processing device provided by the present disclosure, the generating module is further used for:
[0149] When the background layer adding condition is not met, a target screenshot of the target layer is generated according to the first rendering data.
[0150] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, including:
[0151] processor;
[0152] a memory for storing instructions executable by the processor;
[0153] The processor is used to read the executable instructions from the memory and execute the instructions to implement any image processing method provided in the present disclosure.
[0154] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute any image processing method as provided by the present disclosure.
[0155] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. 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 a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0156] 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 are 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.
[0157] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. An image processing method, It is characterized in that The following steps are involved: According to a preset layer screening condition, determine a target layer from multiple candidate layers of the current application interface, and obtain first rendering data of the target layer; Acquire transparency information of the target layer, and determine a transparent area of the target layer according to the transparency information; Calculating a first area of the transparent area and determining a second area of the target layer; calculating an area ratio of the first area to the second area; Determine whether the area ratio is greater than a preset ratio threshold, wherein if it is greater than the preset ratio threshold, determine that a preset background layer adding condition is met; if the background layer adding condition is met, obtain second rendering data of the background layer in the multiple candidate layers; A target screenshot of the target layer is generated according to the second rendering data and the first rendering data.
2. The method according to claim 1, It is characterized in that The step of determining the target layer from a plurality of candidate layers of the current application interface according to the preset layer screening condition includes: Obtaining a layer identifier of each candidate layer; The layer identifier is matched with a preset layer identifier of a target application, and a candidate layer corresponding to the successfully matched layer identifier is determined to be the target layer.
3. The method according to claim 2, It is characterized in that The layer identifier includes: At least one of layer name and layer type.
4. The method according to claim 1, It is characterized in that The obtaining of first rendering data of the target layer includes: Obtaining a preset cache location of the first rendering data; The first rendering data of the target layer is read in the preset cache location.
5. The method according to claim 1, It is characterized in that The step of generating a target screenshot of the target layer according to the second rendering data and the first rendering data includes: generating a candidate screenshot of the target layer according to the first rendering data; generating the background layer according to the second rendering data; The target screenshot is generated according to the background layer and the candidate screenshots.
6. The method according to claim 1, It is characterized in that After determining whether the area ratio is greater than a preset ratio threshold, the method further includes: If the area ratio is not greater than the preset ratio threshold, a target screenshot of the target layer is generated according to the first rendering data.
7. An image processing device, It is characterized in that include: A determination module, used to determine a target layer from multiple candidate layers in the current application interface according to a preset layer screening condition; A first acquisition module, used to acquire first rendering data of the target layer; a judgment module, configured to obtain transparency information of the target layer, determine a transparent area of the target layer according to the transparency information, calculate a first area of the transparent area, determine a second area of the target layer, calculate an area ratio of the first area to the second area, and judge whether the area ratio is greater than a preset ratio threshold; A second acquisition module, configured to acquire second rendering data of a background layer among the multiple candidate layers when the ratio is greater than the preset ratio threshold; A generating module is used to generate a target screenshot of the target layer according to the second rendering data and the first rendering data.
8. An electronic device, It is characterized in that The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the image processing method described in any one of claims 1-6.
9. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program, and the computer program is used to execute the image processing method described in any one of claims 1 to 6.
Citation Information
Patent Citations
Picture capturing method and terminal
CN106020644A
Screenshot method, device and equipment and computer readable storage medium
CN109582410A
Method and system for realizing personalized shadows on Android platform
CN111930291A
Layer processing method and device
CN112204619A
Anti-aliasing content using opacity blending
US20060250415A1
