Image processing method and device, electronic equipment and nonvolatile storage medium
By recognizing and generating occlusion graphics in image processing to obscure text information, the problem of text information leakage caused by text recognition technology is solved, achieving a balance between image data security and reading experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM CORP LTD
- Filing Date
- 2022-10-19
- Publication Date
- 2026-05-19
AI Technical Summary
Existing technologies that use text recognition to obtain target information have the problem of text information leakage.
By identifying the first region where the text information is located in the original image, determining the second region of the same size, and generating an occlusion graphic in the second region to cover the corresponding position in the first region to occlude the text information, the target image is generated.
This method effectively masks text information in the original image, preventing the leakage of text information in the recognized image, improving the security of image data, reducing the difficulty of computer recognition, and without affecting the reader's reading experience.
Smart Images

Figure CN115641587B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image data security, and more specifically, to an image processing method, apparatus, electronic device, and non-volatile storage medium. Background Technology
[0002] With the continuous development of computer technology, image-based text recognition technology has become widely used. Image-based text recognition refers to identifying the text information contained within an image. This technology can effectively replace manual processing when dealing with large amounts of data, significantly reducing human workload. However, some criminals are also using text recognition technology to obtain large amounts of target image data and then convert it into easily recognizable text information, thereby achieving the goal of acquiring target information in bulk. This use of text recognition technology to obtain target information raises the issue of text information leakage.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This application provides an image processing method, apparatus, electronic device, and non-volatile storage medium to at least solve the technical problem of text information leakage when using text recognition technology to obtain target information in related technologies.
[0005] According to one aspect of the embodiments of this application, an image processing method is provided, comprising: identifying a first region in an original image where text information is located; determining a second region based on the first region, wherein the size of the second region is the same as the size of the first region; generating an occlusion graphic in the second region, wherein the occlusion graphic is used to occlude the text information; and covering the corresponding position in the first region with the occlusion graphic in the second region to obtain a target image.
[0006] Optionally, determining the second region based on the first region includes: determining a first width and a first height of the first region; determining a second width and a second height based on the first width and the first height, wherein the first width is equal to the second width and the first height is equal to the second height; and defining the closed region composed of the second width and the second height as the second region.
[0007] Optionally, generating an occlusion graphic in the second region includes: dividing the second region into multiple grid regions; generating an occlusion graphic in at least one of the multiple grid regions, wherein the type of the occlusion graphic includes at least one of the following: lines, graphics, and text.
[0008] Optionally, generating an occlusion graphic within at least one of multiple grid regions includes: determining whether text exists at a corresponding position in a first region for each grid region; identifying the grid region where the determination result is yes as the target grid region; and generating an occlusion graphic within the target grid region.
[0009] Optionally, generating an occlusion graphic within the target grid area includes: determining the original color of the text information in the original image, and determining the text size corresponding to each text information in the original image; generating an occlusion graphic within the target grid area in the second region based on the original color and text size, wherein the color of the occlusion graphic is the same as the original color of the text information, and the size of the occlusion graphic is smaller than the text size.
[0010] Optionally, determining whether text exists at the corresponding position of each grid region in the first region includes: obtaining a first pixel point contained in each grid region, and obtaining a second pixel point at the corresponding position of the first pixel point in the first region, wherein the first pixel point is any one of all pixels contained in each grid region; calculating the difference between each first pixel point and the corresponding second pixel point in each grid region to obtain a calculation result; and determining whether text exists at the corresponding position of each grid region in the first region based on the calculation result.
[0011] Optionally, after obtaining the target image, the method further includes: in response to a click operation of the target object at the target location, determining the grid region to which the target location belongs; and regenerating a new occlusion pattern within the grid region to which the target location belongs.
[0012] Optionally, determining the second region based on the first region includes: using a reading plugin to determine a second region with the same size as the first region, wherein the reading plugin is a plugin in the front-end page or a plugin in the client display interface; generating an occlusion graphic in the second region includes: using the reading plugin to generate an occlusion graphic in the second region.
[0013] According to another aspect of the embodiments of this application, an image processing apparatus is also provided, comprising: a recognition module for recognizing a first region in an original image where text information is located; a determination module for determining a second region based on the first region, wherein the size of the second region is the same as the size of the first region; a generation module for generating an occlusion graphic in the second region, wherein the occlusion graphic is used to occlude the text information; and a covering module for covering the corresponding position in the first region with the occlusion graphic in the second region to obtain a target image.
[0014] According to another aspect of the embodiments of this application, an electronic device is also provided, including: a memory for storing program instructions; and a processor connected to the memory for executing program instructions to perform the following functions: identifying a first region in an original image where text information is located; determining a second region based on the first region, wherein the size of the second region is the same as the size of the first region; generating an occlusion graphic in the second region, wherein the occlusion graphic is used to occlude the text information; and covering the corresponding position in the first region with the occlusion graphic in the second region to obtain a target image.
[0015] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored computer program, and the device on which the non-volatile storage medium is located executes the above-described image processing method by running the computer program.
[0016] In this embodiment, a first region containing text information in the original image is identified; a second region is determined based on the first region, wherein the size of the second region is the same as that of the first region; an occlusion graphic is generated in the second region, wherein the occlusion graphic is used to occlude the text information; the occlusion graphic in the second region is overlaid on the corresponding position in the first region to obtain the target image, thereby achieving the purpose of occluding the text information in the original image, thus achieving the technical effect of preventing the recognition of text information in the image, and thus solving the technical problem of text information leakage when using text recognition technology to obtain target information in related technologies. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0018] Figure 1 This is a hardware structure block diagram of a computer terminal (or electronic device) for implementing an image processing method according to an embodiment of this application;
[0019] Figure 2 This is a flowchart of an image processing method according to an embodiment of this application;
[0020] Figure 3 This is a schematic diagram of a target image according to an embodiment of this application;
[0021] Figure 4 This is a structural diagram of an image processing apparatus according to an embodiment of this application. Detailed Implementation
[0022] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0023] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0024] The image processing method embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal (or electronic device) for implementing an image processing method is shown. Figure 1 As shown, the computer terminal 10 (or electronic device 10) may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0025] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be wholly or partially embodied in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuit may be a single, independent processing module, or may be wholly or partially integrated into any other element within the computer terminal 10 (or electronic device). As involved in the embodiments of this application, the data processing circuit serves as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0026] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the image processing method in this embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the above-mentioned image processing method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0027] The transmission module 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission module 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission module 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0028] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10 (or electronic device).
[0029] It should be noted here that, in some optional embodiments, the above... Figure 1 The computer device (or electronic device) shown may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that... Figure 1 This is only one instance of a particular specific instance, and is intended to illustrate the types of components that may exist in the aforementioned computer equipment (or electronic equipment).
[0030] In the above operating environment, this application provides an embodiment of an image processing method. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than that shown here.
[0031] Figure 2 This is a flowchart of an image processing method according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:
[0032] Step S202: Identify the first region where the text information in the original image is located.
[0033] Step S204: Determine the second region based on the first region, wherein the size of the second region is the same as the size of the first region.
[0034] In step S204 above, the second region can be established on the upper or lower layer of the first region, or it can be established in other regions unrelated to the first region. The second region is preferably established on the upper layer of the first region. In an optional embodiment, the second region can be a grid region.
[0035] Step S206: Generate an occlusion graphic in the second region, wherein the occlusion graphic is used to occlude text information.
[0036] In step S206 above, the occlusion pattern in the second region is randomly generated. When the second region is a grid region, the occlusion pattern can be randomly generated in each grid region. The phrase "occlusion pattern is randomly generated in each grid region" means that an occlusion pattern may or may not be generated in each grid region. If an occlusion pattern is generated, it is randomly generated. For example, the occlusion pattern can be a line, a graphic, or text. Lines can be arc segments or straight line segments, graphics can be solid or hollow circles, rectangles, or polygons, and text includes radicals, letters, etc. Furthermore, the generation position of the occlusion pattern within the grid region is also random.
[0037] Step S208: Cover the corresponding position in the first region with the occlusion pattern in the second region to obtain the target image.
[0038] In step S208 above, since the occlusion pattern is used to occlude the text information in the first region, the occlusion pattern in the second region should cover the top layer of the first region to achieve the purpose of occluding the text information in the first region, thereby obtaining the target image. The target image is then integrated and stored. This target image can be, for example, as shown in... Figure 3As shown, randomly generated occlusion patterns can obscure text, increasing the difficulty for computer recognition. It should be noted that... Figure 3 The grid in the image is drawn to clearly illustrate the principle of the overall scheme and is for illustrative purposes only. The final image will not have a grid. In addition to saving the target image, the corresponding original image will also be retained and stored, but will not be made public.
[0039] Through the above steps, a first region containing text information in the original image is identified; a second region is determined based on the first region, wherein the size of the second region is the same as that of the first region; an occlusion graphic is generated in the second region, wherein the occlusion graphic is used to occlude the text information; the occlusion graphic in the second region is overlaid on the corresponding position in the first region to obtain the target image, thereby achieving the purpose of occluding the text information in the original image, thus realizing the technical effect of preventing the recognition of text information in the image, and thus solving the technical problem of text information leakage when using text recognition technology to obtain target information in related technologies.
[0040] In step S204 of the above image processing method, determining the second region based on the first region specifically includes the following steps: determining the first width and the first height of the first region; determining the second width and the second height based on the first width and the first height, wherein the first width is equal to the second width and the first height is equal to the second height; and determining the closed region composed of the second width and the second height as the second region.
[0041] In this embodiment of the application, since the text information in the original image needs to be partially occluded, after determining the size or dimensions of the first region where the text information in the original image is located, a second region with the same size or dimensions as the first region is determined. That is, the first width and the first height of the first region are determined first. For example, if the first region is a rectangle with a width of 10cm and a height of 8cm, then the second width and the second height of the generated second region are also determined to be 10cm and 8cm, respectively. Thus, the second region is determined to be a rectangular region based on the closed region formed by the second width and the second height.
[0042] It should be noted that the above only illustrates the case where the first region is rectangular. In this case, the first region is a regular shape, and its size can be determined based on its width and height. If the first region is circular, its radius can be determined, and the size of the second region can be determined based on the length of the radius. The first region can also be other shapes, which are not listed here, but it is necessary to ensure that the size and shape of the generated second region are consistent with those of the first region.
[0043] In step S206 of the above image processing method, generating an occlusion pattern in the second region specifically includes the following steps: dividing the second region into multiple grid regions; generating an occlusion pattern in at least one of the multiple grid regions, where the types of the occlusion pattern include at least one of the following: lines, patterns, and characters.
[0044] In the embodiments of the present application, when the type of the occlusion pattern is a line, the line can be an arc segment or a straight segment, etc. When the type of the occlusion pattern is a pattern, the pattern can be a solid or hollow circle, rectangle, polygon, etc. Characters include radicals, letters, etc. Among the above various types of occlusion patterns, the occlusion area of the line-type occlusion pattern is relatively small, and its applicability is relatively wide. It has a good occlusion effect on different languages, characters, symbols, etc., and at the same time has a relatively small impact on reading. For the hollow pattern type, like the line-type occlusion pattern, it occupies a small area, can reduce the occlusion of characters, and has a good reading experience. If the anti-recognition intensity is particularly emphasized, a solid pattern can also be used, but this may also increase the difficulty of reading and recognition. For the character-type occlusion pattern, the occlusion pattern corresponding to the language of the occluded characters should be selected as much as possible. For example, when occluding Chinese character content, radicals such as "饣", "扌", "犭", etc. can be used as the occlusion pattern, which has a strong interference on OCR recognition. Similarly, when occluding English content, letters such as "a", "A", etc. can be used as the occlusion pattern. When occluding Japanese content, hiragana, katakana, Chinese characters, etc. can also be used as the occlusion pattern.
[0045] In the above image processing method, generating an occlusion pattern in at least one of the multiple grid regions specifically includes the following steps: determining whether there are characters at the corresponding positions of each grid region in the first region; determining the grid regions with a judgment result of yes as target grid regions; generating an occlusion pattern in the target grid regions.
[0046] In the embodiments of the present application, the grid regions are established for the overall region of the text information in the original image. Each character does not necessarily fall accurately and completely into each grid, and the shapes and distributions of the occlusion patterns in the grids are random. Therefore, when generating the occlusion patterns, not every occlusion pattern can occlude the characters, and the occlusion patterns may also be generated in the blank areas, resulting in ineffective occlusion. Although this kind of occlusion can also hinder computer recognition, it does not look neat and beautiful for readers.
[0047] To facilitate determining whether text exists at corresponding positions in the first region at different locations in the second region, the second region is divided into multiple grid regions. Within each of these grid regions, it is determined whether text exists in the corresponding portion of the first region. If text is found in the corresponding area of the first region, that grid region is designated as the target grid region. Occlusion graphics are then randomly generated within the target grid region, thus avoiding invalid occlusion and improving the reader's experience. Furthermore, in this embodiment, it is not necessary to occlude every single character (or word); occlusion is only required for individual characters among several adjacent characters.
[0048] It should be noted that the grid area only obscures the internal calculation logic during graphic generation and will not be displayed in the final image. Furthermore, the optimal grid area division is to have one grid area per character.
[0049] In the above image processing method, generating an occlusion graphic within the target grid area specifically includes the following steps: determining the original color of the text information in the original image, and determining the text size corresponding to each text information in the original image; generating an occlusion graphic within the target grid area in the second region based on the original color and text size, wherein the color of the occlusion graphic is the same as the original color of the text information, and the size of the occlusion graphic is smaller than the text size.
[0050] In this embodiment, to increase the difficulty of text recognition, the same color as the obscured text (i.e., the text information in the original image) is typically used, making the obscuring graphic and the obscured text content blend together. Furthermore, to ensure that the generated obscuring graphic does not affect the reader's reading and recognition, the size of the obscuring graphic needs to be limited. In this application, the size of the obscuring graphic is smaller than the size corresponding to each piece of text information in the original image. The text information referred to here does not include punctuation marks in the original image. Generally, except for punctuation marks, the size corresponding to each piece of text information in the original image is the same.
[0051] In another optional embodiment, the area of the occluded graphic should also be smaller than the area occupied by the text information in the original image. For ease of description, the area of the occluded graphic is denoted as the first area, and the area occupied by the text information in the original image is denoted as the second area. Here, it is assumed that the font size of the text information in the original image is the same. For example, the first area is a preset value of the second area, which can be any value between 0 and 1, such as 0.3, to ensure that the preset value does not affect the reader's reading and recognition.
[0052] In the above image processing method, determining whether there is text at the corresponding position of each grid region in the first region specifically includes the following steps: obtaining the first pixel point contained in each grid region, and obtaining the second pixel point at the corresponding position of the first pixel point in the first region, wherein the first pixel point is any one of all pixels contained in each grid region; calculating the difference between each first pixel point and the corresponding second pixel point in each grid region to obtain the calculation result; and determining whether there is text at the corresponding position of each grid region in the first region based on the calculation result.
[0053] In this embodiment of the application, the above steps are used to determine whether there is text in the corresponding position of each grid area in the first area, thereby determining whether to generate an occluding graphic in the grid area to improve the reader's viewing experience.
[0054] In step S208 of the above image processing method, after obtaining the target image, the method further includes the following steps: in response to the click operation of the target object at the target location, determining the grid region to which the target location belongs; and regenerating a new occlusion pattern within the grid region to which the target location belongs.
[0055] In this embodiment, if a reader believes that the generated occlusion graphic affects normal reading when reading text information in a target image, they can click on the target location of the target image. For example, when the reader touches and clicks on unrecognizable text (i.e., the target location) with a mouse or finger, the terminal device or application of the algorithm, after receiving the click operation of the target object (i.e., the reader) at the target location, determines the grid area to which the target location belongs, and then regenerates a new occlusion graphic within the grid area to which the target location belongs. This overcomes the defect that the text cannot be recognized due to occlusion, thereby achieving the effect of local refresh and reducing the amount of computation.
[0056] In the above image processing method, determining the second region based on the first region includes: using a reading plugin to determine a second region with the same size as the first region, wherein the reading plugin is a plugin in the front-end page or a plugin in the client display interface; generating an occlusion graphic in the second region includes: using the reading plugin to generate an occlusion graphic in the second region. It should be noted that the occlusion graphic can be an occlusion graphic generated in the backend or an occlusion graphic generated by the front-end reading plugin.
[0057] In this embodiment of the application, if all the occlusion graphics in the second region and the corresponding original images are integrated into one file, the amount of data storage will increase exponentially. Therefore, a dedicated reading plugin can be configured on the webpage or client. When reading the original image data, the reading plugin generates occlusion graphics based on the image through calculation before displaying it to the reader, which can reduce the pressure of data storage.
[0058] In another alternative embodiment, a virtual "refresh" button can be configured on the webpage or client containing the reading plugin. When the reader encounters reading difficulties due to obscured graphics, refreshing can regenerate the obscured graphics, thus overcoming the defect of unrecognizable text.
[0059] The image processing method provided in this application has the following advantages: 1) It can prevent the batch acquisition of text data in images, thus ensuring strong security; 2) It has strong randomness and good resistance to artificial intelligence recognition; 3) It does not affect reading and recognition for the reader; 4) The data in the original image is still preserved and will not affect the data in the original image.
[0060] Figure 4 This is a structural diagram of an image processing apparatus according to an embodiment of this application, such as... Figure 4 As shown, the device includes:
[0061] Recognition module 402 is used to recognize the first region where the text information in the original image is located;
[0062] The determining module 404 is used to determine the second region based on the first region, wherein the size of the second region is the same as the size of the first region;
[0063] The generation module 406 is used to generate an occlusion graphic in the second area, wherein the occlusion graphic is used to occlude text information;
[0064] The overlay module 408 is used to overlay the occlusion pattern in the second region onto the corresponding position in the first region to obtain the target image.
[0065] In the determination module of the above-mentioned image processing device, determining the second region based on the first region specifically includes the following process: determining the first width and the first height of the first region; determining the second width and the second height based on the first width and the first height, wherein the first width is equal to the second width and the first height is equal to the second height; and determining the closed region composed of the second width and the second height as the second region.
[0066] In the generation module of the aforementioned image processing apparatus, generating an occlusion graphic in the second region specifically includes the following process: dividing the second region into multiple grid regions; generating an occlusion graphic in at least one of the multiple grid regions, wherein the type of the occlusion graphic includes at least one of the following: lines, graphics, and text.
[0067] In the generation module of the aforementioned image processing device, generating an occlusion graphic in at least one of multiple grid regions specifically includes the following process: determining whether text exists at the corresponding position of each grid region in the first region; determining the grid region where the determination result is yes as the target grid region; and generating an occlusion graphic within the target grid region.
[0068] In the generation module of the aforementioned image processing device, generating an occlusion graphic within the target grid area specifically includes the following process: determining the original color of the text information in the original image, and determining the text size corresponding to each text information in the original image; generating an occlusion graphic within the target grid area in the second region based on the original color and text size, wherein the color of the occlusion graphic is the same as the original color of the text information, and the size of the occlusion graphic is smaller than the text size.
[0069] In the generation module of the aforementioned image processing device, determining whether text exists at the corresponding position of each grid region in the first region specifically includes the following process: obtaining a first pixel point contained in each grid region, and obtaining a second pixel point at the corresponding position of the first pixel point in the first region, wherein the first pixel point is any one of all pixels contained in each grid region; calculating the difference between each first pixel point and the corresponding second pixel point in each grid region to obtain the calculation result; and determining whether text exists at the corresponding position of each grid region in the first region based on the calculation result.
[0070] In the overlay module of the aforementioned image processing device, the overlay module is further configured to, in response to a click operation of a target object at a target location, determine the grid region to which the target location belongs; and regenerate a new occlusion pattern within the grid region to which the target location belongs.
[0071] In the determining module of the aforementioned image processing device, determining the second region based on the first region specifically includes the following process: using a reading plugin to determine a second region with the same size as the first region, wherein the reading plugin is a plugin in the front-end page or a plugin in the client display interface; in the generating module of the aforementioned image processing device, generating an occlusion graphic in the second region specifically includes the following process: using the reading plugin to generate an occlusion graphic in the second region. It should be noted that the occlusion graphic can be an occlusion graphic generated in the backend or an occlusion graphic generated by the front-end reading plugin.
[0072] It should be noted that, Figure 4 The image processing device shown is used to perform Figure 2 The image processing method shown above is also applicable to this image processing device, and will not be repeated here.
[0073] This application embodiment also provides a non-volatile storage medium, which includes a stored computer program. The device containing the non-volatile storage medium executes the following image processing method by running the computer program: identifying a first region containing text information in an original image; determining a second region based on the first region, wherein the size of the second region is the same as the size of the first region; generating an occlusion graphic in the second region, wherein the occlusion graphic is used to occlude the text information; and covering the corresponding position in the first region with the occlusion graphic in the second region to obtain a target image.
[0074] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0075] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0076] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0077] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0078] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0079] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0080] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. An image processing method, characterized in that, include: Identify the first region containing text information in the original image; A second region is determined based on the first region, wherein the size of the second region is the same as the size of the first region; An occlusion graphic is generated in the second region, wherein the occlusion graphic is used to occlude the text information; The occlusion pattern in the second region is overlaid on the corresponding position in the first region to obtain the target image; Generating an occlusion graphic in the second region includes: dividing the second region into multiple grid regions and randomly generating the occlusion graphic within a target grid region, wherein the type of the occlusion graphic includes at least one of the following: lines, graphics, and text, the grid region is the internal calculation logic for generating the occlusion graphic, and the target grid region is a grid region where text exists at a corresponding position in the first region; The target grid region is determined as follows: First pixels are obtained within each grid region, and second pixels are obtained at the corresponding positions of the first pixels within the first region. The first pixels are any one of all pixels within each grid region. The difference between each first pixel and its corresponding second pixel within each grid region is calculated to obtain a result. Based on the calculation result, it is determined whether text exists at the corresponding position of each grid region within the first region, and the grid region containing text at the corresponding position is determined as the target grid region. After obtaining the target image, the method further includes: in response to a click operation of the target object at the target location, determining the grid region to which the target location belongs; and regenerating a new occlusion pattern within the grid region to which the target location belongs.
2. The method according to claim 1, characterized in that, Determining the second region based on the first region includes: Determine the first width and first height of the first region; A second width and a second height are determined based on the first width and the first height, wherein the first width is equal to the second width and the first height is equal to the second height; The closed region consisting of the second width and the second height is defined as the second region.
3. The method according to claim 1, characterized in that, The method further includes: Determine whether there is text at the corresponding position of each grid area in the first area; The grid region with a judgment result of "yes" is determined as the target grid region; The occlusion pattern is generated within the target grid area.
4. The method according to claim 3, characterized in that, Generating the occlusion pattern within the target grid area includes: Determine the original color of the text information in the original image, and determine the text size corresponding to each piece of text information in the original image; Based on the original color and the text size, the occlusion graphic is generated within the target grid area in the second region, wherein the color of the occlusion graphic is the same as the original color of the text information, and the size of the occlusion graphic is smaller than the text size.
5. The method according to claim 1, characterized in that, Determining a second region based on the first region includes: using a reading plugin to determine a second region of the same size as the first region, wherein the reading plugin is a plugin in the front-end page or a plugin in the client display interface; Generating an occlusion graphic in the second region includes: using the reading plugin to generate the occlusion graphic in the second region.
6. An image processing apparatus, characterized in that, include: The recognition module is used to identify the first region containing text information in the original image; A determining module is configured to determine a second region based on the first region, wherein the size of the second region is the same as the size of the first region; and to generate an occlusion graphic in the second region, comprising: dividing the second region into multiple grid regions, and randomly generating the occlusion graphic within a target grid region, wherein the type of the occlusion graphic includes at least one of the following: lines, graphics, and text; the grid region is the internal calculation logic for generating the occlusion graphic; and the target grid region is a grid region where text exists at a corresponding position in the first region; the target grid region is determined by: obtaining a first pixel point contained in each grid region, and obtaining a second pixel point at a corresponding position of the first pixel point in the first region, wherein the first pixel point is any one of all pixels contained in each grid region; calculating the difference between each first pixel point and the corresponding second pixel point in each grid region to obtain a calculation result; determining whether text exists at a corresponding position in the first region for each grid region based on the calculation result, and determining the grid region where text exists at the corresponding position as the target grid region; A generation module is used to generate an occlusion graphic in the second region, wherein the occlusion graphic is used to occlude the text information; The overlay module is used to overlay the occlusion pattern in the second region onto the corresponding position in the first region to obtain a target image; after obtaining the target image, it further includes: in response to a click operation of the target object at the target position, determining the grid region to which the target position belongs; and regenerating a new occlusion pattern within the grid region to which the target position belongs.
7. An electronic device, characterized in that, include: Memory, used to store program instructions; A processor, connected to the memory, is configured to execute program instructions to perform the following functions: identifying a first region containing text information in an original image; determining a second region based on the first region, wherein the size of the second region is the same as the size of the first region; generating an occlusion graphic in the second region, wherein the occlusion graphic is used to occlude the text information; generating the occlusion graphic in the second region includes: dividing the second region into multiple grid regions, and randomly generating the occlusion graphic within a target grid region, wherein the type of the occlusion graphic includes at least one of the following: lines, graphics, and text; the grid region is the internal computational logic for generating the occlusion graphic; the target grid region is a grid region where text exists at a corresponding position in the first region; the target grid region is determined by the following method. The process includes: acquiring a first pixel within each grid region and acquiring a second pixel at the corresponding position of the first pixel in the first region, wherein the first pixel is any one of all pixels contained in each grid region; calculating the difference between each first pixel and its corresponding second pixel in each grid region to obtain a calculation result; determining whether there is text at the corresponding position of each grid region in the first region based on the calculation result, and identifying the grid region with text at the corresponding position as the target grid region; covering the corresponding position of the occlusion graphic in the second region with the target position to obtain a target image; after obtaining the target image, the process further includes: responding to a click operation of the target object at the target position, determining the grid region to which the target position belongs; and regenerating a new occlusion graphic within the grid region to which the target position belongs.
8. A non-volatile storage medium, characterized in that, The non-volatile storage medium includes a stored computer program, wherein when the device containing the non-volatile storage medium runs the computer program, it executes the image processing method according to any one of claims 1 to 5.