Picture processing method and device

By signing and encoding the alpha channel of images at the C/C++ layer, and verifying them before saving or uploading, the problem of easily tampered image data is solved, thus ensuring the authenticity and security of image data.

CN121985076APending Publication Date: 2026-05-05BEIJING XIAOBAIYU TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511788030.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-28
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

In existing technologies, image data is easily modified, forged, or replaced maliciously, making it impossible to guarantee the authenticity of image data.

Method used

Image processing is performed at the C/C++ layer. Images are signed and encoded using digital signatures and alpha channel encoding, and double-verification is performed before saving or uploading to ensure the authenticity of the images.

Benefits of technology

It improves the authenticity of image data, increases the difficulty of tampering, can accurately identify whether an image has been tampered with, and enhances the security of image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121985076A_ABST
    Figure CN121985076A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a picture processing method and device. The method is executed on a C / C + + layer, and comprises the following steps: in response to a detected picture shooting request, calling a dynamic library corresponding to a camera function, and obtaining initial picture data shot by a camera through the dynamic library; performing signature processing on the initial picture data to obtain initial picture data including a digital signature; performing format conversion and alpha channel coding processing on the initial picture data to obtain intermediate picture data including an alpha channel coding value, the intermediate picture data being used for being added with a watermark by a client to obtain a target picture; and in response to a storage or uploading request for 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 or not according to a verification result. Through the method, the tampering difficulty of the picture data can be increased, meanwhile, whether the picture data has the tampering risk or not can be effectively detected, and the authenticity of the picture data is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to an image processing method and apparatus. Background Technology

[0002] With the continuous development of image processing technology, digital images have been widely used in various scenarios. Image watermarking is a typical application; users can generate watermarks for photos after taking them using a client, including time watermarks, latitude and longitude watermarks, and address watermarks, for purposes such as attendance management, evidence collection, and project quality acceptance. However, currently, there are no perfect methods to deal with malicious modification, forgery, or replacement of image data, making it impossible to guarantee the authenticity of image data. Summary of the Invention

[0003] In view of this, this application provides an image processing method and apparatus to facilitate the detection of whether an image is at risk of tampering and to improve the authenticity of image data.

[0004] This application provides the following solution: Firstly, an image processing method is provided, which is executed at the C / C++ layer. The method includes: in response to detecting an image capture request, calling a dynamic library corresponding to a camera function to obtain initial image data captured by the camera through the dynamic library; performing signature processing on the initial image data to obtain initial image data including a digital signature; performing format conversion and alpha channel encoding processing on the initial image data to obtain intermediate image data including an alpha channel encoded value, the intermediate image data being used by the client to add a watermark to obtain a target image; and in response to a request to save or upload the target image, verifying the digital signature and alpha channel encoded value included in the target image, and detecting whether the target image has a risk of tampering based on the verification result.

[0005] Optionally, the step of performing format conversion and alpha channel encoding processing on the initial image data to obtain intermediate image data including alpha channel encoded values ​​includes: converting the initial image data to obtain intermediate image data in RGBA format; obtaining a pre-set target encoding strategy, and encoding the alpha channel of the RGBA format intermediate image data according to the target encoding strategy to obtain intermediate image data including alpha channel encoded values.

[0006] Optionally, verifying the alpha channel encoding value included in the target image includes: encoding the alpha channel of the target image according to the target encoding strategy to obtain the alpha channel encoding value of the target image; and verifying the consistency between the obtained alpha channel encoding value of the target image and the alpha channel encoding value carried by the target image.

[0007] Optionally, the step of signing the initial image data to obtain initial image data including a digital signature includes: obtaining a pre-set target encryption strategy, and signing the initial image data according to the target encryption strategy to obtain the initial image data including a digital signature, wherein the digital signature includes at least a timestamp and camera parameters.

[0008] Optionally, before calling the dynamic library corresponding to the camera function, the method further includes: after loading the dynamic library corresponding to the camera function, or after loading the dynamic library when the client starts, obtaining the cyclic redundancy check (CRC) value of the dynamic library loaded into memory; obtaining the CRC value when the dynamic library was originally compiled, and performing a consistency verification between the CRC value when the dynamic library was originally compiled and the CRC value of the dynamic library loaded into memory, and detecting whether the dynamic library has a risk of tampering based on the consistency verification result.

[0009] Optionally, the method further includes: before calling the system function corresponding to the camera function, obtaining the function pointer of the system function corresponding to the camera function loaded into memory, and the target function pointer of the system function corresponding to the camera function; performing consistency verification on the target function pointer and the function pointer of the system function corresponding to the camera function loaded into memory, and detecting whether the system function corresponding to the camera function has the risk of tampering based on the consistency verification result.

[0010] Optionally, the method further includes: in response to detecting a risk of tampering, performing risk handling, which includes at least one of error reporting, crashing, performing user authentication, reinstalling the client, and discarding the image obtained in the current stage.

[0011] Secondly, an image processing apparatus is provided, comprising: an image acquisition unit configured to, in response to a detected image capture request, invoke a dynamic library corresponding to a camera function to acquire initial image data captured by the camera through the dynamic library; a signature processing unit configured to perform signature processing on the initial image data to obtain initial image data including a digital signature; an encoding processing unit configured to perform format conversion and alpha channel encoding processing on the initial image data to obtain intermediate image data including an alpha channel encoded value, the intermediate image data being used by a client to add a watermark to obtain a target image; and an image verification unit configured to, in response to a save or upload request for the target image, verify the digital signature and alpha channel encoded value included in the target image, and detect whether the target image has a risk of tampering based on the verification result.

[0012] Thirdly, an electronic device is provided, comprising: One or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in the first aspect above.

[0013] Fourthly, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.

[0014] According to the specific embodiments provided in this application, the following technical effects are disclosed: This application migrates operations such as signing, encoding, verifying, saving, or uploading camera-captured images to the C / C++ layer. The C / C++ layer processes the camera-captured images instead of the JAVA layer, and during processing, it performs dual verification of the target image based on both the digital signature and the alpha channel encoding value, accurately detecting whether the target image has been tampered with. Therefore, the image processing method proposed in this application, by incorporating a series of protection mechanisms during image processing at the C / C++ layer, increases the difficulty of image data tampering and effectively identifies whether image data has been tampered with, thereby improving the authenticity of the image data.

[0015] Of course, any product implementing this application does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a system architecture diagram applicable to the embodiments of this application; Figure 2 This application provides a flowchart of an image processing method; Figure 3 A schematic block diagram of an image processing apparatus provided in an embodiment of this application; Figure 4 A schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0019] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0020] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0021] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."

[0022] Typically, the Java layer is used to capture, watermark, save, and upload images taken by the camera of a terminal device. However, image processing using the Java layer is highly susceptible to exposing numerous potential attack surfaces, making it extremely vulnerable to data tampering or the injection of hooks.

[0023] In view of this, this application provides a new approach. To facilitate understanding of this application, the system architecture on which this application is based will first be described. Figure 1 An exemplary system architecture that can be applied to embodiments of this application is shown, such as Figure 1 As shown, the system architecture may include: client and server sides of the application service.

[0024] The server and client are the two main components of an application service. The server side uses a server as its primary hardware infrastructure and may include one or more software service modules. The server and client form a collaborative front-end and back-end.

[0025] The user terminal where the client resides can include, but is not limited to, smart mobile terminals, wearable devices, and PCs (Personal Computers). Smart mobile devices can include devices such as mobile phones, tablets, PDAs (Personal Digital Assistants), and connected car terminals. Wearable devices can include devices such as smartwatches, smart glasses, smart bracelets, VR (Virtual Reality) devices, AR (Augmented Reality) devices, and mixed reality devices (i.e., devices that support both virtual and augmented reality), etc.

[0026] The client can be an application located on the user's terminal, or it can be a plugin or software development kit (SDK) or other functional unit set in the application.

[0027] A server can be a standalone server, a server cluster, or a cloud server. A cloud server, also known as a cloud computing server or cloud host, is a hosting product within the cloud computing service system, designed to address the shortcomings of traditional physical hosts and Virtual Private Servers (VPS) services, such as high management difficulty and weak service scalability.

[0028] It should be understood that Figure 1 The server and client shown are merely illustrative. Depending on the implementation requirements, there can be any number of servers and clients.

[0029] Figure 2 This is a flowchart of an image processing method provided in an embodiment of this application. This method can be executed by a C / C++ layer. Figure 2 As shown, the method may include the following steps: Step 201: In response to the detection of an image capture request, call the dynamic library corresponding to the camera function and obtain the initial image data captured by the camera through the dynamic library.

[0030] Step 203: Sign the initial image data to obtain initial image data including a digital signature.

[0031] Step 205: Perform format conversion and alpha channel encoding on the initial image data to obtain intermediate image data including alpha channel encoded values. The intermediate image data is used by the client to add watermarks to obtain the target image.

[0032] Step 207: In response to a save or upload request for the target image, verify the digital signature and alpha channel encoding value of the target image, and detect whether the target image is at risk of being tampered with based on the verification results.

[0033] As can be seen from the above process, this application can migrate operations such as signing, encoding, verifying, saving, or uploading images captured by the camera to the C / C++ layer. The C / C++ layer replaces the JAVA layer in processing the images captured by the camera. During processing, the target image is double-verified based on the digital signature and the alpha channel encoding value, accurately detecting whether the target image has been tampered with. Therefore, the image processing method proposed in this application, by combining a series of protection mechanisms during image processing at the C / C++ layer, can increase the difficulty of image data tampering and effectively identify whether image data is at risk of tampering, thereby improving the authenticity of the image data.

[0034] It should be noted that the image processing process proposed in this application involves multiple image data, such as initial image data, intermediate image data, and target image. The authenticity of the image data recorded in the embodiments of this application refers to the authenticity of at least one of the initial image data, intermediate image data, and target image.

[0035] The following describes in detail each step of the above process and the effects that can be further produced, with reference to the embodiments. First, step 201, namely "in response to the detection of an image capture request, calling the dynamic library corresponding to the camera function, and obtaining the initial image data captured by the camera through the dynamic library", will be described in detail with reference to the embodiments.

[0036] In this embodiment of the application, the user can trigger the image capture operation through the client. The user can trigger the image capture request operation in a variety of ways. For example, the user can trigger the image capture request operation by touching the screen and clicking; or by pressing a physical button; or by setting an automatic timed shooting mode.

[0037] In traditional implementations, the client acquires images captured by the camera and processes those images within the Java layer. This means the image processing device is written in Java and runs on the Java Virtual Machine. Because the bytecode generated after editing the Java layer is semi-structured, with clearly defined classes, methods, and variable names, hooking the Java layer is relatively easy, making it easy for attackers to decompile near-original Java code. To increase the difficulty of cracking, this application introduces a C / C++ layer image processing device. This involves writing the image processing device in C / C++ and compiling it into native machine code communication logic. Since it is directly compiled into machine code, decompilers can only reconstruct it as assembly language, lacking logical interfaces of classes and methods, and requiring native hooking techniques, making it much more difficult to crack.

[0038] When the image processing device in the C / C++ layer detects an image capture request, it can call the dynamic library corresponding to the camera function.

[0039] A dynamic library refers to a collection of executable code loaded at runtime, containing reusable functions, global variables, and resources. In this embodiment, the dynamic library corresponding to the camera function includes a collection of executable code used to implement the camera function.

[0040] It should be noted that before calling the dynamic library corresponding to the camera function, the dynamic library is loaded into memory for use. In this application, a corresponding verification operation is also performed before calling the dynamic library to prevent the dynamic library from being tampered with.

[0041] As one possible approach, the specific process of verifying the dynamic library corresponding to the camera function before the C / C++ layer image processing device calls the dynamic library includes: S11. After loading the dynamic library corresponding to the camera function, or after loading the dynamic library when the client starts, obtain the cyclic redundancy check (CRC) value of the dynamic library loaded into memory.

[0042] It should be noted that loading a dynamic library into memory carries the potential for exposing an attack surface. The attacked dynamic library may differ from the original compiled dynamic library, making it difficult to guarantee the authenticity of the initial image data captured by the camera based on the attacked dynamic library. Therefore, this application verifies the dynamic library loaded into memory by obtaining its Cyclic Redundancy Check (CRC) value.

[0043] Cyclic redundancy check (CRC) is a hash function that generates a short, fixed-length checksum based on data such as network data packets or computer files. It is primarily used to detect or verify errors that may occur during data transmission or storage. The generated number is calculated before transmission or storage and appended to the data; the receiver then checks this to determine if the data has been altered. Generally, a CRC value is a 32-bit integer.

[0044] It should also be noted that the embodiments of this application only need to ensure that the dynamic library corresponding to the called camera function is verified as untampered data, and do not limit the specific implementation stage of the verification. That is to say, the dynamic library corresponding to the camera function can be verified at different running stages. Optionally, the verification can be performed after loading the dynamic library corresponding to the camera function; alternatively, the verification can be performed immediately after loading the dynamic library when the client starts.

[0045] S12, obtain the CRC value when the original dynamic library was compiled, and perform consistency verification between the CRC value when the original dynamic library was compiled and the CRC value of the dynamic library loaded into memory. Based on the consistency verification result, detect whether the dynamic library has the risk of tampering.

[0046] The discrepancy between the CRC value of the original compiled dynamic library and the CRC value of the dynamic library loaded into memory indicates that the dynamic library was attacked during the loading process, which may have led to the dynamic library being maliciously modified, forged, or replaced. In this case, the dynamic library is confirmed to be at risk of being tampered with.

[0047] As can be seen from the above process, this application can verify the consistency between the CRC value of the original compiled dynamic library and the CRC value of the dynamic library loaded into memory, detect whether the dynamic library has the risk of tampering, ensure the authenticity and integrity of the dynamic library corresponding to the called camera function, and further improve security.

[0048] It should be noted that there is a great risk of tampering or hooking during the process of calling system functions. This application can implement anti-hook technology at the C / C++ layer to prevent common dynamic analysis tools (such as Frida) from hooking by modifying system function pointers, injecting code, etc.

[0049] As one possible implementation, before calling the system function corresponding to the camera function, the image processing device in the C / C++ layer can obtain the function pointer of the system function corresponding to the camera function loaded into memory, as well as the target function pointer of the system function corresponding to the camera function; perform consistency verification on the target function pointer and the function pointer of the system function corresponding to the camera function loaded into memory, and detect whether the system function corresponding to the camera function has the risk of tampering based on the consistency verification result.

[0050] The system functions corresponding to the camera functionality refer to the functions related to image data captured by the image processing device in the C / C++ layer. For example, the system functions corresponding to the camera functionality could be `AImageReader_acquireLatestImage`, as well as other functions starting with `AImageReader_`, and functions like `AImage_getWidth` and `AImage_getHeight`, which are functions in the `libmediandk.so` library. In essence, a function pointer is a pointer variable that stores the address of a function's entry point.

[0051] It should be noted that this application does not limit the specific methods for obtaining the function pointers of the system functions corresponding to the camera function, nor the methods for obtaining the target function pointers of the system functions corresponding to the camera function; these methods can be set according to the actual situation. For example, the function pointer of the system function corresponding to the camera function can be obtained by inputting the command `AImageReader_acquireLatestImage`, and the target function pointer of the system function corresponding to the camera function can be obtained based on the `dlopen` and `dlsym` functions in the `libc.so` library. Furthermore, a consistency verification can be performed between the target function pointer and the function pointer of the system function corresponding to the camera function loaded into memory. If the verification results of the target function pointer and the function pointer of the system function corresponding to the camera function loaded into memory are inconsistent, it indicates that the system function corresponding to the camera function has been attacked during the loading process, which may have led to the system function corresponding to the camera function being maliciously modified, forged, or replaced. In this case, it is confirmed that the system function corresponding to the camera function is at risk of tampering.

[0052] It should also be noted that the system functions involved in image processing mainly include the system functions corresponding to camera functions in the libmediandk.so library, and basic system functions such as dlopen, dlsym, malloc, and free in the libc.so library. To further enhance security, the basic system functions can also be verified. As one possible implementation, the C / C++ layer image processing device can obtain the CRC value of the libc.so library loaded into memory and the CRC value when the libc.so library was originally compiled, and perform a consistency verification between the CRC value of the libc.so library loaded into memory and the CRC value when the libc.so library was originally compiled. If the verification result is inconsistent, it confirms that the basic system functions are at risk of tampering.

[0053] It should also be noted that this application can perform verification before calling the system function corresponding to the camera function, or periodically verify the system function corresponding to the camera function according to a pre-set verification cycle.

[0054] As can be seen from the above process, this application can perform consistency verification on the target function pointer and the function pointer of the system function corresponding to the camera function loaded into memory, detect whether the system function corresponding to the camera function has the risk of tampering, ensure the authenticity and integrity of the system function corresponding to the called camera function, and further improve the security of the image processing process.

[0055] It should be noted that, to further enhance security, the integrity of structures such as ArtMethod can also be verified. As one possible implementation, the image processing device in the C / C++ layer can obtain the hash value of the ArtMethod memory region and the hash value of the ArtMethod in the JAVA layer, and perform a consistency verification between the hash values ​​of the ArtMethod memory region and the JAVA layer. If the verification result is inconsistent, it confirms that the underlying system functions are at risk of tampering.

[0056] It should also be noted that, to further enhance security, the C / C++ layer image processing device can perform more security-enhancing operations that cannot be implemented in the JAVA layer, such as code obfuscation and code encryption of dynamic blocks. These will not be elaborated here, but can be configured according to the actual situation.

[0057] As can be seen from the above, this application establishes a reliable and secure processing environment for image processing by verifying the dynamic libraries, libc.so library, libmediandk.so library, and ArtMethod corresponding to the camera function.

[0058] After the image processing device in the C / C++ layer calls the dynamic library corresponding to the camera function, it can obtain the initial image data captured by the camera through the dynamic library.

[0059] In this embodiment, after the C / C++ layer image processing device calls the dynamic library corresponding to the camera function, it can obtain the initial image data captured by the camera by calling the corresponding interface in the dynamic library. For example, the C / C++ layer image processing device can call the underlying camera SDK (Software Development Kit) interface in the dynamic library to obtain the initial image data captured by the camera.

[0060] It should be noted that this application does not limit the format of the initial image data captured by the camera, and it can be set according to the actual situation. For example, the format of the initial image data can be YUV format, where YUV format refers to a pixel format in which luminance and chrominance parameters are represented separately. Y represents luminance (Luminance or Luma), i.e., grayscale value; UV represents chrominance (Chrominance or Chroma). As another example, the format of the initial image data can be JPEG (Joint Photographic Experts Group) format.

[0061] The following describes in detail step 203, namely "signing the initial image data to obtain initial image data including a digital signature," with reference to an embodiment.

[0062] As one possible implementation, when signing the initial image data to obtain initial image data including a digital signature, a pre-defined target encryption strategy can be obtained, and the initial image data can be signed according to the target encryption strategy to obtain initial image data including a digital signature. The digital signature needs to have certain dynamic elements and a certain correlation with the data source; therefore, the digital signature can at least include a timestamp and camera parameters.

[0063] It should be noted that this application does not limit the specific settings of the pre-defined target encryption strategy, which can be selected according to the actual situation. Optionally, the pre-defined target encryption strategy can be set to use an encryption algorithm to sign the initial image data.

[0064] For example, HMAC-SHA256 can be used to sign the initial image data. HMAC (Hash-based Message Authentication Code)-SHA256 is a variant of HMAC based on the SHA-256 hash algorithm, which can be widely used in scenarios such as API (Application Programming Interface) signing, data integrity verification, and identity authentication.

[0065] For example, the RSA encryption algorithm can be used to sign the initial image data. RSA is an asymmetric encryption algorithm; unlike symmetric encryption algorithms, it uses two different keys: a public key and a private key.

[0066] As can be seen from the above process, this application can sign the initial image data according to the pre-set target encryption strategy, so that the initial image data carries a digital signature including at least timestamps and camera parameters, which provides a reliable basis for accurately detecting whether the target image has the risk of tampering, and greatly improves the authenticity of the detected image data and the security of the image processing process.

[0067] The following describes in detail step 205, namely, "converting the format of the initial image data and encoding the alpha channel to obtain intermediate image data including the alpha channel encoding value, and using the intermediate image data to add a watermark to the target image by the client," with reference to the embodiments.

[0068] As one possible implementation, when converting the format of the initial image data and encoding the alpha channel to obtain intermediate image data including the alpha channel encoded values, the specific steps include: S21, convert the format of the initial image data to obtain intermediate image data in RGBA format.

[0069] The RGBA format refers to a color space representing Red, Green, Blue, and Alpha. Alpha, or alpha channel, is generally used as an opacity parameter.

[0070] S22, obtain the pre-set target encoding strategy, and encode the alpha channel of the intermediate image data in RGBA format according to the target encoding strategy to obtain intermediate image data including the alpha channel encoding value.

[0071] The alpha channel value typically corresponds to the transparency and translucency of an image. Specifically, if a pixel's alpha channel value is 0%, it is completely transparent (i.e., invisible), while a value of 100% means a completely opaque pixel (in traditional digital images). Values ​​between 0% and 100% allow pixels to show through the background, like looking through glass (transparency). Alpha channel values ​​can be represented as percentages, integers, or real numbers from 0 to 1. In this embodiment, utilizing the characteristic that the alpha channel includes transparency information, encoding the alpha channel and carrying the encoded alpha channel value does not significantly affect the presentation of the image data.

[0072] It should also be noted that this application does not limit the specific setting of the pre-defined target encoding strategy, which can be selected according to the actual situation. Optionally, the pre-defined target encoding strategy can be set to calculate the position value and encode the position value as the alpha channel encoding value.

[0073] For example, the position value can be calculated using the following formula: (position.x + position.y) % 256 Here, position.x and position.y refer to the pixel coordinates, which are usually integers; % 256 refers to the modulo operation, which ensures that the calculated position value is within the range of 0-25, thus conforming to the numerical range of the alpha channel.

[0074] As can be seen from the above process, this application can encode the alpha channel of intermediate image data in RGBA format according to a pre-set target encoding strategy, so that the intermediate image data carries the alpha channel encoding value, which provides a reliable basis for accurately detecting whether the target image has the risk of tampering, and greatly improves the authenticity of the detected image data and the security of the image processing process.

[0075] After obtaining intermediate image data including the alpha channel encoded values, the intermediate image data can be used to add watermarks to obtain the target image.

[0076] As one possible implementation, the watermarking operation for intermediate image data can be performed by the client's Java layer. Optionally, intermediate image data including the alpha channel encoded value can be sent to the client's Java layer. After receiving the intermediate image data including the alpha channel encoded value, the client's Java layer can perform the watermarking operation to obtain the target image.

[0077] As another possible approach, the operation of adding watermarks to intermediate image data can also be performed by the image processing device in the C / C++ language layer. In other words, the process of generating watermarks is also delegated to the C / C++ language layer.

[0078] The following describes in detail step 207, namely, "in response to a request to save or upload a target image, verifying the digital signature and alpha channel encoding value of the target image, and detecting whether the target image has a risk of tampering based on the verification result," with reference to an embodiment.

[0079] In this embodiment, after the intermediate image data is watermarked to obtain the target image, the user can trigger a save or upload request for the target image in various ways. For example, the user can trigger a save request for the target image by clicking the save component or long-pressing and selecting from the menu. The user can also send an upload request carrying the target image to the server by clicking the upload component corresponding to functions such as share, save to the cloud, or publish to social media. Accordingly, after receiving the upload request, the server can implement functions such as sharing, saving to the cloud, or publishing to social media based on the target image.

[0080] Furthermore, in response to a save or upload request for the target image, the digital signature and alpha channel encoded value included in the target image can be verified.

[0081] As one possible implementation, when verifying the digital signature included in the target image, optionally, the digital signature included in the target image can be obtained, and the consistency verification between the digital signature included in the target image and the digital signature included in the initial image data can be performed to obtain the digital signature consistency verification result of the target image.

[0082] When verifying the alpha channel encoded values ​​of the target image, optionally, the alpha channel of the target image can be encoded according to the target encoding strategy to obtain the alpha channel encoded value of the target image. Further, the consistency verification of the alpha channel encoded value of the target image is performed using the encoded alpha channel encoded value of the target image and the alpha channel encoded value carried in the target image to obtain the consistency verification result of the alpha channel encoded value of the target image.

[0083] Furthermore, the final verification result of the target image can be obtained based on the consistency verification result of the digital signature of the target image and the consistency verification result of the alpha channel encoding value of the target image, and the target image can be detected as having the risk of tampering based on the final verification result.

[0084] If at least one of the verification results for the consistency of the digital signature of the target image and the consistency verification result for the alpha channel encoding value of the target image is inconsistent, it indicates that the process of adding watermarks to the intermediate image data to obtain the target image has been attacked, which may have led to the intermediate image data being maliciously modified, forged, or replaced. In this case, the target image is confirmed to be at risk of being tampered with.

[0085] It should be noted that after obtaining the intermediate image data, including the alpha channel encoded value, the watermarking operation can be performed by the client as described above, or by the C / C++ layer image processing device. To further improve the authenticity, integrity, and security of the image data, the target image obtained by the C / C++ layer image processing device performing the watermarking operation can also be verified before saving or uploading, and the verification result can be used to detect whether the target image is at risk of tampering. Furthermore, before the C / C++ layer image processing device performs the watermarking operation on the intermediate image data, it can also be verified, and the verification result can be used to detect whether the intermediate image data is at risk of tampering.

[0086] Furthermore, in response to the detection of tampering risk, risk handling is performed, which includes at least one of the following: error reporting, crash, performing user authentication, reinstalling the client, and discarding the image obtained in the current stage.

[0087] It should be noted that this application involves multiple tampering risk detections, such as verifying the target image before saving or uploading it, verifying the dynamic library before calling it, verifying the system function before calling it, and verifying the intermediate image data before the C / C++ layer image processing device adds watermarks to the intermediate image data. Detecting tampering risk at any stage of processing will compromise the authenticity of the image data. Therefore, in this application, in response to the detection of tampering risk, risk handling can be performed to ensure the authenticity of the image data while also reminding users who have violated regulations to adjust their behavior in a timely manner or to be vigilant about the possibility of application intrusion.

[0088] The image processing method proposed in this application can be widely applied in a variety of scenarios.

[0089] For example, taking attendance management as an example, due to the rapid expansion of enterprise scale, the processing volume and complexity of attendance management work are increasing day by day. Based on the image processing method proposed in this application, it can greatly help enterprises that adopt attendance management by uploading employee clock-in photos. While effectively solving the problem that the authenticity of the image data of the clock-in photos uploaded by employees cannot be guaranteed, it also avoids damage to employee interests and enterprise management efficiency.

[0090] For example, in the application scenario of goods statistics, due to considerations such as personnel costs and management efficiency, some enterprises that need to conduct statistics on a large number of goods have been helpless in the face of the time and manpower consumed by massive statistics. Based on the image processing method proposed in this application, it can provide a very positive impact on enterprises that intend to conduct goods statistics based on goods images uploaded by employees. While effectively shortening the time for goods statistics and improving the accuracy of goods statistics, it ensures the authenticity of the image data of goods images uploaded by employees, thereby improving the reliability of goods statistics.

[0091] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0092] According to another embodiment, an image processing apparatus is provided. Figure 3 A schematic block diagram of an image processing apparatus according to one embodiment is shown. Figure 3 As shown, the device 300 includes: an image acquisition unit 301, a signature processing unit 302, an encoding processing unit 303, and an image verification unit 304, and may also include a risk processing unit 305. The main functions of each component are as follows: The image acquisition unit 301 is configured to, in response to the detection of an image capture request, call the dynamic library corresponding to the camera function and acquire the initial image data captured by the camera through the dynamic library.

[0093] The signature processing unit 302 is configured to perform signature processing on the initial image data to obtain initial image data including a digital signature.

[0094] The encoding processing unit 303 is configured to perform format conversion and alpha channel encoding processing on the initial image data to obtain intermediate image data including alpha channel encoded values. The intermediate image data is used by the client to add watermarks to obtain the target image.

[0095] Image verification unit 304 is configured to verify the digital signature and alpha channel encoding value of the target image in response to a save or upload request for the target image, and detect whether the target image has a risk of tampering based on the verification result.

[0096] As one possible implementation method, when the encoding processing unit 303 performs format conversion and alpha channel encoding processing on the initial image data to obtain intermediate image data including alpha channel encoded values, it can be specifically configured to: perform format conversion on the initial image data to obtain intermediate image data in RGBA format; obtain a pre-set target encoding strategy, and encode the alpha channel of the RGBA format intermediate image data according to the target encoding strategy to obtain the intermediate image data including alpha channel encoded values.

[0097] As one possible implementation method, the image verification unit 304, when verifying the alpha channel encoding value included in the target image, can be specifically configured to: encode the alpha channel of the target image according to the target encoding strategy to obtain the alpha channel encoding value of the target image; and perform consistency verification between the alpha channel encoding value of the target image and the alpha channel encoding value carried by the target image.

[0098] As one possible implementation method, when the signature processing unit 302 performs signature processing on the initial image data to obtain initial image data including a digital signature, it can be specifically configured to: obtain a pre-set target encryption strategy, and perform signature processing on the initial image data according to the target encryption strategy to obtain the initial image data including the digital signature, wherein the digital signature includes at least a timestamp and camera parameters.

[0099] As one possible implementation, before calling the dynamic library corresponding to the camera function, the image verification unit 304 can also be configured to: after loading the dynamic library corresponding to the camera function, or after loading the dynamic library when the client starts, obtain the cyclic redundancy check (CRC) value of the dynamic library loaded into memory; obtain the CRC value when the dynamic library was originally compiled, and perform consistency verification between the CRC value when the dynamic library was originally compiled and the CRC value of the dynamic library loaded into memory, and detect whether the dynamic library has a risk of tampering based on the consistency verification result.

[0100] As one possible implementation method, the image verification unit 304 can also be configured to: obtain the function pointer of the system function corresponding to the camera function loaded into memory and the target function pointer of the system function corresponding to the camera function before calling the system function corresponding to the camera function; perform consistency verification on the target function pointer and the function pointer of the system function corresponding to the camera function loaded into memory, and detect whether the system function corresponding to the camera function has the risk of tampering based on the consistency verification result.

[0101] As one possible implementation, the device 300 further includes a risk processing unit 305. The main function of the risk processing unit 305 is as follows: the risk processing unit 305 is configured to perform risk processing in response to the detection of tampering risk, the risk processing including at least one of error reporting, crashing, performing user authentication, reinstalling the client, and discarding the image obtained in the current stage.

[0102] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or device embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the description of the method embodiments. The system and device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0103] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0104] In addition, embodiments of this application also provide an electronic device, including: One or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any of the foregoing method embodiments.

[0105] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.

[0106] in, Figure 4An exemplary architecture of an electronic device is shown, which may include a processor 410, a video display adapter 411, a disk drive 412, an input / output interface 413, a network interface 414, and a memory 420. The processor 410, video display adapter 411, disk drive 412, input / output interface 413, network interface 414, and memory 420 can communicate with each other via a communication bus 430.

[0107] The processor 410 can be implemented using a general-purpose CPU, microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits to execute relevant programs and implement the technical solution provided in this application.

[0108] The memory 420 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 420 can store the operating system 421 for controlling the operation of the electronic device 400, and the basic input / output system (BIOS) 422 for controlling the low-level operations of the electronic device 400. Additionally, it can store a web browser 423, a data storage management system 424, and an image processing device 300, etc. The aforementioned image processing device 300 can be the application program that specifically implements the aforementioned steps in this embodiment. In summary, when the technical solution provided in this application is implemented through software or firmware, the relevant program code is stored in the memory 420 and executed by the processor 410.

[0109] Input / output interface 413 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, speakers, vibrators, indicator lights, etc.

[0110] Network interface 414 is used to connect a communication module (not shown in the figure) to enable communication and interaction between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0111] Bus 430 includes a pathway for transmitting information between various components of the device, such as processor 410, video display adapter 411, disk drive 412, input / output interface 413, network interface 414, and memory 420.

[0112] It should be noted that although the above-described device only shows the processor 410, video display adapter 411, disk drive 412, input / output interface 413, network interface 414, memory 420, bus 430, etc., in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the solution of this application, and does not necessarily include all the components shown in the figures.

[0113] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer program product. This computer program product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.

[0114] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. An image processing method, wherein the image processing method is executed at a C / C++ layer, characterized in that, include: In response to the detection of an image capture request, the dynamic library corresponding to the camera function is invoked, and the initial image data captured by the camera is obtained through the dynamic library; The initial image data is signed to obtain initial image data including a digital signature; The initial image data is format-converted and alpha channel encoded to obtain intermediate image data including alpha channel encoded values. The intermediate image data is used by the client to add watermarks to obtain the target image. In response to a request to save or upload the target image, the digital signature and alpha channel encoding value of the target image are verified, and the target image is detected as having a risk of being tampered with based on the verification result.

2. The method according to claim 1, characterized in that, The initial image data undergoes format conversion and alpha channel encoding to obtain intermediate image data including alpha channel encoded values, including: The initial image data is converted to obtain intermediate image data in RGBA format; A pre-defined target encoding strategy is obtained, and the alpha channel of the intermediate image data in RGBA format is encoded according to the target encoding strategy to obtain the intermediate image data including the alpha channel encoded value.

3. The method according to claim 2, characterized in that, The verification of the alpha channel encoded values ​​included in the target image includes: The alpha channel of the target image is encoded according to the target encoding strategy to obtain the alpha channel encoded value of the target image; The consistency of the obtained alpha channel encoded value of the target image with the alpha channel encoded value carried in the target image is verified.

4. The method according to claim 1, characterized in that, The step of signing the initial image data to obtain initial image data including a digital signature includes: A pre-defined target encryption strategy is obtained, and the initial image data is signed according to the target encryption strategy to obtain the initial image data including the digital signature, wherein the digital signature includes at least a timestamp and camera parameters.

5. The method according to claim 1, characterized in that, Before calling the dynamic library corresponding to the camera function, the following is also included: After loading the dynamic library corresponding to the camera function, or after loading the dynamic library when the client starts, obtain the cyclic redundancy check (CRC) value of the dynamic library loaded into memory. Obtain the CRC value when the dynamic library was originally compiled, and perform a consistency verification between the original CRC value when the dynamic library was compiled and the CRC value of the dynamic library loaded into memory. Based on the consistency verification result, detect whether the dynamic library has a risk of tampering.

6. The method according to claim 1, characterized in that, The method further includes: Before calling the system function corresponding to the camera function, obtain the function pointer of the system function corresponding to the camera function loaded into memory, as well as the target function pointer of the system function corresponding to the camera function; A consistency verification is performed on the target function pointer and the function pointer of the system function corresponding to the camera function loaded into memory. Based on the consistency verification result, it is detected whether the system function corresponding to the camera function has a risk of tampering.

7. The method according to any one of claims 1-6, characterized in that, The method further includes: In response to the detection of tampering risk, risk handling is performed, which includes at least one of the following: error reporting, crash, performing user authentication, reinstalling the client, and discarding the image obtained in the current stage.

8. An image processing apparatus, characterized in that, include: The image acquisition unit is configured to, in response to the detection of an image capture request, call the dynamic library corresponding to the camera function and acquire the initial image data captured by the camera through the dynamic library; The signature processing unit is configured to perform signature processing on the initial image data to obtain initial image data including a digital signature; The encoding processing unit is configured to perform format conversion and alpha channel encoding processing on the initial image data to obtain intermediate image data including alpha channel encoded values. The intermediate image data is used by the client to add a watermark to obtain the target image. The image verification unit is configured to, in response to a save or upload request for the target image, verify the digital signature and alpha channel encoding value of the target image, and detect whether the target image is at risk of being tampered with based on the verification result.

9. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed 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 that, when executed by a processor, implements the method according to any one of claims 1-7.