A method, terminal, and medium for automatically generating high-quality text-based tampered images.
By automating the identification and execution of image tampering operations, the problem of the limited image tampering methods in existing technologies has been solved, achieving high-quality text-based image tampering and improving the performance and efficiency of the tampering detection model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies cannot effectively simulate image tampering operations in real-world scenarios, especially text-based image tampering, resulting in limited tampering methods and an inability to accurately simulate actual tampering environments.
By acquiring the area to be tampered with in the image, OCR technology is used to identify text and number areas, and based on preset tampering operation information, operations such as copying and pasting, splicing, removing, adding and replacing are automatically performed, and Photoshop script interface functions are used for efficient tampering.
It achieves high-quality text-based image tampering, realistically simulating human tampering, improving the performance of tampering detection models, and reducing the cost and time of manually creating datasets.
Smart Images

Figure CN114494528B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of image processing, and in particular to an automatic high-quality text tampered image generation method, a terminal and a medium. BACKGROUND
[0002] Under the background of rapid development of the Internet and wide application of various image acquisition devices, many non-professionals can freely create a series of image information, which not only facilitates our daily life, but also adds some challenges to our life. For example, people can use image editing software such as Photoshop to modify the content of a picture.
[0003] In some occasions, the judgment of the authenticity of text images is very important, and the image tampering detection based on deep learning is one of the commonly used and effective methods. An important feature of this kind of tampering detection method is data-driven, and the size of the data largely determines the performance of the corresponding tampering detection model algorithm. In the industry, a product model with good performance often needs a large amount of data for training and then fine-tuning on specific business data. For example, in order to accurately classify the recognized objects, the ImageNet dataset is often used for pre-training, and the pre-trained model is loaded when identifying specific tasks. In addition, it is time-consuming and laborious to manually create a dataset. According to the survey, the market price of a professional PS person tampering with an image is 10-20 yuan RMB, and in actual business, a specific tampering detection model requires more than 10,000 images to maintain good detection performance, which costs about 100-200 thousand yuan, which is not cheap.
[0004] The existing tampering method mainly uses to construct the actual Photoshop tampered image, analyzes the tampering tool and tampering operation in the Photoshop tampered image, and then counts the tampering tool and tampering operation used. According to the interface function, a script program is drawn to obtain a tampering operation flowchart. Through the tampering operation flowchart, the process of using Photoshop for tampering is simulated, a script program is written, and based on the script program, the tampering tool and tampering operation are called according to the tampering operation flowchart. The tampering operations mainly used are: splicing operation; In addition, the following tampering tools are called on the region of the splicing operation: Gaussian blur, mean blur, intelligent blur, motion blur, sharpening tool, darkening tool, lightening tool, and smearing tool.
[0005] The tampering operation of this tampering method is single, mainly involves splicing operation, and then various tampering tools are applied in the tampering area, such as blurring operation. However, in a real tampering environment, there are multiple tampering operations such as copying and pasting, adding, removing, removing and adding (i.e. replacing); moreover, the tampering position of this tampering method is disordered, since the main operation of this tampering method is splicing operation, that is, a block of area is selected from the B image and pasted to the target A image, and the pasting area in the A image is random, which is far from the actual tampering operation on the target area of interest; furthermore, the tampering area size of this tampering method is not the same, although the size of the tampering area is too large, the visual effect is more obvious in the larger tampering area, and the area of some tampering areas exceeds more than half of the original image area, but the actual tampering area is generally small, and it is impossible to simulate the tampering operation in a real scene.
[0006] Therefore, the prior art still needs to be improved. SUMMARY
[0007] The technical problem to be solved by the present application is that, in view of the defects of the prior art, the present application provides an automatic high-quality text tampered image generation method, a terminal and a medium, aiming at solving the technical problem that the image tampering method in the prior art cannot simulate the tampering operation in a real scene.
[0008] The technical solution adopted by the present application to solve the technical problem is as follows:
[0009] In a first aspect, the present application provides an automatic high-quality text tampered image generation method, which comprises the following steps:
[0010] Obtain a to-be-tampered image and determine a to-be-tampered area in the to-be-tampered image; wherein the to-be-tampered area is a text area and / or a digital area in the to-be-tampered image;
[0011] Obtain preset tampering operation information, and determine an image tampering operation corresponding to the to-be-tampered image according to the preset tampering operation information;
[0012] According to the determined image tampering operation, the to-be-tampered image is tampered with, and the tampered image is output and displayed.
[0013] In one implementation, the obtaining of the to-be-tampered image further comprises:
[0014] Defining an image tampering operation in advance; wherein the image tampering operation includes copying and pasting, splicing, removing, adding and replacing.
[0015] In one implementation, the obtaining of the to-be-tampered image further comprises:
[0016] tampering with a preset text image according to the image tampering operation, and recording the image tampering operation required in the tampering process;
[0017] analyzing the recorded image tampering operation to obtain the preset tampering operation information.
[0018] In an implementation manner, the obtaining of the image to be tampered with and the determination of the region to be tampered with in the image to be tampered with comprise:
[0019] obtaining the image to be tampered with and detecting a text region and / or a number region in the image to be tampered with;
[0020] marking the text region and / or the number region with a rectangular frame and identifying text information and / or number information in the rectangular frame;
[0021] saving the rectangular frame and the text information and / or the number information inside the rectangular frame according to a preset format to determine the region to be tampered with.
[0022] In an implementation manner, the obtaining of the preset tampering operation information and the determination of the image tampering operation corresponding to the image to be tampered with according to the preset tampering operation information comprise:
[0023] obtaining the preset tampering operation information;
[0024] determining a tampering operation type required by the image to be tampered with according to the region to be tampered with;
[0025] finding and determining the corresponding image tampering operation from the preset tampering operation information according to the tampering operation type.
[0026] In an implementation manner, the tampering with the image to be tampered with according to the determined image tampering operation and the output and display of the tampered image comprise:
[0027] starting an image tampering tool and reading the image to be tampered with through the image tampering tool;
[0028] reading the region to be tampered with information in the image to be tampered with to obtain a rectangular frame and text information and / or number information inside the rectangular frame;
[0029] calling a corresponding script interface function according to the determined image tampering operation, and tampering with the text information and / or the number information according to the determined image tampering operation;
[0030] outputting and displaying the tampered image in a corresponding terminal device according to an output path.
[0031] In an implementation manner, the starting of the image tampering tool further comprises:
[0032] The script interface function of the image tampering tool is written according to a preset language.
[0033] In an implementation manner, the tampering of the text information and / or the digital information according to the determined image tampering operation comprises:
[0034] randomly reading an image of a certain region from the image to be tampered with and pasting the image to a tampered region of the image to be tampered with;
[0035] and / or randomly reading an image of a certain region from a source image and pasting the image to a tampered region of the image to be tampered with;
[0036] and / or randomly reading an image of a certain region from the image to be tampered with and filling or content-recognizing filling or stamping to remove content in the tampered region;
[0037] and / or randomly reading an image of a certain region from the image to be tampered with and adding text information, digital information and a pattern to one side of the randomly selected region;
[0038] and / or randomly reading an image of a certain region from the image to be tampered with, filling or content-recognizing filling or stamping to remove content in the tampered region, and adding text information, digital information and a pattern to one side of the randomly selected region;
[0039] wherein the randomly selected region has the same size as the tampered region.
[0040] In a second aspect, the present application provides a terminal, comprising a processor and a memory, wherein the memory stores an automatic high-quality text tampered image generation program, and the automatic high-quality text tampered image generation program is used to implement the automatic high-quality text tampered image generation method according to the first aspect when executed by the processor.
[0041] In a third aspect, the present application provides a medium, which is a computer readable storage medium, and the medium stores an automatic high-quality text tampered image generation program, and the automatic high-quality text tampered image generation program is used to implement the automatic high-quality text tampered image generation method according to the first aspect when executed by a processor.
[0042] The technical scheme has the following effects:
[0043] The application realizes an automatic high-quality text type tampered image generation scheme by acquiring a to-be-tampered image and determining a to-be-tampered region in the to-be-tampered image, acquiring preset tampering operation information, determining an image tampering operation corresponding to the to-be-tampered image according to the preset tampering operation information, tampering the to-be-tampered image according to the determined image tampering operation, and outputting and displaying the tampered image. The application uses an OCR technology to locate text and digital regions in a text type image, analyzes and summarizes tampering operations according to prior tampering history operations or saved documents of history operations, and uses a tampering tool script to efficiently tamper the text type image in real time. BRIEF DESCRIPTION OF DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from the structures shown in the drawings without creative labor.
[0045] Figure 1 is a flowchart of an automatic high-quality text type tampered image generation method in an implementation manner of the present application.
[0046] Figure 2 is an image schematic diagram after manual tampering.
[0047] Figure 3 is an image schematic diagram after automatic tampering in an implementation manner of the present application.
[0048] Figure 4 is an image schematic diagram obtained by using a copy-paste tampering operation in an implementation manner of the present application.
[0049] Figure 5 is an image schematic diagram obtained by using a splicing tampering operation in an implementation manner of the present application.
[0050] Figure 6 is an image schematic diagram obtained by using an adding tampering operation in an implementation manner of the present application.
[0051] Figure 7 is an image schematic diagram obtained by using a replacing tampering operation in an implementation manner of the present application.
[0052] Figure 8 is an image schematic diagram after tampering in other application scenarios in an implementation manner of the present application.
[0053] Figure 9is a functional schematic diagram of a terminal in an implementation manner of the present application.
[0054] The implementation, functional features and advantages of the present application will be further described with reference to the accompanying drawings and in conjunction with embodiments. DETAILED DESCRIPTION
[0055] To make the object, technical solutions and advantages of the present application more clear and explicit, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0056] Exemplary method
[0057] As shown in Figure 1 The present application embodiment provides an automatic high-quality text tampered image generation method, which comprises the following steps:
[0058] Step S100, acquiring a to-be-tampered image and determining a to-be-tampered region in the to-be-tampered image.
[0059] In the present embodiment, the automatic high-quality text tampered image generation method is applied in a terminal, which includes but is not limited to a computer and a mobile terminal and other image processing display devices.
[0060] In the present embodiment, the automatic high-quality text tampered image generation method is mainly used for tampering text images; wherein the text image refers to an image containing text and / or numbers, such as a screenshot image, a document image, a qualification image, a sign street view image and a card image, etc. containing various types of text or numbers; of course, in other implementation manners of the present embodiment, the automatic high-quality text tampered image generation method can also be used for tampering other images with graphic features, such as images of people, objects and landscapes.
[0061] Further, in the implementation process of the automatic high-quality text tampered image generation method, the terminal device can automatically detect and analyze the image to be tampered and the tampered region, obtain the tampering operation to be performed in the tampering process of the image, and then automatically control the tampering tool to tamper the image to be tampered according to the obtained tampering operation, so as to modify the image into a tampered image that is realistic as the original image.
[0062] In the present embodiment, in order to provide the image tampering operation required in the text image tampering process, the present embodiment also needs to define various image tampering operations before tampering the target image, so as to obtain the customized image tampering operation.
[0063] Specifically, in one implementation of this embodiment, the following steps are included before step S100:
[0064] Step S001: Predefine image tampering operations.
[0065] In defining the image tampering operation, a tampering tool can be selected as needed, and then the image tampering operation definition process can be implemented using the tampering tool; wherein, the tampering tool can be Photoshop (i.e., an image processing software launched by Adobe, which mainly processes digital images composed of pixels, and is the most common image editing tool in daily life. It can use its many editing and drawing tools to effectively perform image editing work).
[0066] Furthermore, when defining tampering operations through Photoshop, the defined tampering operations can be executed in Photoshop first; wherein, the image tampering operations include operations such as copy and paste, splicing, removal, addition, and replacement (i.e., removal first and then addition); then, the executed tampering operations are associated with the defined names and operation items and stored, thereby forming a mapping table containing the relationship between tampering operation names and tampering operations.
[0067] Specifically, the image tampering operation is defined as follows:
[0068] The copy and paste operation involves selecting specific text, numbers, or pattern areas within a text-based image, copying them, and then pasting them.
[0069] The splicing operation is as follows: select several text, number, or pattern areas from the candidate text image and copy them to the text image to be modified.
[0070] The removal operation is to remove the areas of text, numbers, or patterns that originally existed in text-type images.
[0071] The addition operation involves using editing software to add text, numbers, or patterns to the blank areas of the text-based image to be modified.
[0072] The replacement operation involves removing the original text areas from text-based images and then adding text, numbers, or patterns using editing software.
[0073] In this embodiment, in addition to defining the image tampering operation, it is also necessary to perform practical operations based on the defined image tampering operation in order to obtain the prior data required by this embodiment.
[0074] Specifically, in one implementation of this embodiment, the following steps are included before step S100:
[0075] Step S002: Modify the preset text image according to the image tampering operation, and record the image tampering operation required in the tampering process;
[0076] Step S003: Analyze the recorded image tampering operations to obtain the preset tampering operation information.
[0077] In this embodiment, in order to obtain accurate prior data, 10 professional Photoshop operators can be selected. Each Photoshop operator can perform specific tampering operations on text images according to the five image tampering operations defined above (i.e., copy and paste, splice, remove, add, and replace). In the specific operation, each tampering operation is performed on 10 images, and each Photoshop operator can obtain 50 tampered images, resulting in 500 tampered text images.
[0078] Furthermore, in specific operations, the image tampering operations required for each image during the tampering process can be recorded by screen recording; then, by analyzing the Photoshop history operations of each tampering operation performed by each PS operator in the recorded video, the corresponding specific tampering operations can be summarized and used as the preset tampering operation information in the actual tampering process of this embodiment.
[0079] 1. For the copy and paste operation, the specific operation is to copy a text, number or pattern area from a non-target area of the target image A to the target area, and then add Gaussian blur to the edge of the image to increase the visual realism.
[0080] 2. For the stitching operation, copy a region of text, numbers, or patterns from the source image B to the target region of the target image A, and then add Gaussian blur to the edges of the images to increase the visual realism.
[0081] 3. For the removal operation, the text, numbers or patterns in the target area of the target image A are removed. The specific removal operations include the following methods, including filling the background color of the target area, or using the clone stamp operation to clone the background color of the target area to cover the text, numbers or pattern areas, or using the content-aware fill operation to clone the background of the target area to cover the text, numbers or pattern areas.
[0082] 4. For the addition operation, add text, numbers or patterns to appropriate positions in the target image A, and then apply blurring to achieve a seamless effect.
[0083] 5. The removal and addition operation, also known as the replacement operation, is a combination of removal and addition operations. It removes text, numbers, or patterns from the target area of the target image A, and then adds text, numbers, or patterns to the removed locations, followed by blurring.
[0084] In another implementation of this embodiment, during the summarization and analysis of specific image tampering operations, the historical operations of Photoshop can be saved as a local TXT file when the Photoshop operator tampers with the image. Then, NLP (Natural Language Processing) technology can be used to analyze the saved historical operation TXT file, which can summarize the relevant tampering operations in batches, thus greatly improving efficiency.
[0085] After summarizing the specific tampering operations, this embodiment can determine the tampering operation to be performed based on the type of the input image in actual tampering scenarios. Then, the input image can be tampered with according to the corresponding tampering operation to obtain the desired tampered image.
[0086] Specifically, in one implementation of this embodiment, step S100 includes the following steps:
[0087] Step S101: Obtain the image to be tampered with, and detect the text region and / or number region in the image to be tampered with;
[0088] Step S102: Mark the text area and / or number area with a rectangle, and identify the text information and / or number information within the rectangle;
[0089] Step S103: Save the rectangle and its internal text and / or numerical information according to a preset format to determine the area to be tampered with.
[0090] In the above steps, the image to be tampered with is a text-type image that is input in real time in a real application scenario, which is an image that needs to be automatically tampered with by a terminal device. After obtaining the image to be tampered with, the image to be tampered with is processed by OCR technology to obtain the area to be tampered with and the text information and / or numerical information within that area.
[0091] Furthermore, OCR (Optical Character Recognition) technology refers to the process by which electronic devices (such as scanners or digital cameras) or related computer vision methods examine characters printed on paper, determine their shapes by detecting dark and light patterns, and then translate the shapes into computer text using character recognition methods.
[0092] In this embodiment, the OCR technology mainly includes two parts: text detection and text recognition. First, the text region is detected and marked with a rectangle. Then, the detected text information is recognized, and the coordinates of the four vertices of the recognized text and the rectangle are saved. When saving, the information to be saved is saved in JSON file format; the saving format is as follows:
[0093] First, the coordinates of the four vertices of the keyword "box" and the recognition area following it; second, the keyword "txt" and the recognition content following it; and finally, the confidence score of the recognized "txt" content following it.
[0094] In the process of OCR technology processing, OCR technology can utilize existing open-source models or self-built models. When building a self-built model, a solution of CNN model + RNN model + CTC model can be used.
[0095] like Figure 1 As shown, in one implementation of this invention, the automated high-quality text-based image tampering generation method further includes the following steps:
[0096] Step S200: Obtain preset tampering operation information, and determine the image tampering operation corresponding to the image to be tampered with based on the preset tampering operation information.
[0097] In this embodiment, after determining the area to be tampered with, by acquiring prior data, i.e., acquiring preset tampering operation information, the type of tampering operation required for the image to be tampered with can be determined based on the area to be tampered with, and then the corresponding image tampering operation can be found based on the type of tampering operation.
[0098] Specifically, in one implementation of this embodiment, step S200 includes the following steps:
[0099] Step S201: Obtain the preset tampering operation information;
[0100] Step S202: Determine the type of tampering operation required for the image to be tampered with based on the area to be tampered with;
[0101] Step S203: Based on the type of tampering operation, search for and determine the corresponding image tampering operation from the preset tampering operation information.
[0102] This embodiment can use prior Photoshop modification history operations or NLP (Natural Language Processing) analysis of documents saved from Photoshop history operations to summarize the modification operations required for the area to be modified. Thus, using a Photoshop script written in JavaScript, it can modify text images in real time and efficiently using Photoshop software.
[0103] like Figure 1 As shown, in one implementation of this invention, the automated high-quality text-based image tampering generation method further includes the following steps:
[0104] Step S300: Modify the image to be modified according to the determined image modification operation, and output and display the modified image.
[0105] In this embodiment, after determining the image tampering operation required for the image to be tampered with, a script interface function for the image tampering tool can be written according to a preset language; wherein, the preset language can be JavaScript; that is, the corresponding Photoshop script interface function is written in JavaScript to complete the actions in each operation in the table below, thereby realizing batch tampering processing.
[0106]
[0107] Specifically, in one implementation of this embodiment, step S300 includes the following steps:
[0108] Step S301: Write the script interface function of the image tampering tool according to a preset language;
[0109] Step S302: Start the image tampering tool and read the image to be tampered with through the image tampering tool;
[0110] Step S303: Read the information of the area to be tampered with in the image to be tampered with, and obtain the rectangular frame and the text information and / or numerical information inside it;
[0111] Step S304: Invoke the corresponding script interface function according to the determined image tampering operation, and tamper with the text information and / or the numerical information according to the determined image tampering operation;
[0112] Step S305: Output and display the tampered image on the corresponding terminal device according to the output path.
[0113] In the above steps, after determining the required image tampering operation, the terminal device calls the relevant control commands to open Photoshop, and then reads the original image of the text-type image through Photoshop; next, it reads the JSON file saved in the original image to obtain the specific location of the text, numbers, or patterns in the text-type image; finally, according to the above five tampering operations, it calls the relevant function interfaces of Photoshop to implement the corresponding tampering operation:
[0114] 1. Copy and paste operation: Randomly read a certain area (not the area to be tampered with) from the image to be tampered with, and copy and paste it into the area to be tampered with in the image to be tampered with; the tampered image effect is as follows. Figure 4 As shown.
[0115] 2. The stitching operation randomly reads a certain area of the image from the source image (e.g., a region of text, numbers, or patterns) and copies and pastes it into the area to be tampered with in the image to be altered; the altered image will look like this. Figure 5 As shown.
[0116] 3. Removal operation: Remove text, numbers, or patterns from the area to be tampered with in the image. Specific removal operations include the following methods: filling the background of the area to be tampered with with color, or using the clone stamp operation to clone the background color of the area to be tampered with to cover the text, numbers, or patterns, or using content-aware fill operation to clone the background of the area to be tampered with to cover the text, numbers, or patterns.
[0117] 4. Addition Operation: Randomly read a certain area (excluding the area to be tampered with) from the image to be tampered with, and add text, numbers, and patterns to one side of the randomly selected area; the tampered image effect is as follows. Figure 6 As shown.
[0118] 5. The replacement operation combines removal and addition. It removes text, numbers, or patterns from the area of the image to be altered, then adds the same text, numbers, or patterns back to the removed areas, followed by blurring. The altered image will look like this: Figure 7 As shown.
[0119] It is worth mentioning that in the above-mentioned tampering operations, all selected areas and the area to be tampered with need to be the same size, and all operations need to add Gaussian blur to the edges of the tampered area to increase the visual realism.
[0120] In one implementation of this embodiment, step S303 specifically includes the following steps:
[0121] Step S303a: Randomly read a certain area of the image from the image to be tampered with, and copy and paste it into the area to be tampered with of the image to be tampered with;
[0122] Step S303b, and / or randomly read a certain area of the image from the source image and copy and paste it into the area to be tampered with of the image to be tampered with;
[0123] Step S303c, and / or randomly read a certain area of the image from the image to be tampered with, and remove the content in the area to be tampered with using color fill, content recognition fill, or clone stamp;
[0124] Step S303d, and / or randomly read a certain area of the image from the image to be tampered with, and add text information, numerical information and patterns to one side of the randomly selected area;
[0125] Step S303e, and / or randomly read a certain area of the image from the image to be tampered with, remove the content in the area to be tampered with by color fill or content recognition fill or clone stamp, and add text information, numerical information and patterns to one side of the randomly selected area;
[0126] The randomly selected area is the same size as the area to be tampered with.
[0127] In another implementation of this embodiment, the copy-paste and splicing operations only need to ensure the alteration operation is performed correctly, while the visual effect can be further improved. Since the only difference between the copy-paste and splicing steps is the image source being copied, we will take copy-paste as an example. Currently, the size of the copied area is the same as the size of the target area. When the copied area is randomly selected from the target image, it only specifies the pasting area, not the copying area. Therefore, it can be improved to specify both the copying area and the pasting area.
[0128] like Figure 2 and Figure 3 As shown, Figure 2 This is a diagram illustrating the effect of a Photoshop operator's removal tampering operation; Figure 3 This is a schematic diagram of the screenshot image generated after automatic tampering in this embodiment. By comparison, it can be seen that the automatic tampering technology generated in this embodiment can tamper with the screenshot image as well as manually, and can simulate human tampering operations well.
[0129] Furthermore, utilizing the aforementioned automated high-quality text-based image manipulation generation method, Photoshop software can efficiently simulate human manipulation operations, performing various text-based image manipulations to quickly generate a large number of realistic training samples. For example... Figure 8 As shown, this method also achieves good tampering effects on text-based images in other scenarios, including street view store images, certificate and qualification images, card and passport images, etc., making it an efficient method for generating tampered images.
[0130] In this embodiment, to verify the effectiveness of the automated high-quality text-based image tampering generation method, the open-source image tampering detection model Dense-FCN can be used for experimentation. The experimental details are as follows:
[0131] First, the proposed automated high-quality text-based tampering image generation method was used to generate the automatically generated screenshot tampering image data shown in the table below. The number of tampering images for each of the five operations was 6290. The training set and validation set were divided at approximately a 9:1 ratio. The training set contained tampering screenshots from 10 mobile phones, and the validation set contained tampering screenshots from 3 mobile phones. The tampering screenshots generated by different mobile phone models were mutually exclusive.
[0132]
[0133]
[0134] Furthermore, in this embodiment, the screenshots tampered with by the PS operator are further fine-tuned in the aforementioned network by dividing the training and validation sets at approximately a 9:1 ratio. The resulting dataset of the PS operator is shown in the table below:
[0135]
[0136] Since image tampering localization is a pixel-level binary classification problem, the following pixel-level performance metrics can be used in this embodiment. Here, TP and FN represent the number of correctly classified and incorrectly classified tampered pixels, respectively, and TN and FP represent the number of correctly classified and incorrectly classified original pixels, respectively. Because the network's final output is a real-valued result, a threshold is needed to calculate the metric; in this embodiment, a threshold of 0.5 can be selected.
[0137]
[0138]
[0139]
[0140] Based on the automatically generated tampered data and the data tampered by PS operators, this embodiment divides the screenshots from the two datasets into training and validation sets at a 9:1 ratio. The experimental parameters are set as follows: batch size is 16, initial learning rate is 0.001, Adam is used as the optimizer, cross-entropy is used as the loss function, and training is performed for 100 epochs.
[0141] Furthermore, the verification results of Dense-FCN on screenshot image data tampered with by PS operators are shown in the table below:
[0142]
[0143]
[0144] Furthermore, the pre-trained model trained by Dense-FCN on screenshot-manipulated image data for automated high-quality text-based image generation is validated as shown in the table below:
[0145]
[0146] The comparison shows that in the automated high-quality text-based image tampering generation method, the F1 score for copy-paste operation is improved by 4.74%, the F1 score for splicing operation is improved by 8.56%, the F1 score for removal operation is improved by 28.54%, the F1 score for addition operation is improved by 9.32%, and the F1 score for replacement operation is improved by 16.26%. This demonstrates that the screenshot tampered image data of the automated high-quality text-based image tampering generation method has a certain improvement on the tampering location performance of Dense-FCN, and this embodiment has certain value.
[0147] This embodiment acquires the image to be tampered with and determines the tampered area within the image; it also acquires preset tampering operation information and determines the image tampering operation corresponding to the image to be tampered with based on the preset tampering operation information; then, it tampers with the image to be tampered with according to the determined image tampering operation, and outputs and displays the tampered image, thus realizing an automated, high-quality text-based tampered image generation scheme; this embodiment utilizes OCR technology to locate the text and number regions in text-based images, analyzes and summarizes tampering operations based on prior tampering history operations or documents saved from historical operations, and uses a written tampering tool script to tamper with text-based images in real time and efficiently.
[0148] Exemplary device
[0149] Based on the above embodiments, the present invention also provides a terminal, the principle block diagram of which can be as follows: Figure 9 As shown.
[0150] The terminal includes: a processor, memory, interface, display screen, and communication module connected via a system bus; wherein, the processor provides computing and control capabilities; the memory includes a medium and internal memory; wherein, the medium is a computer-readable storage medium storing an operating system and computer programs; the internal memory provides an environment for the operation of the operating system and computer programs in the medium; the interface is used to connect to external terminal devices, such as mobile terminals and computers; the display screen is used to display corresponding automated high-quality text-based image manipulation generation information; and the communication module is used to communicate with a cloud server or mobile terminal.
[0151] When executed by a processor, this computer program is used to implement an automated method for generating high-quality text-based tampered images.
[0152] It will be understood by those skilled in the art that Figure 9The schematic diagram shown is merely a partial structural diagram related to the present invention and does not constitute a limitation on the terminal to which the present invention is applied. A specific terminal may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0153] In one embodiment, a terminal is provided, comprising: a processor and a memory, the memory storing an automated high-quality text-based image tampering generation program, which, when executed by the processor, is used to implement the above-described automated high-quality text-based image tampering generation method.
[0154] In one embodiment, a medium is provided, wherein the medium is a computer-readable storage medium storing an automated high-quality text-based image tampering generation program, which, when executed by a processor, is used to implement the above-described automated high-quality text-based image tampering generation method.
[0155] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory.
[0156] In summary, this invention provides an automated, high-quality text-based image manipulation generation method, terminal, and medium. The method includes: acquiring an image to be manipulated and determining the region to be manipulated within the image; wherein the region to be manipulated is a text region and / or a number region within the image; acquiring preset manipulation operation information; determining an image manipulation operation corresponding to the image to be manipulated based on the preset manipulation operation information; manipulating the image according to the determined image manipulation operation; and outputting and displaying the manipulated image. This invention utilizes OCR technology to locate text and number regions in text-based images, analyzes and summarizes manipulation operations based on prior manipulation history or documents containing saved history operations, and uses a written manipulation tool script to manipulate text-based images in real-time and efficiently.
[0157] It should be understood that the application of the present invention is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.
Claims
1. An automated high-quality tampered image generation method of text class, characterized in that, The automatic high-quality text tampered image generation method comprises: acquiring a to-be-tampered image and determining a to-be-tampered region in the to-be-tampered image; wherein the to-be-tampered region is a text region and / or a number region in the to-be-tampered image; obtaining text information and / or number information in the to-be-tampered region and a corresponding region by performing OCR technology processing on the to-be-tampered image; acquiring preset tampering operation information, and determining an image tampering operation corresponding to the to-be-tampered image according to the preset tampering operation information; tampering the to-be-tampered image according to the determined image tampering operation, and outputting and displaying the tampered image; the tampering the to-be-tampered image according to the determined image tampering operation, and outputting and displaying the tampered image, comprises: starting an image tampering tool, and reading the to-be-tampered image through the image tampering tool; reading to-be-tampered region information in the to-be-tampered image to obtain a rectangular frame and text information and / or number information inside the rectangular frame; calling a corresponding script interface function according to the determined image tampering operation, and tampering the text information and / or the number information according to the determined image tampering operation; outputting and displaying the tampered image in a corresponding terminal device according to an output path; the tampering the text information and / or the number information according to the determined image tampering operation, comprises: randomly reading an image of a certain region from the to-be-tampered image, and pasting it into the to-be-tampered region of the to-be-tampered image; and / or randomly reading an image of a certain region from a source image, and pasting it into the to-be-tampered region of the to-be-tampered image; and / or randomly reading an image of a certain region from the to-be-tampered image, and removing the content in the to-be-tampered region by using color filling or content recognition filling or imitating a seal; and / or randomly reading an image of a certain region from the to-be-tampered image, and adding text information, number information and patterns on one side of the randomly selected region; and / or randomly reading an image of a certain region from the to-be-tampered image, removing the content in the to-be-tampered region by using color filling or content recognition filling or imitating a seal, and adding text information, number information and patterns on one side of the randomly selected region; wherein the randomly selected region is the same size as the to-be-tampered region. 2.The automated high-quality text-like tampered image generation method of claim 1, wherein, The acquiring the to-be-tampered image, before that, comprises: predefining an image tampering operation; wherein the image tampering operation comprises copying and pasting, splicing, removing, adding and replacing. 3.The automated high-quality text-like tampered image generation method of claim 2, wherein, The acquiring the to-be-tampered image, before that, further comprises: tampering a preset text image according to the image tampering operation, and recording the image tampering operation required in the tampering process; analyzing the recorded image tampering operation to obtain the preset tampering operation information. 4.The automated high-quality text-like tampered image generation method of claim 1, wherein, The acquiring the to-be-tampered image and determining the to-be-tampered region in the to-be-tampered image, comprises: acquiring the to-be-tampered image and detecting a text region and / or a number region in the to-be-tampered image; Mark the text area and / or the number area with a rectangular frame, and identify the text information and / or the number information in the rectangular frame; Save the rectangular frame and the text information and / or the number information inside the rectangular frame according to a preset format to determine the tampering area. 5.The automated high-quality text-like tampered image generation method of claim 1, wherein, The obtaining of the preset tampering operation information and the determination of the image tampering operation corresponding to the image to be tampered with according to the preset tampering operation information comprise: Obtaining the preset tampering operation information; Determining the tampering operation type required by the image to be tampered with according to the tampering area; According to the tampering operation type, searching and determining the corresponding image tampering operation from the preset tampering operation information. 6.The automated high-quality text-like tampered image generation method of claim 1, wherein, The starting of the image tampering tool further comprises: Writing a script interface function of the image tampering tool according to a preset language.
7. A terminal, characterized by comprising: Comprise: A processor and a memory, the memory stores an automatic high-quality text tampering image generation program, and the automatic high-quality text tampering image generation program is used to implement the automatic high-quality text tampering image generation method in any one of claims 1-6 when executed by the processor.
8. A medium characterized by, The medium is a computer readable storage medium, and the medium stores an automatic high-quality text tampering image generation program, and the automatic high-quality text tampering image generation program is used to implement the automatic high-quality text tampering image generation method in any one of claims 1-6 when executed by the processor.
Citation Information
Patent Citations
Image processing method and electronic equipment
CN111724455A
Photoshop tampered image generation method and Photoshop tampered image generation system
CN111915574A