CN-121982496-A - Image tampering detection method and device
Abstract
The embodiment of the application discloses a tamper detection method and device for an image, which mainly comprise the steps of acquiring a first feature set uploaded after a first client acquires the image in response to an image acquisition event, wherein the acquired image is provided with a watermark, the first feature set comprises at least one type of feature extracted from the acquired image, storing the corresponding relation between the identification of the acquired image and the first feature set, acquiring a second feature set of the target image in response to a tamper detection request from a second client for the target image, inquiring the first feature set of the target image based on the identification of the target image, wherein the second feature set comprises at least one type of feature extracted from the target image, the second feature set is consistent with the feature type contained in the first feature set, and detecting whether the target image is tampered or not based on the second feature set of the target image and the first feature set of the target image. This way, the accuracy of image tamper detection is improved.
Inventors
- LAI ZHENYI
- Zhan Gangao
- LI XUGANG
- LEI ZHEN
- WANG DI
Assignees
- 汇海银河(成都)科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20251128
Claims (15)
- 1. A method of tamper detection of an image, the method comprising: Acquiring a first feature set uploaded by a first client after an image is acquired in response to an image acquisition event, wherein the acquired image is provided with a watermark, the first feature set comprises at least one type of feature extracted from the acquired image, and the corresponding relation between the identification of the acquired image and the first feature set is stored; Responding to a tamper detection request from a second client, wherein the tamper detection request comprises a target image, a second feature set of the target image is obtained, and a first feature set of the target image is queried based on the identification of the target image, the second feature set comprises at least one type of feature extracted from the target image, and the second feature set is consistent with the feature type contained in the first feature set; based on the second feature set of the target image and the first feature set of the target image, whether the target image is tampered is detected.
- 2. The method of claim 1, wherein the target image has a watermark and a security code, the watermark comprising a temporal watermark, the at least one type of feature comprising a temporal feature, the acquiring the second set of features of the target image comprising at least one of: Performing word recognition on the target image to obtain first time information corresponding to the time watermark, and determining the time characteristic based on the first time information; Extracting second time information in EXIF information of the target image, and determining the time characteristics based on the second time information; and performing character recognition on the target image to obtain anti-counterfeiting code information corresponding to the target image, decrypting the anti-counterfeiting code information to obtain third time information of the target image, and determining the time characteristic based on the third time information.
- 3. The method of claim 2, wherein the detecting whether the target image is tampered based on the second feature set of the target image and the first feature set of the target image comprises: comparing whether the time features in the second feature set and the time features in the first feature set are the same, and if not, determining that the target image has a tampering risk.
- 4. The method of claim 1, wherein the target image has anti-counterfeiting code, wherein the at least one type of feature comprises latitude and longitude features, and wherein the acquiring the second feature set of the target image comprises at least one of: Extracting first longitude and latitude information in EXIF information of the target image, and determining longitude and latitude characteristics based on the first longitude and latitude information; and performing character recognition on the target image to obtain anti-counterfeiting code information corresponding to the target image, decrypting the anti-counterfeiting code information to obtain second longitude and latitude information of the target image, and determining the longitude and latitude characteristics based on the second longitude and latitude information.
- 5. The method of claim 4, wherein the detecting whether the target image is tampered based on the second feature set of the target image and the first feature set of the target image comprises: Determining whether the distance between the longitude and latitude features in the second feature set and the longitude and latitude features in the first feature set exceeds a preset distance threshold, and if so, determining that the target image has a tampering risk.
- 6. The method of claim 1, wherein the target image has a watermark, the target image has a watermark comprising an address watermark, the at least one type of feature comprises an address feature, and acquiring the second set of features of the target image comprises at least one of: Performing word recognition on the target image to obtain first address information corresponding to the address watermark, and determining the address characteristics based on the first address information; And extracting second address information in EXIF information of the target image, and determining the address feature based on the second address information.
- 7. The method of claim 6, wherein the detecting whether the target image is tampered based on the second feature set of the target image and the first feature set of the target image comprises: And determining whether cosine similarity between the address features in the second feature set and the address features in the first feature set is lower than a preset similarity threshold, and if so, determining that the target image has a tampering risk.
- 8. The method of claim 1, wherein the at least one type of feature comprises a coded sequence feature, and acquiring the second set of features of the target image comprises: converting the target image into a gray scale image; At least one filtering process is carried out on the gray level image to obtain at least one filtered image, wherein the filtering process comprises median filtering process, edge filtering process or local binary filtering process; and respectively carrying out binarization processing on the at least one filtered image, and respectively carrying out vector coding on each image obtained by the binarization processing to obtain at least one coding sequence characteristic.
- 9. The method of claim 8, wherein the detecting whether the target image is tampered based on the second feature set of the target image and the first feature set of the target image comprises: and determining whether cosine similarity between the coding sequence features in the second feature set and the coding sequence features in the first feature set is lower than a preset similarity threshold, and if so, determining that the target image has a tampering risk.
- 10. The method of claim 1, wherein the at least one type of feature comprises a plurality of scale image features, the acquiring the second set of features of the target image comprising: converting the target image into a gray scale image; masking the mosaic area in the gray level image to obtain a target gray level image; and respectively carrying out convolution processing on the target gray level image based on different convolution kernels to obtain image features of multiple scales of the target image.
- 11. The method of claim 10, wherein the detecting whether the target image is tampered based on the second feature set of the target image and the first feature set of the target image comprises: Determining tamper thermodynamic diagrams corresponding to the multiple scales respectively based on the image features of the multiple scales included in the second feature set of the target image and the image features of the multiple scales included in the first feature set of the target image; Based on first weight parameters corresponding to the scales, respectively, carrying out weighted fusion on the tamper thermodynamic diagrams corresponding to the scales, and obtaining a fusion thermodynamic diagram, wherein pixel values corresponding to pixels included in the fusion thermodynamic diagram are used for representing the probability that the pixels are tamper areas; based on the fusion thermodynamic diagram, it is determined whether the target image is at risk of tampering.
- 12. The method of claim 11, wherein the second feature set further comprises a mosaic probability map, the acquiring the second feature set of the target image further comprising: Performing mosaic detection on the gray level image to obtain a mosaic probability map corresponding to the target image, wherein pixel values corresponding to pixels included in the mosaic probability map are used for representing the probability that the pixels are mosaic areas; the determining whether the target image has a risk of tampering based on the fusion thermodynamic diagram includes: Determining a target mosaic probability map based on the mosaic probability map included in the second feature set of the target image and the mosaic probability map included in the first feature set of the target image; The target mosaic probability map and the fusion thermodynamic diagram are subjected to weighted fusion based on a second weight parameter, a target thermodynamic diagram is obtained, pixel values corresponding to pixels included in the target thermodynamic diagram are used for representing the probability that the pixels are tampered areas, the second weight parameter is determined based on the ratio of the number of pixels included in a communication area in the target mosaic probability map to the number of all pixels included in the target mosaic probability map, the communication area comprises at least a preset number of non-zero pixels, the pixel value corresponding to at least one pixel is larger than the preset probability, and the non-zero pixels are pixels with non-zero corresponding pixel values; based on the target thermodynamic diagram, it is determined whether the target image is at risk of tampering.
- 13. An image tamper detection device, the device comprising: A first obtaining unit configured to obtain a first feature set uploaded by a first client after an image is acquired in response to an image acquisition event, the acquired image having a watermark, the first feature set including at least one type of feature extracted from the acquired image, and store a correspondence between an identification of the acquired image and the first feature set; A second obtaining unit configured to respond to a tamper detection request from a second client, the tamper detection request including a target image, obtain a second feature set of the target image, and query a first feature set of the target image based on an identification of the target image, the second feature set including at least one type of feature extracted from the target image, the second feature set being consistent with a feature type included in the first feature set; And a detection unit configured to detect whether the target image is tampered based on the second feature set of the target image and the first feature set of the target image.
- 14. An electronic device, comprising: One or more processors, and A memory associated with the one or more processors for storing program instructions that, when read for execution by the one or more processors, perform the steps of the method of any of claims 1 to 12.
- 15. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the method of any one of claims 1 to 12.
Description
Image tampering detection method and device Technical Field The present application relates to the field of tamper detection technologies, and in particular, to a method and an apparatus for detecting tampering of an image. Background With the continuous development of technology, the phenomenon of tampering with the generated image is increasingly common and the means are more complex and diversified. Image tampering can have serious negative impact on various business areas, whether to propagate false information, to make malicious attacks, or to mask the real situation. The watermark camera application is a mobile application program capable of automatically adding various information watermarks when taking pictures, and is widely applied to scenes such as work recording, life card punching, attendance management, content creation, evidence collection, engineering quality acceptance and the like. Including time watermarks, longitude and latitude watermarks, location watermarks, and the like. At present, the phenomenon of malicious tampering of image data is serious, and the authenticity of an image containing a watermark issued by a user cannot be determined, so that a technology capable of detecting whether the image is tampered is needed. Disclosure of Invention The application provides a method and a device for detecting tampering of an image, which are used for detecting tampering of image data. The application provides the following scheme: According to a first aspect, there is provided a tamper detection method of an image, the method comprising: Acquiring a first feature set uploaded by a first client after an image is acquired in response to an image acquisition event, wherein the acquired image is provided with a watermark, the first feature set comprises at least one type of feature extracted from the acquired image, and the corresponding relation between the identification of the acquired image and the first feature set is stored; Responding to a tamper detection request from a second client, wherein the tamper detection request comprises a target image, a second feature set of the target image is obtained, and a first feature set of the target image is queried based on the identification of the target image, the second feature set comprises at least one type of feature extracted from the target image, and the second feature set is consistent with the feature type contained in the first feature set; based on the second feature set of the target image and the first feature set of the target image, whether the target image is tampered is detected. According to an implementation manner of the embodiment of the present application, the target image has a watermark and an anti-counterfeiting code, the watermark includes a time watermark, the at least one type of feature includes a time feature, and the acquiring the second feature set of the target image includes at least one of the following: Performing word recognition on the target image to obtain first time information corresponding to the time watermark, and determining the time characteristic based on the first time information; Extracting second time information in EXIF information of the target image, and determining the time characteristics based on the second time information; and performing character recognition on the target image to obtain anti-counterfeiting code information corresponding to the target image, decrypting the anti-counterfeiting code information to obtain third time information of the target image, and determining the time characteristic based on the third time information. According to an implementation manner of the embodiment of the present application, the detecting whether the target image is tampered based on the second feature set of the target image and the first feature set of the target image includes: comparing whether the time features in the second feature set and the time features in the first feature set are the same, and if not, determining that the target image has a tampering risk. According to an implementation manner of the embodiment of the present application, the target image has anti-fake code, the at least one type of feature includes longitude and latitude features, and the acquiring the second feature set of the target image includes at least one of the following: Extracting first longitude and latitude information in EXIF information of the target image, and determining longitude and latitude characteristics based on the first longitude and latitude information; and performing character recognition on the target image to obtain anti-counterfeiting code information corresponding to the target image, decrypting the anti-counterfeiting code information to obtain second longitude and latitude information of the target image, and determining the longitude and latitude characteristics based on the second longitude and latitude information. According to an implementation manner of the embodiment of