An image tampering detection method and apparatus

By extracting single characters and performing feature analysis on screenshot images, the problem of the inability to effectively detect screenshot image tampering in existing technologies has been solved, achieving highly accurate tampering detection of screenshot images and enhancing data security.

CN114743205BActive Publication Date: 2026-03-24CHONGQING ANT CONSUMER FINANCE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-11
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing image tampering detection methods are ineffective at detecting whether screenshots have been tampered with, especially in cases of tampering in subtle areas.

Method used

By extracting individual characters from screenshot images and performing tampering detection based on the characteristics of each character, the process includes text detection, single-character extraction, and tampering judgment.

Benefits of technology

It improves the accuracy of screenshot image tampering detection, can identify subtle character alterations, prevents black market operators from tampering with the original information of screenshot images, and increases data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114743205B_ABST
    Figure CN114743205B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide an image tampering detection method and device, the method comprising: when tampering detection is performed on a target image, obtaining the target image, the target image being a screenshot image, and the target image including characters; performing single character extraction on the characters in the target image to obtain at least one single character; and determining whether the target image is tampered with according to character features of the at least one single character.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present document relates to the technical field of image processing, and particularly relates to an image tampering detection method and device. BACKGROUND

[0002] In some application scenarios, it is usually required to detect whether an image is tampered. For example, in the scenarios of identity authentication or information verification, it is required to perform tampering detection on an image uploaded by a user, etc.

[0003] Generally, when performing image tampering detection, a trained model can be used to detect information such as clarity, color difference, noise difference, etc. of an image, and the image is determined to be tampered or not based on the information. However, such a detection method is usually applicable to images obtained by shooting, and the current detection method cannot accurately detect whether a screenshot image in a screenshot scenario is tampered. SUMMARY

[0004] Embodiments of the present specification provide an image tampering detection method and device, which are used to solve the problem that the current image tampering detection scheme cannot effectively detect whether a screenshot image is tampered.

[0005] To solve the above technical problems, embodiments of the present specification are implemented as follows:

[0006] In a first aspect, an image tampering detection method is provided, comprising:

[0007] obtaining a target image to be detected, the target image being a screenshot image, and the target image comprising characters;

[0008] performing single-character extraction on the characters in the target image to obtain at least one single character;

[0009] determining whether the target image is tampered according to character features of the at least one single character.

[0010] In a second aspect, an image tampering detection device is provided, comprising:

[0011] an obtaining module configured to obtain a target image to be detected, the target image being a screenshot image, and the target image comprising characters;

[0012] a character extraction module configured to perform single-character extraction on the characters in the target image to obtain at least one single character;

[0013] a detection module configured to determine whether the target image is tampered according to character features of the at least one single character.

[0014] In a third aspect, an electronic device is provided, comprising:

[0015] a processor; and

[0016] a memory arranged to store computer-executable instructions that, when executed, cause the processor to perform the following operations:

[0017] obtain a target image to be detected, the target image being a screenshot image, the target image including characters;

[0018] perform single-character extraction on the characters in the target image to obtain at least one single character;

[0019] determine, according to a character feature of the at least one single character, whether the target image is tampered with.

[0020] In a fourth aspect, a computer-readable storage medium is provided, the computer-readable storage medium storing one or more programs, the one or more programs, when executed by an electronic device including a plurality of application programs, causing the electronic device to perform the following method:

[0021] obtain a target image to be detected, the target image being a screenshot image, the target image including characters;

[0022] perform single-character extraction on the characters in the target image to obtain at least one single character;

[0023] determine, according to a character feature of the at least one single character, whether the target image is tampered with.

[0024] The above at least one technical solution adopted by one or more embodiments of the present specification can achieve the following technical effects:

[0025] When detecting tampering of a screenshot image, by performing single-character extraction on the screenshot image and performing tampering detection according to a character feature of the at least one single character extracted, subtle character tampering in the screenshot image can be effectively detected, and thus the screenshot image can be effectively identified as being fake or not, the accuracy of the detection result can be improved, the use of image tampering by black and gray production to change the original information of the screenshot image can be prevented, and data security can be increased. In addition, since the tampering detection can be accurate to a single character, false detection of other information in the image can also be avoided. BRIEF DESCRIPTION OF DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present specification or the prior art, the drawings needed in the embodiment or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments described in the present specification, and those skilled in the art can obtain other drawings according to these drawings without creative labor.

[0027] Figure 1 is a flowchart of an embodiment of an image tampering detection method of the present specification;

[0028] Figure 2 is a flowchart of an embodiment of an image text detection method of the present specification;

[0029] Figure 3 is a flowchart of an embodiment of an image single character extraction method of the present specification;

[0030] Figure 4 is a structural diagram of an embodiment of an electronic device of the present specification;

[0031] Figure 5 is a structural diagram of an embodiment of an image tampering detection device of the present specification. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present specification, the technical solutions in the embodiments of the present specification will be described clearly and completely below in conjunction with the drawings in one or more embodiments of the present specification. Obviously, the described embodiments are only some of the embodiments of the present specification, not all the embodiments. Based on the embodiments in the present specification, all other embodiments obtained by those skilled in the art without creative labor should belong to the protection scope of the present document.

[0033] The current image tampering detection method can generally analyze the background noise, edge sharpness difference and other means of the image to perform detection when detecting the tampering of the image. However, for the screenshot image, the background noise disappears and the edge sharpness has no difference, which leads to an increase in the difficulty of identification. In addition, the current image tampering detection method is generally used for detecting a larger tampering area. When only a subtle area in the image is tampered, the detection difficulty is greater. Therefore, the current image tampering detection method cannot effectively realize the tampering detection of the screenshot image.

[0034] Therefore, the present specification provides an image tampering detection method and device. The method comprises: acquiring a target image to be detected, the target image being a screenshot image, and the target image comprising characters; performing single character extraction on the characters in the target image to obtain at least one single character; and determining whether the target image is tampered according to the character features of the at least one single character.

[0035] The technical solution provided in the specification can effectively detect subtle character tampering in the screenshot image during tamper detection of the screenshot image, and further effectively identify whether the screenshot image is fake, improve the accuracy of the detection result, prevent black and gray production from changing the original information of the screenshot image using image tampering, and increase data security. In addition, since the tamper detection can be accurate to a single character, false detection of other information in the image can also be avoided.

[0036] It should be noted that the technical solution provided by the embodiments of the specification can be used for tamper detection of images, and is particularly suitable for tamper detection of screenshot images. When performing tamper detection of images, it can be used for tamper detection of characters in images, and is particularly suitable for tamper detection of characters such as numbers.

[0037] The technical solutions provided by the embodiments of the specification will be described in detail below with reference to the accompanying drawings.

[0038] Figure 1 is a flowchart of an image tamper detection method according to an embodiment of the specification. The method is described as follows.

[0039] S102: Obtain a target image to be detected, the target image being a screenshot image, and the target image including characters.

[0040] When it is necessary to perform tamper detection on a certain screenshot image, a target image to be detected can be obtained. The target image is a screenshot image, and the target image can include characters. The characters can be Chinese characters, numbers (such as Arabic numerals 0-9), English letters, special letters (such as Greek characters), or special symbols, etc.

[0041] S104: Perform single character extraction on the characters in the target image to obtain at least one single character.

[0042] Single character extraction on the characters in the target image can be to extract each character in the target image respectively to obtain one or more single characters. For example, the target image includes 10 numbers from 0 to 9, and after single character extraction on the target image, the 10 numbers can be extracted respectively to obtain 10 single characters from 0 to 9.

[0043] Optionally, as an embodiment, performing single character extraction on the characters in the target image to obtain at least one single character can include the following S22 to S26:

[0044] S22: Perform text detection on the target image to obtain at least one sub-image, and each sub-image includes a row of characters or a column of characters.

[0045] In this embodiment, the text detection of the target image can be implemented by a pre-determined text detection model. Specifically, when the text detection model is used to detect the text of the target image, the target image can be normalized first so that the target image can meet the size requirements of the input image of the text detection model. Then, the normalized target image can be input into the text detection model, and at least one bounding box can be output after the text detection model processing. For any bounding box, the bounding box can be a bounding box obtained by the text detection model after text positioning of a row of characters or a column of characters in the target image.

[0046] After obtaining the at least one bounding box, considering that there can be a bounding box of false detection, in order to improve the detection result, the at least one bounding box can also be filtered. When filtering, the bounding box that does not meet the preset condition in the at least one bounding box can be filtered. Wherein, the bounding box that does not meet the preset condition can be that the height of the bounding box is not within the preset height range, or the width of the bounding box is not within the preset width range.

[0047] For example, in the screenshot scenario, the character size in the screenshot image is basically the same, so in the case that the screenshot image includes at least one row of characters, the height of a single row of characters is certain, and in the case that the screenshot image includes at least one column of characters, the height of a single column of characters is certain. Therefore, the width range and the height range can be set according to the character size in the screenshot image, and in the case that the screenshot image includes at least one row of characters, whether the height of the bounding box is within the preset height range can be determined when the bounding box is filtered, and if not, the bounding box needs to be filtered out. Similarly, in the case that the screenshot image includes at least one column of characters, whether the width of the bounding box is within the preset width range can be determined when the bounding box is filtered, and if not, the bounding box needs to be filtered out.

[0048] Alternatively, the width range and the height range can not be set, but the average height and the average width of the bounding box can be used for judgment. For example, in the case that the screenshot image includes multiple rows of characters, the height of each row of characters is basically the same, and the average height of the multiple bounding boxes obtained by detection can be determined, and when the bounding box is filtered, whether the difference between the height of the bounding box and the average height is greater than or equal to a set percentage (such as 50%) of the average height can be determined, and if so, the bounding box needs to be filtered out. Similarly, in the case that the screenshot image includes multiple columns of characters, the width of each column of characters is basically the same, and the average width of the multiple bounding boxes obtained by detection can be determined, and when the bounding box is filtered, whether the difference between the width of the bounding box and the average width is greater than or equal to a set percentage (such as 50%) of the average width can be determined, and if so, the bounding box needs to be filtered out.

[0049] After the at least one positioning frame that does not meet the preset condition is filtered in the positioning frame, the remaining positioning frame is the positioning frame that meets the preset condition. In this embodiment, the image corresponding to the at least one positioning frame that meets the preset condition can be determined as the at least one sub-image obtained after the target image is subjected to text detection.

[0050] Optionally, the text detection model can be a Faster-RCNN text detection network. The Faster-RCNN text detection network is a fast deep learning target detection model. The algorithm proposes an RPN candidate frame generation algorithm based on the fast rcnn, so that the target detection speed is greatly improved. Of course, the text detection model can also be other models that can realize text detection and output sub-images, which will not be illustrated one by one here.

[0051] S24: Perform binarization processing on the at least one sub-image to obtain at least one binary image.

[0052] The binarization processing here can separate the character region and the non-character region in any sub-image, that is, separate the characters and the background in any sub-image. After the at least one sub-image is subjected to binarization processing, at least one binary image can be obtained. One sub-image can correspond to one binary image, and one binary image can represent the character region and the non-character region in one sub-image. For example, the binary image can include two kinds of pixels, 0 and 1, 1 can represent the characters in the sub-image, and 0 can represent the background in the sub-image.

[0053] Optionally, when the at least one sub-image is subjected to binarization processing, the OTSU algorithm can be used. The OTSU algorithm is an algorithm for determining the threshold value of image binarization segmentation. The algorithm is also called the maximum inter-class variance method or the Otsu method. Because the threshold value obtained according to the Otsu method is used for image binarization segmentation, the inter-class variance of the foreground and the background image is maximum. Of course, other algorithms that can realize binarization processing can be used, which will not be illustrated one by one here.

[0054] S26: Perform single character extraction based on the at least one binary image to obtain at least one single character.

[0055] In this embodiment, one binary image can include one or more single characters, and one binary image can extract one or more single characters after the single character extraction based on the binary image.

[0056] Optionally, as one embodiment, the single character extraction based on the at least one binary image to obtain at least one single character can include the following S32 to S38.

[0057] S32: Extract a character image corresponding to a character region in the at least one binary image.

[0058] The binary image includes a character image corresponding to a character region and a background image corresponding to a non-character region (i.e., a background region). Here, the character image corresponding to the character region in the binary image can be extracted. One binary image can extract one character image.

[0059] S34: Perform image morphological processing on the character image to obtain a plurality of connected components.

[0060] Image morphology can also be referred to as mathematical morphology, which is one of the most widely used techniques in image processing. It is mainly used to extract image components that are meaningful for expressing and depicting the shape of a region from an image, so that the subsequent recognition work can grasp the most discriminative shape features of the target object, such as boundaries and connected regions.

[0061] In this embodiment, after performing image morphological processing on the character image, a plurality of connected components can be obtained. One character image can correspond to a plurality of connected components.

[0062] It should be noted that for a single character, if each part of the single character is connected together, one connected component can be obtained after image morphological processing of the character. For different characters, since different characters are not connected together, a plurality of connected components can be obtained after image morphological processing of the plurality of characters. For example, for a single digital character 8, since the upper and lower parts of 8 are connected together, one connected component can be obtained after image morphological processing of the digital character 8. For two digital characters 80, since 8 and 0 are not connected, two connected components can be obtained after image morphological processing of the digital characters 80, which are the connected component corresponding to 8 and the connected component corresponding to 0, respectively. The purpose of determining the connected component in this embodiment is to accurately separate one character from another.

[0063] S36: Filter the noise connected components in the plurality of connected components to obtain character connected components.

[0064] Considering that the image morphological processing of the character image can include noise connected components corresponding to noise, in order to avoid the influence of the noise connected components on the subsequent single character extraction and improve the accuracy of character extraction, after obtaining the plurality of connected components, the noise connected components in the plurality of connected components can be filtered. The connected components obtained after filtering are character connected components corresponding to characters.

[0065] Optionally, as an embodiment, when filtering the noise connected components, considering that the number of pixels occupied by the noise connected components is usually less than the number of pixels occupied by the character connected components, the noise connected components can be filtered according to the number of pixels occupied by the connected components. Specifically, for any connected component obtained in S34, it can be judged whether the number of pixels occupied by the connected component is less than a preset threshold (which can be set according to actual conditions), if yes, it can be considered that the connected component is a noise connected component, and the connected component needs to be filtered, if not, it can be considered that the connected component is a character connected component, and no filtering is needed.

[0066] S38: performing single character cutting based on the character connected components to obtain at least one single character.

[0067] After obtaining the character connected components, single character cutting can be performed based on the character connected components to obtain at least one single character. One character connected component can be cut to obtain one single character, and at least one single character can be obtained by performing single character cutting on the at least one character connected component obtained in S36.

[0068] Based on the above steps, single character extraction of the target image can be realized, and at least one single character can be obtained.

[0069] Optionally, as an embodiment, after obtaining the at least one single character, for any single character, the character feature of the single character can be determined, so that the target image can be determined to be tampered with based on the character feature of the single character subsequently. The character feature of the single character can include at least one of the following:

[0070] The number of pixels occupied by the single character; the length of the rectangular region occupied by the single character; the width of the rectangular region occupied by the single character; the horizontal position of the single character; the vertical position of the single character; the hu shape moment feature of the single character; the gray level histogram of the image region where the single character is located.

[0071] The horizontal position of the single character described above can be the horizontal position of the single character in the row or column of characters where the single character is located, or can also be the horizontal position of the single character in the entire target image. Similarly, the vertical position of the single character described above can be the vertical position of the single character in the row or column of characters where the single character is located, or can also be the vertical position of the single character in the entire target image.

[0072] The hu shape moment feature of the single character described above is a 7-dimensional feature, which can represent the shape of the single character. For the same character, if the shapes of the characters are different, such as different font number characters 1, the hu shape moment features of the characters are also different.

[0073] The above gray scale histogram is a probability distribution diagram, and is related to the background of the image region where the single character is located. Specifically, it can be a gray scale histogram of the single character and the background where the single character is located, and can represent the continuity of the background, i.e., the continuity of the background of the image region where the single character is located can be determined through the gray scale histogram.

[0074] S106: Determine whether the target image is tampered with according to the character features of the at least one single character.

[0075] In S106, it can be determined whether the target image contains a tampered character according to the character features of the at least one single character, and then whether the target image is tampered with.

[0076] Optionally, as an embodiment, when determining whether the target image is tampered with according to the character features of the at least one single character, the following steps can be included:

[0077] According to the character features of the at least one single character, tampering detection of the at least one single character is performed;

[0078] According to the tampering detection result of the single character, it is determined whether the target image is tampered with.

[0079] That is, when determining whether the target image is tampered with, the tampering detection of the at least one single character can be performed according to the character features of the at least one single character first, i.e., the tampering detection is accurate to a single character, and it is determined whether the single character is tampered with, and then the detection result of the single character is used to determine whether the target image is tampered with.

[0080] Optionally, as an embodiment, when performing tampering detection of the single character according to the character features of the at least one single character, the following steps can be included:

[0081] Obtain a pre-trained classifier;

[0082] For any single character, input the character features of the single character into the classifier to determine the probability that the single character belongs to a tampered character.

[0083] The classifier can be pre-trained through positive samples (character features of single characters in the screenshot image that are not tampered with) and negative samples (character features of single characters in the screenshot image that are tampered with). The classifier is used to determine the probability that the single character belongs to a tampered character according to the character features of the single character.

[0084] In the single-character tampering detection, a pre-trained classifier can be obtained, and then for any single character, the character feature of the single character can be input into the classifier, and the output result of the classifier is the probability that the single character belongs to the tampered character. Optionally, before the character feature of the single character is input into the classifier, the character feature of the single character can also be normalized to meet the input requirements of the classifier.

[0085] After obtaining the probability that the single character belongs to the tampered character, it can be determined whether the probability that the single character belongs to the tampered character is greater than or equal to a preset probability threshold. The preset probability threshold can be set according to actual needs, such as 80% or the like. If the result of the determination is that the probability that the single character belongs to the tampered character is greater than or equal to the preset probability threshold, it can be considered that the single character belongs to the tampered character. Conversely, if the result of the determination is that the probability that the single character belongs to the tampered character is less than the preset probability threshold, it can be considered that the single character does not belong to the tampered character.

[0086] Based on the above steps, it can be determined whether any single character in the at least one single character is a tampered character. Then, according to the detection result of the at least one single character, it can be determined whether the target image is tampered. Specifically, it can be determined whether there is a tampered single character in the at least one single character, and if there is, it can be determined that the target image is tampered, and conversely, if there is not, it can be determined that the target image is not tampered.

[0087] Optionally, as another embodiment, in the tampering detection of the single character according to the character feature of the at least one single character, the following steps can be included:

[0088] According to the feature value of the character feature of the at least one single character, an average feature value of the character feature is determined.

[0089] For any single character, it is determined whether the difference between the feature value of the character feature of the single character and the average feature value is greater than or equal to a set ratio of the average feature value.

[0090] If yes, it is determined that the single character is a tampered character.

[0091] Specifically, in the case that the number of character features is one, for example, the character feature of a single character can be any one of the length of the rectangular area occupied by the single character, the width of the rectangular area occupied by the single character, the horizontal position of the single character, and the vertical position of the single character, then the average feature value of the at least one single character for the character feature can be determined. Subsequently, for any single character, it can be judged whether the difference between the feature value of the character feature of the single character and the average feature value is greater than or equal to a set ratio of the average feature value (which can be 30%, for example). If yes, it can be indicated that the difference between the character feature of the single character and the character features of other single characters is large, and at this time, the single character can be determined to be a tampered character. If no, it can be indicated that the difference between the character feature of the single character and the character features of other single characters is small, and at this time, the single character can be determined to be a non-tampered character.

[0092] In the case that the number of character features is multiple, for example, the character feature of a single character can be at least one of the length of the rectangular area occupied by the single character, the width of the rectangular area occupied by the single character, the horizontal position of the single character, and the vertical position of the single character, then for any character feature, the average feature value of the at least one single character for the character feature can be determined, and for any single character, it can be judged whether the difference between the feature value of the character feature of the single character and the average feature value is greater than or equal to a set ratio of the average feature value (which can be 30%, for example). If yes, it can be indicated that the difference between the character feature of the single character and the character features of other single characters is large, and at this time, the single character can be determined to be a tampered character. If no, the judgment result of other character features needs to be combined, specifically, if the judgment result of the single character for multiple character features is that the difference between the feature value of the character feature of the single character and the average feature value is less than a set ratio of the average feature value, then the single character can be determined to be a non-tampered character.

[0093] Alternatively, in the judgment of whether the difference between the feature value of the character feature of the single character and the average feature value is greater than or equal to a set ratio of the average feature value, the average feature value can also be replaced by a preset reference value, that is, it is judged whether the difference between the feature value of the character feature of the single character and the preset reference value is greater than or equal to a set ratio of the preset reference value. The preset reference value can be set according to actual conditions. In this way, it is not necessary to calculate the average feature value of the character feature, thereby reducing the calculation amount in the detection process, and at the same time, in the case that there is an abnormal value in the feature value of the character feature, the average feature value calculated is also abnormal, thereby avoiding the problem that the accuracy of the detection result is low when the tampering of the single character is detected according to the average feature value.

[0094] It should be noted that, for the above two single character tampering detection methods, i.e., single character tampering detection based on the classifier and single character tampering detection based on the average feature value of the character features, in actual application, any one of the methods can be used for single character tampering detection. Preferably, in order to improve the tampering detection accuracy of the target image, the above two single character tampering detection methods can be used together for single character tampering detection, and the detection results obtained by the two detection methods are taken as a union set. When determining whether the target image is tampered with according to the detection result, it can be judged whether there is a tampered character in the union set detection result obtained by the two detection methods. If there is, it can be determined that the target image is tampered with. If not, it can be determined that the target image has not been tampered with.

[0095] Based on one or more embodiments of the present specification, when performing tampering detection on the screenshot image, a single character is extracted as a judgment basis, which is still effective for particularly subtle screenshot image text tampering; image morphology method is used for character tampering judgment, and the output result has interpretability; the text tampering detection can accurately determine the tampered character to a specific character, which can avoid false positives of other information.

[0096] The technical scheme provided by the embodiments of the present specification can effectively detect subtle character tampering in the screenshot image when performing tampering detection on the screenshot image, and can further effectively identify whether the screenshot image is fake, improve the accuracy of the detection result, prevent black and gray production from changing the original information of the screenshot image by using image tampering, and increase data security. In addition, since the tampering detection can be accurate to a single character, false detection of other information in the image can also be avoided.

[0097] The above describes specific embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different than the order in the embodiments and still achieve the desired result. In addition, the processes depicted in the figures do not necessarily require the particular order shown or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous or possible.

[0098] Figure 4 FIG. 1 is a structural schematic diagram of an electronic device according to an embodiment of the present specification. Please refer to Figure 4At the hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The memory can include a memory such as a random-access memory (RAM), and can further include a non-volatile memory such as at least one disk memory. Of course, the electronic device can further include other hardware required by a business.

[0099] The processor, the network interface, and the memory can be connected to each other through the internal bus, which can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, and a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the figure, but it does not mean that there is only one bus or only one type of bus.

[0100] The memory is used to store a program. Specifically, the program can include program code including computer operation instructions. The memory can include a memory and a non-volatile memory, and provide instructions and data to the processor.

[0101] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs, and forms an image tampering detection device at the logical level. The processor executes the program stored in the memory, and is specifically used for performing the following operations:

[0102] Obtain a target image to be detected, the target image being a screenshot image, and the target image including characters;

[0103] Single character extraction is performed on the characters in the target image to obtain at least one single character;

[0104] According to the character features of the at least one single character, it is determined whether the target image is tampered.

[0105] The above as described in the specification Figure 4The method performed by the image tampering detection apparatus disclosed in the embodiments shown can be applied in a processor or implemented by the processor. The processor can be an integrated circuit chip with processing capability. In the implementation process, the steps of the method can be completed by the integrated logic circuit or the instruction of the software form in the processor. The processor mentioned above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; or a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present specification can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the present specification can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium in the art. The storage medium is located in the memory, and the processor reads the information in the memory, and combines the hardware to complete the steps of the method.

[0106] The electronic device can also perform the method of Figures 1 to 3 , and realize the function of the image tampering detection apparatus in the embodiments shown Figures 1 to 3 . The embodiments of the present specification will not be repeated here.

[0107] Of course, in addition to the software implementation, the electronic device of the embodiments of the present specification does not exclude other implementation manners, such as logic devices or a combination of software and hardware, etc. That is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0108] The embodiments of the present specification also propose a computer readable storage medium, which stores one or more programs, the one or more programs include instructions, when the instructions are executed by the portable electronic device including a plurality of application programs, the portable electronic device can perform the method of Figures 1 to 3 the embodiments shown, and specifically used to perform the following operations:

[0109] An image to be detected is acquired, the image being a screenshot image, and the image including characters;

[0110] Single character extraction is performed on the characters in the image to obtain at least one single character;

[0111] Whether the image is tampered is determined according to a character feature of the at least one single character.

[0112] Figure 5 FIG. 1 is a structural schematic diagram of an image tamper detection device 50 according to an embodiment of the present specification. Please refer to Figure 5 In a software implementation, the image tamper detection device 50 can include an acquisition module 51, a character extraction module 52, and a detection module 53.

[0113] The acquisition module 51 acquires an image to be detected, the image being a screenshot image, and the image including characters.

[0114] The character extraction module 52 performs single character extraction on the characters in the image to obtain at least one single character.

[0115] The detection module 53 determines whether the image is tampered according to a character feature of the at least one single character.

[0116] Optionally, as an embodiment, the character extraction module 52 performs single character extraction on the characters in the image to obtain at least one single character, including:

[0117] Text detection is performed on the image to obtain at least one sub-image, and each sub-image includes a row of characters or a column of characters.

[0118] Binary processing is performed on the at least one sub-image to obtain at least one binary image.

[0119] Single character extraction is performed based on the at least one binary image to obtain at least one single character.

[0120] Optionally, as an embodiment, the character extraction module 52 performs text detection on the image to obtain at least one sub-image, including:

[0121] Normalization processing is performed on the image.

[0122] A pre-determined text detection model is used to perform text detection on the image to obtain at least one positioning box.

[0123] Positioning boxes that do not meet a preset condition are filtered from the at least one positioning box, and at least one positioning box that meets the preset condition is determined as the at least one sub-image.

[0124] Optionally, as an embodiment, the character extraction module 52 performs single character extraction based on the at least one binary image to obtain at least one single character, including:

[0125] extracting a character image corresponding to a character region in the at least one binary image;

[0126] performing image morphological processing on the character image to obtain a plurality of connected components;

[0127] filtering noise connected components in the plurality of connected components to obtain character connected components;

[0128] performing single character cutting based on the character connected components to obtain at least one single character.

[0129] Optionally, as an embodiment, after the character extraction module 52 obtains at least one single character, for any single character, the character extraction module 52 determines a character feature of the single character, and the character feature includes at least one of the following:

[0130] a number of pixels occupied by the single character; a length of a rectangular region occupied by the single character; a width of the rectangular region occupied by the single character; a horizontal position of the single character; a vertical position of the single character; a hu shape moment feature of the single character; and a gray histogram of an image region where the single character is located.

[0131] Optionally, as an embodiment, the detection module 53 determines whether the target image is tampered with according to the character feature of the at least one single character, including:

[0132] performing single character tamper detection on the at least one single character according to the character feature of the at least one single character;

[0133] determining whether the target image is tampered with according to the tamper detection result of the at least one single character.

[0134] Optionally, as an embodiment, the detection module 53 performs single character tamper detection on the at least one single character, including:

[0135] obtaining a pre-trained classifier;

[0136] for any single character, inputting the character feature of the single character into the classifier to determine a probability that the single character belongs to a tampered character;

[0137] if the probability that the single character belongs to a tampered character is greater than or equal to a preset probability threshold, determining that the single character is a tampered character.

[0138] Optionally, as an embodiment, the detection module 53 performs single-character tampering detection on the at least one single character, including:

[0139] determining an average feature value of the character feature according to the feature value of the character feature of the at least one single character;

[0140] determining whether a difference between the feature value of the character feature of any single character and the average feature value is greater than or equal to a set ratio of the average feature value;

[0141] if yes, determining that the single character is a tampered character.

[0142] Optionally, as an embodiment, the detection module 53 determines whether the target image is tampered according to the tampering detection result of the at least one single character, including:

[0143] if there is a tampered character in the at least one single character, determining that the target image is tampered.

[0144] The image tampering detection device 50 provided by the embodiments of the present specification can also perform the method of Figures 1 to 3 , and realize the functions of the image tampering detection device in Figures 1 to 3 the embodiments of the present specification. The embodiments of the present specification will not be repeated here.

[0145] In summary, the above only describes the preferred embodiments of the present specification, and is not used to limit the protection scope of the present document. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the protection scope of the present document.

[0146] The systems, devices, modules or units illustrated by the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may, for example, be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0147] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.

[0148] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover non-exclusive inclusions, so that a process, method, article or apparatus that includes a list of elements does not only include those elements, but also includes other elements not explicitly listed, or inherent to such a process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.

[0149] Each of the embodiments in the specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, for system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiment.

Claims

1. A method for detecting image tampering, comprising: Obtain the target image to be detected, wherein the target image is a screenshot image and includes characters; The characters in the target image are extracted one by one to obtain at least two single characters; Based on the feature values ​​of the character features of the at least two single characters, determine the average feature value of the character features; For any single character, determine whether the difference between the feature value of the character feature of the single character and the average feature value is greater than or equal to a set ratio of the average feature value; If so, the single character is determined to be a tampered character, and the target image is determined to be tampered with based on the tampering detection result of the at least one single character; the character features of the single character include any one of the length of the rectangular area occupied by the single character, the width of the rectangular area occupied by the single character, the horizontal position of the single character, and the vertical position of the single character; the horizontal position of the single character refers to the horizontal position of the single character in the row or column of characters it is in, and the vertical position of the single character refers to the vertical position of the single character in the row or column of characters it is in.

2. The method as described in claim 1, wherein single-character extraction is performed on the characters in the target image to obtain at least two single characters, including: Text detection is performed on the target image to obtain at least one sub-image, and each sub-image includes a line of characters or a column of characters; The at least one sub-image is binarized to obtain at least one binary image; Based on the at least one binary image, single character extraction is performed to obtain at least two single characters.

3. The method as described in claim 2, wherein text detection is performed on the target image to obtain at least one sub-image, comprising: The target image is normalized. The target image is subjected to text detection using a predetermined text detection model to obtain at least one localization box; The positioning frames that do not meet the preset conditions are filtered out, and the at least one positioning frame that meets the preset conditions is determined as the at least one sub-image.

4. The method as described in claim 2, wherein single-character extraction is performed based on the at least one binary image to obtain at least two single characters, including: Extract the character image corresponding to the character region from the at least one binary image; The character image is subjected to image morphology processing to obtain multiple connected components; The noise connected components among the multiple connected components are filtered to obtain the character connected components; Based on the character connectivity components, single-character segmentation is performed to obtain at least two single characters.

5. The method as described in claim 1, wherein determining whether the target image has been tampered with based on the tampering detection result of the at least one single character, includes: If at least one of the single characters contains a tampered character, then the target image is determined to have been tampered with.

6. An image tampering detection device, comprising: The acquisition module acquires the target image to be detected, wherein the target image is a screenshot image and includes characters; The character extraction module extracts single characters from the target image to obtain at least two single characters; The detection module determines the average feature value of the character features based on the feature values ​​of the character features of the at least two single characters; For any single character, determine whether the difference between the feature value of the character feature of the single character and the average feature value is greater than or equal to a set ratio of the average feature value; If so, the single character is determined to be a tampered character, and the target image is determined to be tampered with based on the tampering detection result of the at least one single character; the character features of the single character include any one of the length of the rectangular area occupied by the single character, the width of the rectangular area occupied by the single character, the horizontal position of the single character, and the vertical position of the single character; the horizontal position of the single character refers to the horizontal position of the single character in the row or column of characters it is in, and the vertical position of the single character refers to the vertical position of the single character in the row or column of characters it is in.

7. An electronic device, comprising: processor; as well as Memory configured to store computer-executable instructions that, when executed, cause the processor to perform the following operations: Obtain the target image to be detected, wherein the target image is a screenshot image and includes characters; The characters in the target image are extracted one by one to obtain at least two single characters; Based on the feature values ​​of the character features of the at least two single characters, determine the average feature value of the character features; For any single character, determine whether the difference between the feature value of the character feature of the single character and the average feature value is greater than or equal to a set ratio of the average feature value; If so, the single character is determined to be a tampered character, and the target image is determined to be tampered with based on the tampering detection result of the at least one single character; the character features of the single character include any one of the length of the rectangular area occupied by the single character, the width of the rectangular area occupied by the single character, the horizontal position of the single character, and the vertical position of the single character; the horizontal position of the single character refers to the horizontal position of the single character in the row or column of characters it is in, and the vertical position of the single character refers to the vertical position of the single character in the row or column of characters it is in.

8. A computer-readable storage medium storing one or more programs, which, when executed by an electronic device including multiple applications, cause the electronic device to perform the following method: Obtain the target image to be detected, wherein the target image is a screenshot image and includes characters; The characters in the target image are extracted one by one to obtain at least two single characters; Based on the feature values ​​of the character features of the at least two single characters, determine the average feature value of the character features; For any single character, determine whether the difference between the feature value of the character feature of the single character and the average feature value is greater than or equal to a set ratio of the average feature value; If so, the single character is determined to be a tampered character, and the target image is determined to be tampered with based on the tampering detection result of the at least one single character; the character features of the single character include any one of the length of the rectangular area occupied by the single character, the width of the rectangular area occupied by the single character, the horizontal position of the single character, and the vertical position of the single character; the horizontal position of the single character refers to the horizontal position of the single character in the row or column of characters it is in, and the vertical position of the single character refers to the vertical position of the single character in the row or column of characters it is in.

Citation Information

Patent Citations

  • Method for processing text area in natural scene image based on hybrid network

    CN109753962A

  • Method, device and system for recognizing tampering of bill number area and readable medium

    CN112307824A

  • Image processing system, image processing method, and storage medium

    CN112839141A