CN-121985076-A - Picture processing method and device
Abstract
The embodiment of the application discloses a picture processing method and device. The method is executed in a C/C++ layer, and the method comprises the steps of responding to a picture shooting request, calling a dynamic library corresponding to a camera function, obtaining initial picture data shot by the camera through the dynamic library, conducting signature processing on the initial picture data to obtain initial picture data comprising a digital signature, conducting format conversion and alpha channel coding processing on the initial picture data to obtain intermediate picture data comprising an alpha channel coding value, enabling the intermediate picture data to be used for adding a watermark by a client to obtain a target picture, responding to a storage or uploading request aiming at the target picture, verifying the digital signature and the alpha channel coding value included in the target picture, and detecting whether the target picture has a tampering risk according to a verification result. The application can increase the difficulty of tampering the picture data, can effectively detect whether the picture data has tampering risk, and ensures the authenticity of the picture data.
Inventors
- LEI ZHEN
- LI XUGANG
- WANG DI
- Zhan Gangao
- HAN FULIN
Assignees
- 北京小白羽科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20251128
Claims (10)
- 1. A picture processing method, the picture processing method being performed in a C/c++ layer, comprising: In response to detecting a picture shooting request, calling a dynamic library corresponding to a camera function, and acquiring initial picture data shot by a camera through the dynamic library; Carrying out signature processing on the initial picture data to obtain initial picture data comprising a digital signature; performing format conversion and alpha channel coding processing on the initial picture data to obtain intermediate picture data comprising an alpha channel coding value, wherein the intermediate picture data is used for adding a watermark by a client to obtain a target picture; And verifying the digital signature and the alpha channel coding value included in the target picture in response to a storage or uploading request for the target picture, and detecting whether the target picture has a tampering risk according to a verification result.
- 2. The method according to claim 1, wherein said performing format conversion and alpha channel encoding on said initial picture data to obtain intermediate picture data including an alpha channel encoded value comprises: performing format conversion on the initial picture data to obtain intermediate picture data in RGBA format; and acquiring a preset target coding strategy, and coding an alpha channel of the intermediate picture data in the RGBA format according to the target coding strategy to obtain the intermediate picture data comprising an alpha channel coding value.
- 3. The method according to claim 2, wherein said verifying the alpha channel encoding value included in the target picture comprises: Encoding the alpha channel of the target picture according to the target encoding strategy to obtain an alpha channel encoding value of the target picture; And carrying out consistency verification on the obtained alpha channel coding value of the target picture and the alpha channel coding value carried by the target picture.
- 4. The method of claim 1, wherein signing the initial picture data results in initial picture data comprising a digital signature, comprising: and acquiring a preset target encryption strategy, and carrying out signature processing on the initial picture data according to the target encryption strategy to obtain the initial picture data comprising the digital signature, wherein the digital signature at least comprises a time stamp and camera parameters.
- 5. The method according to claim 1, further comprising, before the calling the dynamic library corresponding to the camera function: After loading a dynamic library corresponding to a camera function or loading the dynamic library when the client is started, acquiring a Cyclic Redundancy Check (CRC) value of the dynamic library loaded to a memory; And acquiring the CRC value when the dynamic library is compiled originally, carrying out consistency verification on the CRC value when the dynamic library is compiled originally and the CRC value of the dynamic library loaded into a memory, and detecting whether the dynamic library has a tampering risk according to a consistency verification result.
- 6. The method according to claim 1, wherein the method further comprises: Before a system function corresponding to a camera function is called, acquiring a function pointer of the system function corresponding to the camera function and an objective function pointer of the system function corresponding to the camera function, which are loaded to a memory; And carrying out consistency verification on the target function pointer and the function pointer of the system function corresponding to the camera function loaded to the memory, and detecting whether the system function corresponding to the camera function has a tampering risk according to a consistency verification result.
- 7. The method according to any one of claims 1-6, further comprising: In response to detecting the risk of tampering, performing risk processing including at least one of error reporting, crashing, user identity authentication, reinstalling the client, and discarding the picture obtained at the current stage.
- 8. A picture processing apparatus, characterized by comprising: the image acquisition unit is configured to respond to the detection of the image shooting request, call a dynamic library corresponding to the camera function, and acquire initial image data shot by the camera through the dynamic library; the signature processing unit is configured to perform signature processing on the initial picture data to obtain initial picture data comprising a digital signature; the coding processing unit is configured to perform format conversion and alpha channel coding processing on the initial picture data to obtain intermediate picture data comprising an alpha channel coding value, wherein the intermediate picture data is used for adding a watermark by a client to obtain a target picture; The image verification unit is configured to respond to a storage or uploading request for the target image, verify the digital signature and the alpha channel coding value included in the target image, and detect whether the target image has a tampering risk according to a verification result.
- 9. An electronic device, comprising: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
- 10. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-7.
Description
Picture processing method and device Technical Field The present application relates to the field of image processing technologies, and in particular, to a method and an apparatus for processing a picture. Background With the continuous development of image processing technology, digital images have been widely used in various scenes. The application service of generating the watermark by using the picture is a typical application, and after the user uses the client to shoot the picture, the user can generate the watermark for the picture, including time watermark, longitude and latitude watermark, address watermark and the like, so as to perform attendance management, evidence collection, engineering quality acceptance and the like. However, at present, no perfect processing method exists for the phenomena of maliciously modifying, forging or replacing the picture data, so that the authenticity of the picture data cannot be guaranteed. Disclosure of Invention In view of the above, the present application provides a method and apparatus for processing a picture, so as to detect whether the picture has a risk of tampering, and improve the authenticity of the picture data. The application provides the following scheme: According to the method, a dynamic library corresponding to a camera function is called in response to a picture shooting request, initial picture data shot by the camera is obtained through the dynamic library, signature processing is conducted on the initial picture data to obtain the initial picture data comprising a digital signature, format conversion and alpha channel coding processing are conducted on the initial picture data to obtain intermediate picture data comprising an alpha channel coding value, the intermediate picture data is used for being added with a watermark by a client to obtain a target picture, the digital signature and the alpha channel coding value contained in the target picture are verified in response to a storage or uploading request for the target picture, and whether the target picture has a tampering risk or not is detected according to a verification result. Optionally, the performing format conversion and alpha channel coding on the initial picture data to obtain intermediate picture data including an alpha channel coding value includes performing format conversion on the initial picture data to obtain intermediate picture data in RGBA format, obtaining a preset target coding strategy, and coding an alpha channel of the intermediate picture data in RGBA format according to the target coding strategy to obtain intermediate picture data including the alpha channel coding value. Optionally, the verification of the alpha channel coding value included in the target picture comprises coding an alpha channel of the target picture according to a target coding strategy to obtain the alpha channel coding value of the target picture, and verifying consistency between the obtained alpha channel coding value of the target picture and the alpha channel coding value carried by the target picture. Optionally, the step of performing signature processing on the initial picture data to obtain initial picture data including a digital signature includes obtaining a preset target encryption policy, and performing signature processing on the initial picture data according to the target encryption policy to obtain the initial picture data including the digital signature, where the digital signature at least includes a timestamp and a camera parameter. Optionally, before the dynamic library corresponding to the camera function is called, after the dynamic library corresponding to the camera function is loaded, or after the dynamic library is loaded when the client is started, a Cyclic Redundancy Check (CRC) value of the dynamic library loaded to the memory is obtained, the CRC value of the original compiling dynamic library is obtained, consistency verification is carried out on the CRC value of the original compiling dynamic library and the CRC value of the dynamic library loaded to the memory, and whether the dynamic library has a tampering risk is detected according to a consistency verification result. Optionally, before the system function corresponding to the camera function is called, acquiring a function pointer of the system function corresponding to the camera function loaded to the memory and an objective function pointer of the system function corresponding to the camera function, performing consistency verification on the objective function pointer and the function pointer of the system function corresponding to the camera function loaded to the memory, and detecting whether the system function corresponding to the camera function has a tampering risk according to a consistency verification result. Optionally, the method further comprises performing risk processing including at least one of error reporting, crash, user identity authentication, reinstallation of the client