WO2021135638A1 - 检测图像是否被篡改的方法及装置和电子设备 - Google Patents

检测图像是否被篡改的方法及装置和电子设备 Download PDF

Info

Publication number
WO2021135638A1
WO2021135638A1 PCT/CN2020/126959 CN2020126959W WO2021135638A1 WO 2021135638 A1 WO2021135638 A1 WO 2021135638A1 CN 2020126959 W CN2020126959 W CN 2020126959W WO 2021135638 A1 WO2021135638 A1 WO 2021135638A1
Authority
WO
WIPO (PCT)
Prior art keywords
random number
image
imaging sensor
parameter
linear relationship
Prior art date
Application number
PCT/CN2020/126959
Other languages
English (en)
French (fr)
Inventor
郑建旭
辛知
黄冕
Original Assignee
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2021135638A1 publication Critical patent/WO2021135638A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Definitions

  • the embodiments of this specification relate to the field of Internet technology, and in particular, to a method, device, and electronic device for detecting whether an image has been tampered with.
  • the embodiments of this specification provide a method, device and electronic equipment for detecting whether an image has been tampered with.
  • a system for detecting whether an image has been tampered with includes a random number generation module, a random number conversion module, a parameter setting module, an image acquisition module, and a random number calibration in a secure operating system.
  • Verification module includes a random number generation module, a random number conversion module, a parameter setting module, an image acquisition module, and a random number calibration in a secure operating system.
  • the random number generation module generates original random numbers when the camera hardware is called to collect images
  • the random number conversion module uses the linear relationship between the random number and the image color; and the linear relationship between the image color and the parameter value of the imaging sensor parameter to calculate the parameter value of the original random number corresponding to the imaging sensor parameter;
  • the parameter setting module sets the parameter of the imaging sensor based on the calculated parameter value
  • the image acquisition module acquires the image to be verified collected by the imaging sensor after the parameter setting
  • the random number conversion module uses the linear relationship between the random number and the image color to calculate the verification random number corresponding to the image to be verified;
  • the random number verification module compares the verification random number with the original random number, and determines whether the image to be verified has been tampered with based on the change between the verification random number and the original random number.
  • a method for detecting whether an image has been tampered with including:
  • the verification random number is compared with the original random number, and based on the change of the verification random number and the original random number, it is determined whether the image to be verified has been tampered with.
  • the obtaining of the original random number specifically includes:
  • the secure operating system is triggered to obtain the original random number.
  • the calculation of the parameter value of the imaging sensor parameter corresponding to the original random number by using the linear relationship between the random number and the image color, and the image color and the parameter value of the imaging sensor parameter specifically includes:
  • the target application According to the scene type determined when the camera hardware is called by the target application to collect the image, obtaining the linear relationship between the random number corresponding to the scene type and the image color, and the linear relationship between the image color and the parameter value of the imaging sensor parameter;
  • the parameter value corresponding to the imaging sensor parameter of the original random number is calculated.
  • the method further includes:
  • the calculation of the linear relationship between the random number and the image color based on the gamma correction, and the linear relationship between the image color and the parameter value of the imaging sensor parameter specifically includes:
  • the non-linear relationship is calculated by using a compensation function to perform a non-linear compensation calculation to obtain a linear relationship .
  • the calculation of the verification random number corresponding to the image to be verified by using the linear relationship between the random number and the image color specifically includes:
  • the verification random number corresponding to the image to be verified is calculated.
  • the comparing the verification random number with the original random number, and determining whether the image to be verified has been tampered with, based on the change of the verification random number and the original random number includes:
  • a device for detecting whether an image has been tampered with including:
  • Random number generation unit to obtain the original random number
  • the parameter value calculation unit uses the linear relationship between the random number and the image color, as well as the image color and the parameter value of the imaging sensor parameter, to calculate the parameter value corresponding to the original random number in the imaging sensor parameter, based on the calculated parameter value Setting the imaging sensor parameters;
  • a random number restoration unit after acquiring the image to be verified collected by the imaging sensor after setting, calculates the verification random number corresponding to the image to be verified by using the linear relationship between the random number and the color of the image;
  • the tamper-proof verification unit compares the verification random number with the original random number, and determines whether the image to be verified has been tampered with based on the change of the verification random number and the original random number.
  • an electronic device including:
  • a memory for storing processor executable instructions
  • the processor is configured as any one of the foregoing methods for detecting whether an image has been tampered with.
  • the embodiment of this specification provides a solution for detecting whether an image has been tampered with.
  • the security operating system is triggered to obtain the original random number; the original random number is used to configure the parameter value of the imaging sensor to change the acquisition To the image color of the image and output the color-changed image through the imaging signal processor.
  • the verification random number of the image to be verified is reversed, and the verification random number is compared with the original random number to determine whether the image has been tampered with.
  • the embodiment of this specification is based on the original random number hidden in the secure operating system to realize the image tamper resistance; the original random number cannot be obtained in the non-secure area; even if the image to be verified collected by the camera is tampered with, the tampering will also cause The random number in the image changes, which is bound to be different from the original random number; therefore, by comparing the verification random number deduced by the image to be verified with the original random number, it can be determined whether the image to be verified has been tampered with.
  • the original random number is also changing every time the camera is used to capture an image. Even if the image to be verified has not been tampered with before, since the verification random number in the image to be verified is a historical original random number, it will It is inconsistent with the current original random number, which can avoid image replay attacks.
  • FIG. 1 is a schematic diagram of the architecture of a system for detecting whether an image has been tampered with according to an embodiment of this specification;
  • FIG. 2 is a flowchart of a method for detecting whether an image has been tampered with according to an embodiment of this specification
  • FIG. 3 is a hardware structure diagram of a device for detecting whether an image has been tampered with according to an embodiment of this specification
  • Fig. 4 is a schematic diagram of a module of a device for detecting whether an image has been tampered with according to an embodiment of the present specification.
  • first, second, third, etc. may be used in this specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
  • first information may also be referred to as second information, and similarly, the second information may also be referred to as first information.
  • word “if” as used herein can be interpreted as "when” or “when” or "in response to determination”.
  • image tamper-proofing is mainly implemented at the hardware level.
  • chip manufacturers configure high-end chips and integrate Camera ISP hardware for identification. This method relies heavily on the support of the underlying hardware to achieve image tamper resistance, and only high-end chips with high prices have this function. Due to the high purchase cost of high-end chips, they cannot be applied to cheap terminals, so cheap terminals generally do not have the ability to detect whether images have been tampered with.
  • this specification provides a solution that can detect whether an image has been tampered without relying on high-end chips, that is, with the help of existing hardware technology, the software can be improved to detect whether an image has been tampered with. Without increasing hardware costs, inexpensive terminals can also be provided with the ability to detect whether images have been tampered with.
  • FIG. 1 a schematic structural diagram of a system for detecting whether an image has been tampered with according to an embodiment of the present specification.
  • the system may be located in an Android terminal, and the system software is divided into an Android operating system and a security operating system.
  • the secure operating system is a protected system, so that it can be isolated from the Android operating system in terms of memory and hardware.
  • the system hardware includes camera hardware such as an imaging sensor (Camera Sensor) and an imaging signal processor (ISP, Image Signal Processing).
  • the imaging sensor in the Android operating system drives the hardware used to control the imaging sensor of the camera; the imaging signal processor drives the hardware used to control the imaging signal processor of the camera.
  • the imaging sensor is a semiconductor chip that can convert the received light into an electrical signal, and then convert it into a digital signal through the internal AD.
  • the imaging signal processor then converts the digital signal into a viewable image.
  • the secure operating system may include the Trustzone system shown in FIG. 1 or the hypervisor system not shown in FIG. 1.
  • the Trustzone system is a hardware architecture designed by ARM for consumer electronic devices. It is used to build a security framework for consumer electronic devices to resist various possible attacks. All operations that require security protection can be performed in such a secure operating system, such as fingerprint recognition, password processing, data encryption and decryption, and security authentication. Other operations that do not require security protection can be performed in the Android operating system.
  • the security operating system and the Android operating system can be converted through the mode of Monitor Mode.
  • the security operating system includes a random number generation module, a random number conversion module, a parameter setting module, an image acquisition module, and a random number verification module.
  • the random number generation module is used to generate original random numbers when an application in the Android operating system calls the camera hardware to collect images.
  • a random number algorithm is configured in the random number generation module, and a random number with a preset number of digits can be generated by using the random number algorithm.
  • the random number conversion module uses the linear relationship between the random number and the image color, and the image color and the parameter value of the imaging sensor parameter to calculate the parameter value of the original random number corresponding to the imaging sensor parameter.
  • the parameter setting module sets the parameter of the imaging sensor based on the calculated parameter value.
  • the camera can collect the color signal of the image to be inspected through the imaging sensor after the parameter setting; and convert the color signal into a visible image to be inspected through the imaging signal processor.
  • the image acquisition module acquires the image to be verified collected by the imaging sensor after the parameter setting.
  • the random number conversion module uses the linear relationship between the random number and the image color to calculate the verification random number corresponding to the image to be verified.
  • the random number verification module compares the verification random number with the original random number, and determines whether the image to be verified has been tampered with based on the change of the verification random number and the original random number.
  • the method can be applied to a secure operating system.
  • the method can be implemented in two phases, namely a calibration phase and a verification phase.
  • the calibration stage is used to calculate the linear relationship between the parameter value of the imaging sensor parameter of the terminal and the image color, and the linear relationship between the random number and the image color in the secure operating system. Since the cameras of different Android terminals have certain differences in hardware, the security operating system of each Android terminal needs to calculate these linear relationships locally. By quantifying the corresponding relationship between the image color and the parameter value of the parameter, and the corresponding relationship between the random number and the image color, the corresponding relationship between the random number and the parameter value of the imaging sensor parameter can be obtained.
  • the secure operating system can calculate the following two linear relationships based on gamma correction:
  • the first linear relationship the linear relationship between the random number and the image color
  • the second linear relationship the linear relationship between the image color and the parameter value of the imaging sensor parameter.
  • Gamma correction is an algorithm used to perform non-linear calculations or inverse calculations on the grayscale or three primary color values of the light in the camera. Based on security considerations, the above two linear relationships are stored in a secure operating system.
  • the non-linear relationship can be calculated through a compensation function, and finally two A linear relationship, namely the aforementioned first linear relationship and the second linear relationship.
  • the compensation function may refer to nonlinear compensation control (Nonlinear Compensation Control), and the purpose is to map the nonlinear relationship to a linear relationship.
  • nonlinear compensation control Nonlinear Compensation Control
  • the purpose is to map the nonlinear relationship to a linear relationship.
  • the imaging sensor itself there are many external environmental factors. These external environmental factors are very complicated and cannot be directly calculated. Therefore, it is necessary to eliminate the influence through nonlinear compensation to obtain a linear relationship.
  • the camera may have multiple shooting modes.
  • the shooting mode is referred to as the scene type.
  • Different scene types have different requirements for image color. Therefore, the security operating system also needs to calculate the above two linear relationships under each scene type. Specifically, the security operating system obtains the scene type of the camera of the terminal where it is located, and calculates the linear relationship between the random number and the image color in the scene type for each scene type; and the linear relationship between the image color and the parameter value of the imaging sensor parameter .
  • Verification stage used to detect whether the image has been tampered with using the above two linear relationships. It includes the following steps:
  • Step 210 The secure operating system obtains the original random number.
  • the target application of the Android operating system calls the camera hardware to collect images to trigger the start of the secure operating system.
  • the step 210 may specifically include:
  • the secure operating system is triggered to obtain the original random number generated by the random number generating module in the secure operating system.
  • the target application is an application in the Android operating system.
  • the camera of the terminal where it is located is called to collect the image to be verified.
  • the secure operating system can be triggered to obtain the original random number generated by the random number generating module in the secure operating system. Then, the two linear relationships obtained in the calibration stage are used to calculate the parameter value of the original random number corresponding to the parameter of the imaging sensor.
  • the original random number must always be located in the secure operating system. Since the secure operating system is a protected system, it is isolated from the Android operating system in terms of memory and hardware. Therefore, the data located in the secure operating system, including the original random number, cannot be Obtained externally, avoiding the security risk caused by the leakage of the original random number.
  • Step 220 Using the linear relationship between the random number and the image color, and the image color and the parameter value of the imaging sensor parameter, calculate the parameter value of the original random number corresponding to the imaging sensor parameter, and set the parameter value based on the calculated parameter value. Describe the imaging sensor parameters.
  • the secure operating system After the secure operating system obtains the original random number, it first uses the linear relationship between the random number calculated in the calibration phase and the image color to calculate the target image color corresponding to the original random number; then uses the image color and imaging calculated in the calibration phase The linear relationship of the parameter value of the sensor parameter is used to calculate the target parameter value of the imaging sensor parameter corresponding to the target image color.
  • the calculated target parameter value of the parameter is set in the imaging sensor hardware.
  • the image color of the image collected by the imaging sensor with the parameter value set is the image color corresponding to the target parameter value.
  • the image color of the image collected by the imaging sensor is changed by the original random number, and the image after the color change can be output through the imaging signal processor.
  • the camera may have multiple different scene types. Each scene type corresponds to two linear relationships.
  • the step 220 may specifically include:
  • the target application According to the scene type determined when the camera hardware is called by the target application to collect the image, obtaining the linear relationship between the random number corresponding to the scene type and the image color, and the linear relationship between the image color and the parameter value of the imaging sensor parameter;
  • the parameter value corresponding to the imaging sensor parameter of the original random number is calculated.
  • the secure operating system can calculate the corresponding linear relationship in advance for different scene types, so that the subsequent verification is more accurate.
  • Step 230 After acquiring the image to be verified collected by the set imaging sensor, use the linear relationship between the random number and the image color to calculate the verification random number corresponding to the image to be verified.
  • the linear relationship between the random number and the color of the image is used to calculate the verification random number corresponding to the image to be verified.
  • the image to be verified may be sent back to the image acquisition module by the imaging signal processor.
  • the linear relationship between the random number obtained in the calibration stage and the color of the image can be used to inversely deduce the verification random number corresponding to the image to be verified.
  • step 230 may specifically include:
  • the verification random number corresponding to the image to be verified is calculated.
  • the compensation function is first used to calculate the image color before the image color compensation, and then the linear relationship is used to inversely calculate the check random number corresponding to the image color before the compensation.
  • Step 240 Compare the verification random number with the original random number, and determine whether the image to be verified has been tampered with based on the change of the verification random number and the original random number.
  • This step specifically includes:
  • the verification random number is deduced by comparing the image to be verified With the original random number, it can be determined whether the image to be verified has been tampered with.
  • the original random number is also changing every time the camera is used to capture an image. Even if the image to be verified has not been tampered with before, since the verification random number in the image to be verified is a historical original random number, it will It is inconsistent with the current original random number, which can avoid image replay attacks.
  • the parameters of the imaging sensor in this specification can also include variables such as exposure, gain, and frame rate.
  • exposure detection, gain detection, and frame rate detection can also be added.
  • the final test result can be obtained from multiple test results. In this way, the detection accuracy can be further improved.
  • Gain is a parameter that affects image brightness and noise.
  • Gain value is proportional to image brightness and noise. The greater the Gain value, the brighter the image brightness and the greater the image noise, and vice versa. Because the Gain parameter is unique to the imaging sensor, even if the image brightness is changed when the image is tampered with by the image modification tool, the original noise value in the image will not be changed; therefore, by comparing the brightness value of the image to be verified with the Gain set by the imaging sensor Whether the brightness values corresponding to the values are consistent; if they are consistent, further compare whether the noise value of the image to be verified is consistent with the noise value corresponding to the Gain value set by the imaging sensor. If they are all consistent, the Gain test passes; if they are inconsistent, the Gain test fails.
  • the exposure test compares whether the exposure value of the image to be verified is consistent with the exposure value set by the imaging sensor. If they are consistent, the exposure test passes; if they are inconsistent, the exposure test fails.
  • the frame rate value of the image after the tampering will be higher than the frame rate value of the image before the tampering. Therefore, by comparing whether the frame rate value of the image to be verified is consistent with the frame rate value set by the imaging sensor, if they are consistent, the frame rate detection passes; if they are inconsistent, the frame rate detection fails.
  • the embodiment of this specification provides an image tamper-proof solution.
  • the security operating system is triggered to obtain the original random number; the original random number is used to configure the parameter value of the imaging sensor to change the image captured Color and output the color-changed image through the imaging signal processor.
  • the verification random number of the image to be verified is reversed, and the verification random number is compared with the original random number to determine whether the image has been tampered with.
  • the embodiment of this specification is based on the original random number hidden in the secure operating system to realize the image tamper resistance; the original random number cannot be obtained in the non-secure area; even if the image to be verified collected by the camera is tampered with, the tampering will also cause The random number in the image changes, which is bound to be different from the original random number; therefore, by comparing the verification random number deduced by the image to be verified with the original random number, it can be determined whether the image to be verified has been tampered with.
  • the original random number is also changing every time the camera is used to capture an image. Even if the image to be verified has not been tampered with before, since the verification random number in the image to be verified is a historical original random number, it will It is inconsistent with the current original random number, which can avoid image replay attacks.
  • this specification also provides an embodiment of a method for detecting whether a face image has been tampered with in a face recognition scene, and the method may include the following steps:
  • the secure operating system is triggered to obtain the original random number
  • this embodiment can detect whether the face image has been tampered with for a specific face recognition scene.
  • the specific implementation steps are the same as the steps shown in FIG. 2, and the previous embodiments can be referred to, which will not be repeated here.
  • the target application includes a payment application, and the face image to be verified is used for face payment; the method further includes:
  • a face verification pass message is sent to the payment application, so that the payment application completes the face payment corresponding to the face image to be verified.
  • the verification result can be returned to the payment application in the non-secure operating system such as the Android operating system, so that the payment application can perform subsequent payment actions based on the verification result. For example, when it has not been tampered with, the payment application completes the face payment corresponding to the face image to be verified; when it is tampered, the payment application terminates the face payment corresponding to the face image to be verified.
  • the non-secure operating system such as the Android operating system
  • This embodiment provides a solution for detecting whether the face image has been tampered with.
  • the target application calls the camera hardware to collect the face image for face payment
  • the secure operating system is triggered to obtain the original random number; the original random number is used to configure the imaging
  • the parameter value of the sensor is used to change the image color of the collected face image and output the changed face image through the imaging signal processor.
  • the verification random number of the face image to be verified is reversed, and the verification random number is compared with the original random number to determine whether the face image to be verified has been tampered with.
  • the embodiment of this specification is based on the detection of whether the image has been tampered with the original random number hidden in the secure operating system; the original random number cannot be obtained in the non-secure area; even if the face image to be verified collected by the camera is tampered, the tampering At the same time, it will also cause the random number in the face image to change, which will inevitably be different from the original random number; therefore, by comparing the changes in the verification random number deduced from the face image to be verified and the original random number, you can Determine whether the face image to be verified has been tampered with.
  • the original random number is also changing every time the camera is used to collect a face image, even if the previous face image to be verified that has not been tampered with is used, because the verification random number in the face image to be verified is historical
  • the original random number will also be inconsistent with the current original random number, so the face image replay attack can be avoided.
  • this specification also provides an embodiment of the image anti-tampering device.
  • the device embodiments can be implemented by software, or can be implemented by hardware or a combination of software and hardware.
  • Taking software implementation as an example as a logical device, it is formed by reading the corresponding computer service program instructions in the non-volatile memory into the memory through the processor of the device where it is located.
  • FIG. 3 a hardware structure diagram of the device where the image tamper-proof device is located in this manual, in addition to the processor, network interface, memory and non-volatile memory shown in Figure 3,
  • the device where the device is located is usually based on the actual function of image tamper resistance, and may also include other hardware, which will not be described in detail.
  • FIG. 4 is a block diagram of an image tamper-proof device provided by an embodiment of this specification.
  • the device corresponds to the embodiment shown in FIG. 2, and the device includes:
  • the random number generating unit 510 obtains the original random number
  • the parameter value calculation unit 520 uses the linear relationship between the random number and the image color, and the linear relationship between the image color and the parameter value of the imaging sensor parameter to calculate the parameter value corresponding to the original random number in the imaging sensor parameter, based on the calculated parameter Value setting the imaging sensor parameter;
  • the random number restoration unit 530 after acquiring the image to be verified collected by the set imaging sensor, calculates the verification random number corresponding to the image to be verified by using the linear relationship between the random number and the image color;
  • the tamper-proof verification unit 540 compares the verification random number with the original random number, and determines whether the image to be verified has been tampered with based on the change between the verification random number and the original random number.
  • the random number generating unit 510 specifically includes:
  • the secure operating system is triggered to obtain the original random number.
  • the parameter value calculation unit 520 specifically includes:
  • the linear relationship between the random number corresponding to the scene type and the image color and the image color and the parameter value of the imaging sensor parameter is obtained; using the linear relationship corresponding to the scene type, Calculating the parameter value of the original random number corresponding to the parameter of the imaging sensor.
  • the device further includes:
  • the linear relationship generation unit calculates the linear relationship between the random number and the image color based on gamma correction, and the linear relationship between the image color and the parameter value of the imaging sensor parameter.
  • the linear relationship generating unit specifically includes:
  • the random number reduction unit 530 specifically includes:
  • the verification random number corresponding to the image to be verified is calculated.
  • the tamper-proof verification unit 540 includes:
  • a typical implementation device is a computer.
  • the specific form of the computer can 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 receiving and sending device, and a game control A console, a tablet computer, a wearable device, or a combination of any of these devices.
  • the relevant part can refer to the part of the description of the method embodiment.
  • the device embodiments described above are merely illustrative, where the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this specification. Those of ordinary skill in the art can understand and implement without creative work.
  • the above Figure 4 depicts the internal functional modules and structural diagrams of the image tamper-proof device, and its substantial execution body may be an electronic device, including: a processor; a memory for storing executable instructions of the processor; wherein, the The processor is configured to: obtain the original random number; use the linear relationship between the random number and the image color, and the image color and the parameter value of the imaging sensor parameter to calculate the parameter value of the original random number corresponding to the imaging sensor parameter, based on The calculated parameter values set the imaging sensor parameters; after acquiring the image to be verified collected by the set imaging sensor, the linear relationship between the random number and the image color is used to calculate the calibration corresponding to the image to be verified Random number
  • the verification random number is compared with the original random number, and based on the change of the verification random number and the original random number, it is determined whether the image to be verified has been tampered with.
  • the processor may be a central processing unit (English: Central Processing Unit, abbreviated as: CPU), or other general-purpose processors or digital signal processors (English: Digital Signal Processor). , Abbreviation: DSP), application specific integrated circuit (English: Application Specific Integrated Circuit, abbreviation: ASIC), etc.
  • the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
  • the aforementioned memory can be a read-only memory (English: read-only memory, abbreviation: ROM), random access memory (English: read-only memory, abbreviation: ROM) : Random access memory, referred to as RAM), flash memory, hard disk or solid-state hard disk.
  • the steps of the method disclosed in the embodiments of this specification can be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Studio Devices (AREA)

Abstract

一种检测图像是否被篡改的方法及装置和电子设备。所述方法包括:获取原始随机数(210);利用随机数与图像颜色,以及图像颜色与成像传感器参数的参数值的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值,基于所计算出的参数值设置所述成像传感器参数(220);获取由设置后的成像传感器采集的待校验图像后,利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数(230);通过比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改(240)。

Description

检测图像是否被篡改的方法及装置和电子设备 技术领域
本说明书实施例涉及互联网技术领域,尤其涉及一种检测图像是否被篡改的方法及装置和电子设备。
背景技术
随着图像处理工具的不断发展,图像越来越容易被篡改。被篡改的图像可能会被用于进行违法行为。因此,在很多应用执行图像业务时需要检测图像是否被篡改。
发明内容
本说明书实施例提供一种检测图像是否被篡改的方法及装置和电子设备。
根据本说明书实施例的第一方面,提供一种检测图像是否被篡改系统,所述系统包括安全操作系统中的随机数生成模块、随机数转换模块、参数设置模块、图像获取模块和随机数校验模块;
所述随机数生成模块在相机硬件被调用采集图像时生成原始随机数;
所述随机数转换模块利用随机数与图像颜色;以及,图像颜色与成像传感器参数的参数值的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值;
所述参数设置模块基于计算出的所述参数值设置所述成像传感器的参数;
所述图像获取模块获取由参数设置后的成像传感器采集的待校验图像;
所述随机数转换模块利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数;
所述随机数校验模块比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改。
根据本说明书实施例的第二方面,提供一种检测图像是否被篡改的方法,所述方法包括:
获取原始随机数;
利用随机数与图像颜色,以及图像颜色与成像传感器参数的参数值的线性关系, 计算所述原始随机数对应在所述成像传感器参数的参数值,基于所计算出的参数值设置所述成像传感器参数;
获取由设置后的成像传感器采集的待校验图像后,利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数;
比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改。
可选的,所述获取原始随机数,具体包括:
在安卓系统的目标应用调用相机硬件采集图像时,触发安全操作系统获取原始随机数。
可选的,所述利用随机数与图像颜色,以及图像颜色与成像传感器参数的参数值的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值;具体包括:
根据所述目标应用调用相机硬件采集图像时确定的场景类型,获取该场景类型对应的随机数与图像颜色以及图像颜色与成像传感器参数的参数值的线性关系;
利用该场景类型对应的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值。
可选的,所述方法还包括:
基于伽马校正计算随机数与图像颜色的线性关系,以及图像颜色与成像传感器参数的参数值的线性关系。
可选的,所述基于伽马校正计算随机数与图像颜色的线性关系,以及图像颜色与成像传感器参数的参数值的线性关系,具体包括:
基于伽马校正计算随机数与图像颜色的关系,以及图像颜色与成像传感器参数的参数值的关系;
在所述随机数与图像颜色的关系和图像颜色与成像传感器参数的参数值的关系中任一为非线性关系时,通过补偿函数对所述非线性关系进行非线性补偿计算,从而得到线性关系。
可选的,所述利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数,具体包括:
利用所述补偿函数和所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数。
可选的,所述比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改,包括:
依次比较所述校验随机数和原始随机数的每位数值,统计相同数值的占比;
在所述占比大于等于阈值的情况下,确定所述待校验图像没有被篡改;
在所述占比小于阈值的情况下,确定所述待校验图像被篡改
根据本说明书实施例的第三方面,提供一种检测图像是否被篡改的装置,所述装置包括:
随机数生成单元,获取原始随机数;
参数值计算单元,利用随机数与图像颜色,以及图像颜色与成像传感器参数的参数值的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值,基于所计算出的参数值设置所述成像传感器参数;
随机数还原单元,获取由设置后的成像传感器采集的待校验图像后,利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数;
防篡改校验单元,比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改。
根据本说明书实施例的第四方面,提供一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为上述任一项检测图像是否被篡改的方法。
本说明书实施例,提供了一种检测图像是否被篡改的方案,在目标应用调用相机硬件采集图像时,触发安全操作系统获取原始随机数;利用该原始随机数配置成像传感器的参数值以改变采集到图像的图像颜色并通过成像信号处理器输出颜色变化后的图像。之后,反推待校验图像的校验随机数,通过比对校验随机数和原始随机数来确定图像是否被篡改。本说明书实施例是基于隐藏在安全操作系统中的原始随机数实现的图像防篡改;非安全区域无法获取到该原始随机数;即使相机采集的待校验图像被篡改,篡 改的同时也会导致图像中的随机数产生变化,这样必然与原始随机数存在差异;因此通过比较待校验图像反推出的校验随机数与原始随机数,就可以确定待校验图像是否被篡改。
此外,每次使用相机采集图像时原始随机数也是在变化的,即使使用之前未被篡改的待校验图像,由于该待校验图像中的校验随机数是历史的原始随机数,也会和当前的原始随机数不一致,从而可以避免图像重放攻击。
附图说明
图1是本说明书一实施例提供的检测图像是否被篡改系统的架构示意图;
图2是本说明书一实施例提供的检测图像是否被篡改方法的流程图;
图3是本说明书一实施例提供的检测图像是否被篡改装置的硬件结构图;
图4是本说明书一实施例提供的检测图像是否被篡改装置的模块示意图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书的一些方面相一致的装置和方法的例子。
在本说明书使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书。在本说明书和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本说明书可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
在相关技术中,主要在硬件层面实现图像防篡改,例如芯片厂商在高端芯片上进行配置,集合Camera ISP的硬件进行识别。这种方式,严重依赖底层硬件的支持才能 实现图像防篡改,而且只有价格高的高端芯片才有这种功能。由于高端芯片的采购成本较高,无法应用到廉价终端中,使得廉价终端通常不具备检测图像是否被篡改的能力。
为此,本说明书提供了一种不依赖高端芯片就可以实现检测图像是否被篡改的方案,即借助现有的硬件技术,通过在软件层面上的改进来实现检测图像是否被篡改。在不增加硬件成本的情况下,也可以令廉价终端具备检测图像是否被篡改的能力。
以下请参考图1所示本说明书一实施例提供的检测图像是否被篡改系统的架构示意图。所述系统可以位于安卓(Android)终端,该系统软件方面分为安卓操作系统和安全操作系统。安全操作系统为受保护的系统,从而在内存与硬件上可以实现与安卓操作系统的隔离。该系统硬件方面包括成像传感器(Camera Sensor)、成像信号处理器(ISP,Image Signal Processing)等相机硬件。
安卓操作系统中可能安装有大量需要调用相机(Camera)的应用程序,但是这些应用程序调用相机硬件采集的图像在安全性上无法保证。在安卓操作系统中的成像传感器驱动用以控制相机的成像传感器的硬件;成像信号处理器驱动用于控制相机的成像信号处理器的硬件。成像传感器是一种半导体芯片,可以将接收到的光线转换为电信号,再通过内部的AD转换为数字信号。然后由成像信号处理器把数字信号转换可查看的图像。
在一实施例中,所述安全操作系统可以包括图1中示出的Trustzone系统或者图1中未示出的hypervisor系统。
其中,Trustzone系统是ARM公司针对消费电子设备设计的一种硬件架构,用于为消费电子设备构建一个安全框架来抵御各种可能的攻击。所有需要安全保护的操作都可以在这样的安全操作系统中执行,例如指纹识别、密码处理、数据加解密、安全认证等。而其它不需要安全保护的操作都可以在安卓操作系统中执行。安全操作系统与安卓操作系统可以通过Monitor Mode的模式进行转换。
安全操作系统中包括随机数生成模块、随机数转换模块、参数设置模块、图像获取模块和随机数校验模块。
其中,随机数生成模块用以在安卓操作系统中的应用调用相机硬件采集图像时生成原始随机数。随机数生成模块中配置有随机数算法,利用该随机数算法可以生成预设位数的随机数。
随机数转换模块利用随机数与图像颜色,以及图像颜色与成像传感器参数的参数 值的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值。
参数设置模块基于计算出的所述参数值设置所述成像传感器的参数。相机就可以通过参数设置后的成像传感器采集待检验图像的颜色信号;并通过成像信号处理器将颜色信号转换为可见的待检验图像。
图像获取模块获取由参数设置后的成像传感器采集的待校验图像。
随机数转换模块利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数。
随机数校验模块比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改。
参见图2所示为本说明书的一种检测图像是否被篡改的方法实施例,该方法可以应用于安全操作系统,该方法可以分为两个阶段实施,分别为校准阶段和校验阶段。
校准阶段,用于在安全操作系统内计算所处终端的成像传感器参数的参数值与图像颜色的线性关系,以及随机数与图像颜色的线性关系。由于不同安卓终端的相机在硬件上存在一定差异,因此每个安卓终端的安全操作系统都需要在本地计算这些线性关系。通过量化图像颜色与参数的参数值以及随机数与图像颜色之间的对应关系,可以获得随机数与成像传感器参数的参数值之间的对应关系。
具体地,安全操作系统可以基于伽马校正计算如下两种线性关系:
第一线性关系:随机数与图像颜色的线性关系;
第二线性关系:图像颜色与成像传感器参数的参数值的线性关系。
伽马校正是用来针对相机里对于光线的灰度或者三原色值进行非线性运算或反运算的算法。基于安全考虑,将上述两种线性关系存储在安全操作系统。
在实际应用中,利用伽马校正计算随机数与图像颜色的关系,以及图像颜色与成像传感器参数的参数值的关系;
在所述随机数与图像颜色的关系和图像颜色与成像传感器参数的参数值的关系中任一为非线性关系时,可以通过补偿函数对所述非线性关系进行非线性补偿计算,最终得到两种线性关系,即前述第一线性关系和第二线性关系。
所述补偿函数可以是指非线性补偿控制(Nonlinear compensation control),目的是为了将非线性关系映射为线性关系。通常,造成非线性关系的原因很多,除了成像传感 器自身的因素外,还有很多外界环境因素。这些外界环境因素很复杂,并不能直接计算得到。所以需要通过非线性补偿排除影响以得到线性关系。
在一实施例中,随着相机功能不断推陈出新,相机可以具有多种拍摄模式。在本说明书中将拍摄模式称为场景类型。不同场景类型中对图像颜色的要求存在差异,因此安全操作系统还需要计算每种场景类型下的上述两种线性关系。具体地,安全操作系统获取所处终端的相机具备的场景类型,针对每种场景类型计算该场景类型下随机数与图像颜色的线性关系;以及,图像颜色与成像传感器参数的参数值的线性关系。
校验阶段:用于利用上述两种线性关系来检测图像是否被篡改。具体包括以下步骤:
步骤210:安全操作系统获取原始随机数。
该实施例中,由安卓操作系统的目标应用调用相机硬件采集图像从而触发安全操作系统开始。在一实施例中,所述步骤210,具体可以包括:
在安卓系统的目标应用调用相机硬件采集图像时,触发安全操作系统获取该安全操作系统中随机数生成模块生成的原始随机数。
所述目标应用为安卓操作系统中的应用。在目标应用需要采集图像以执行某个业务时,会调用所在终端的相机采集待校验图像。在该目标应用调用相机硬件采集图像时,可以触发安全操作系统获取该安全操作系统中随机数生成模块生成的原始随机数。然后,利用校准阶段得到的两种线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值。
所述原始随机数需要始终位于安全操作系统内,由于安全操作系统是受保护的系统,在内存与硬件上与安卓操作系统相互隔离,如此位于安全操作系统内的数据包括原始随机数都无法被外部获取到,避免了原始随机数泄露导致的安全风险。
步骤220:利用随机数与图像颜色,以及图像颜色与成像传感器参数的参数值的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值,基于所计算出的参数值设置所述成像传感器参数。
安全操作系统在获取到原始随机数后,首先利用前述校准阶段计算得到的随机数与图像颜色的线性关系,计算原始随机数对应的目标图像颜色;再利用前述校准阶段计算得到的图像颜色与成像传感器参数的参数值的线性关系,计算目标图像颜色对应的成像传感器参数的目标参数值。
将计算出的所述参数的目标参数值设置到成像传感器硬件中。这样,设置了参数值的成像传感器采集到图像的图像颜色就是目标参数值对应的图像颜色。如此,实现了通过原始随机数改变成像传感器采集到图像的图像颜色,并可以通过成像信号处理器输出颜色变化后的图像。
在一实施例中,如校准阶段中所示的,相机可能具有多种不同的场景类型。每种场景类型都对应有各自的两种线性关系。相应地,所述步骤220,具体可以包括:
根据所述目标应用调用相机硬件采集图像时确定的场景类型,获取该场景类型对应的随机数与图像颜色以及图像颜色与成像传感器参数的参数值的线性关系;
利用该场景类型对应的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值。
该实施例中,安全操作系统可以预先针对不同的场景类型,计算对应的线性关系,使后续校验更为准确。
步骤230:获取由设置后的成像传感器采集的待校验图像后,利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数。
在一实施例中,在接收到待校验图像后,利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数。
所述待校验图像可以是由成像信号处理器回传给图像获取模块的。针对这个待校验图像,可以利用校准阶段得到的随机数与图像颜色的线性关系,反推出所述待校验图像对应的校验随机数。
在一实施例中,如果前述校准阶段中应用到了补偿函数,那么步骤230具体可以包括:
利用所述补偿函数和所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数。
该步骤中,先利用补偿函数计算图像颜色补偿前图像颜色,然后利用该线性关系反推补偿前图像颜色对应的校验随机数。
步骤240:比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改。
该步骤具体包括:
依次比较所述校验随机数和原始随机数的每位数值,统计相同数值的占比;
在所述占比大于等于阈值的情况下,确定所述待校验图像没有被篡改;
在所述占比小于阈值的情况下,确定所述待校验图像被篡改。
该步骤中,如果相机采集的原始图像被篡改,篡改的同时也会导致图像中的随机数产生变化,这样必然与原始随机数存在差异;因此通过比较待校验图像反推出的校验随机数与原始随机数,就可以确定待校验图像是否被篡改。此外,每次使用相机采集图像时原始随机数也是在变化的,即使使用之前未被篡改的待校验图像,由于该待校验图像中的校验随机数是历史的原始随机数,也会和当前的原始随机数不一致,从而可以避免图像重放攻击。
本说明书中成像传感器的参数除了图像颜色之外,还可以包括:曝光、Gain、帧率等变量。在随机数检测(即对比校验随机数和原始随机数变化)基础上,还可以增加曝光检测、Gain检测、帧率检测。由多种检测结果共同得出最终的检测结果。如此可以进一步提升检测准确性。
其中,Gain是一种影响图像亮度和噪声的参数。Gain值与图像亮度、噪声成正比。Gain值越大,图像亮度也越亮、图像噪声也越大,反之亦然。由于Gain这个参数是成像传感器特有的,通过图像修改工具篡改图像时即使改变图像亮度,也不会改变图像中原本的噪声值;因此,通过比较待校验图像的亮度值与成像传感器设置的Gain值对应的亮度值是否一致;在一致的情况下,进一步比较待校验图像的噪声值与成像传感器设置的Gain值对应的噪声值是否一致。如果都一致,则Gain检测通过;任一不一致,则Gain检测不通过。
类似的,通过比较待校验图像的曝光值与成像传感器设置的曝光值是否一致。如果一致,则曝光检测通过;如果不一致,则曝光检测不通过。
相对于相机采集图像时消耗的CPU资源,篡改图像时需要消耗更多的CPU资源;因此,图像被篡改后的帧率值会比被篡改前图像的帧率值更高。因此,通过比较待校验图像的帧率值与成像传感器设置的帧率值是否一致,如果一致,则帧率检测通过;如果不一致,则帧率检测不通过。
本说明书实施例提供了一种图像防篡改方案,在目标应用调用相机硬件采集图像时,触发安全操作系统获取原始随机数;利用该原始随机数配置成像传感器的参数值以改变采集到图像的图像颜色并通过成像信号处理器输出颜色变化后的图像。之后,反推 待校验图像的校验随机数,通过比对校验随机数和原始随机数来确定图像是否被篡改。本说明书实施例是基于隐藏在安全操作系统中的原始随机数实现的图像防篡改;非安全区域无法获取到该原始随机数;即使相机采集的待校验图像被篡改,篡改的同时也会导致图像中的随机数产生变化,这样必然与原始随机数存在差异;因此通过比较待校验图像反推出的校验随机数与原始随机数,就可以确定待校验图像是否被篡改。
此外,每次使用相机采集图像时原始随机数也是在变化的,即使使用之前未被篡改的待校验图像,由于该待校验图像中的校验随机数是历史的原始随机数,也会和当前的原始随机数不一致,从而可以避免图像重放攻击。
随着刷脸支付或者人脸支付业务的发展,对于人脸支付安全性的质疑也随之而来。例如从相机采集到的人脸图像是否能保证是真实的?因此,证明相机采集到的人脸图像是未被篡改的就成了人脸支付是安全的一个重要保障。
为此本说明书还提供了一种针对人脸识别场景中检测人脸图像是否被篡改的方法实施例,该方法可以包括以下步骤:
在目标应用调用相机硬件采集人脸图像时触发安全操作系统获取原始随机数;
利用随机数与图像颜色,以及图像颜色与成像传感器参数的参数值的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值,基于所计算出的参数值设置所述成像传感器参数;
获取由设置后的成像传感器采集的待校验人脸图像后,利用所述随机数与图像颜色的线性关系,计算所述待校验人脸图像对应的校验随机数;
比较所述校验随机数与原始随机数的变化情况,确定所述待校验人脸图像是否被篡改。
本实施例与图2所示实施例相比,针对特定的人脸识别场景,可以检测人脸图像是否被篡改。具体地实现步骤与图2所示的步骤相同,可以参考之前的实施例,此处不再赘述。
在一实施例中,所述目标应用包括支付应用,所述待校验人脸图像用于进行人脸支付;所述方法还包括:
在确定所述待校验人脸图像没有被篡改后,向所述支付应用发送人脸校验通过消息,以使所述支付应用完成该待校验人脸图像对应的人脸支付。
在安全操作系统确定了待校验人脸图像没有被篡改后,可以向非安全操作系统例如安卓操作系统中的支付应用返回校验结果,以使支付应用根据校验结果执行后续的支付动作,例如没有被篡改时支付应用完成该待校验人脸图像对应的人脸支付;被篡改时支付应用终止该待校验人脸图像对应的人脸支付。
该实施例提供了一种检测人脸图像是否被篡改的方案,在目标应用调用相机硬件采集进行人脸支付的人脸图像时,触发安全操作系统获取原始随机数;利用该原始随机数配置成像传感器的参数值以改变采集到人脸图像的图像颜色并通过成像信号处理器输出颜色变化后的人脸图像。之后,反推待校验人脸图像的校验随机数,通过比对校验随机数和原始随机数来确定待校验人脸图像是否被篡改。本说明书实施例是基于隐藏在安全操作系统中的原始随机数实现的图像是否被篡改的检测;非安全区域无法获取到该原始随机数;即使相机采集的待校验人脸图像被篡改,篡改的同时也会导致人脸图像中的随机数产生变化,这样必然与原始随机数存在差异;因此通过比较待校验人脸图像反推出的校验随机数与原始随机数的变化情况,就可以确定待校验人脸图像是否被篡改。此外,每次使用相机采集人脸图像时原始随机数也是在变化的,即使使用之前的未被篡改的待校验人脸图像,由于该待校验人脸图像中的校验随机数是历史的原始随机数,也会和当前的原始随机数不一致,因而可以避免人脸图像重放攻击。
与前述图像防篡改方法实施例相对应,本说明书还提供了图像防篡改装置的实施例。所述装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在设备的处理器将非易失性存储器中对应的计算机业务程序指令读取到内存中运行形成的。从硬件层面而言,如图3所示,为本说明书图像防篡改装置所在设备的一种硬件结构图,除了图3所示的处理器、网络接口、内存以及非易失性存储器之外,实施例中装置所在的设备通常根据图像防篡改实际功能,还可以包括其他硬件,对此不再赘述。
请参见图4,为本说明书一实施例提供的图像防篡改装置的模块图,所述装置对应了图2所示实施例,所述装置包括:
随机数生成单元510,获取原始随机数;
参数值计算单元520,利用随机数与图像颜色,以及图像颜色与成像传感器参数的参数值的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值,基于所计算出的参数值设置所述成像传感器参数;
随机数还原单元530,获取由设置后的成像传感器采集的待校验图像后,利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数;
防篡改校验单元540,比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改。
可选的,所述随机数生成单元510,具体包括:
在安卓系统的目标应用调用相机硬件采集图像时,触发安全操作系统获取原始随机数。
可选的,所述参数值计算单元520;具体包括:
根据所述目标应用调用相机硬件采集图像时确定的场景类型,获取该场景类型对应的随机数与图像颜色以及图像颜色与成像传感器参数的参数值的线性关系;利用该场景类型对应的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值。
可选的,所述装置还包括:
线性关系生成单元,基于伽马校正计算随机数与图像颜色的线性关系,以及图像颜色与成像传感器参数的参数值的线性关系。
可选的,所述线性关系生成单元,具体包括:
基于伽马校正计算随机数与图像颜色的关系,以及图像颜色与成像传感器参数的参数值的关系;在所述随机数与图像颜色的关系和图像颜色与成像传感器参数的参数值的关系中任一为非线性关系时,通过补偿函数对所述非线性关系进行非线性补偿计算,从而得到线性关系。
可选的,所述随机数还原单元530,具体包括:
利用所述补偿函数和所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数。
可选的,所述防篡改校验单元540,包括:
依次比较所述校验随机数和原始随机数的每位数值,统计相同数值的占比;在所述占比大于等于阈值的情况下,确定所述待校验图像没有被篡改;在所述占比小于阈值的情况下,确定所述待校验图像被篡改。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现, 或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
上述装置中各个单元的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
以上图4描述了图像防篡改装置的内部功能模块和结构示意,其实质上的执行主体可以为一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为:获取原始随机数;利用随机数与图像颜色,以及图像颜色与成像传感器参数的参数值的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值,基于所计算出的参数值设置所述成像传感器参数;获取由设置后的成像传感器采集的待校验图像后,利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数;
比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改。
在上述电子设备的实施例中,应理解,该处理器可以是中央处理单元(英文:Central Processing Unit,简称:CPU),还可以是其他通用处理器、数字信号处理器(英文:Digital Signal Processor,简称:DSP)、专用集成电路(英文:Application Specific Integrated Circuit,简称:ASIC)等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,而前述的存储器可以是只读存储器(英文:read-only memory,缩写:ROM)、随机存取存储器(英文:random access memory,简称:RAM)、快闪存储器、硬盘或者固态硬盘。结合本说明书实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于电子设备实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
本领域技术人员在考虑说明书及实践这里公开的实施例后,将容易想到本说明书的其它实施方案。本说明书旨在涵盖本说明书的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本说明书的一般性原理并包括本说明书未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本说明书的真正范围和精神由下面的权利要求指出。
应当理解的是,本说明书并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本说明书的范围仅由所附的权利要求来限制。

Claims (10)

  1. 一种检测图像是否被篡改的方法,所述方法包括:
    获取原始随机数;
    利用随机数与图像颜色,以及图像颜色与成像传感器参数的参数值的线性关系,计算所述原始随机数对应的所述成像传感器参数的参数值,基于所计算出的参数值设置所述成像传感器参数;
    获取由设置后的成像传感器采集的待校验图像后,利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数;
    比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改。
  2. 根据权利要求1所述的方法,所述获取原始随机数,具体包括:
    在安卓系统的目标应用调用相机硬件采集图像时,触发安全操作系统获取原始随机数。
  3. 根据权利要求2所述的方法,所述利用随机数与图像颜色,以及图像颜色与成像传感器参数的参数值的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值;具体包括:
    根据所述目标应用调用相机硬件采集图像时确定的场景类型,获取该场景类型对应的随机数与图像颜色,以及图像颜色与成像传感器参数的参数值的线性关系;
    利用该场景类型对应的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值。
  4. 根据权利要求1所述的方法,所述方法还包括:
    基于伽马校正计算随机数与图像颜色的线性关系,以及图像颜色与成像传感器参数的参数值的线性关系。
  5. 根据权利要求4所述的方法,所述基于伽马校正计算随机数与图像颜色的线性关系,以及图像颜色与成像传感器参数的参数值的线性关系,具体包括:
    基于伽马校正计算随机数与图像颜色的关系,以及图像颜色与成像传感器参数的参数值的关系;
    在所述随机数与图像颜色的关系和图像颜色与成像传感器参数的参数值的关系中任一为非线性关系时,通过补偿函数对所述非线性关系进行非线性补偿计算,从而得到线性关系。
  6. 根据权利要求5所述的方法,所述利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数,具体包括:
    利用所述补偿函数和所述随机数与图像颜色的线性关系,计算所述待校验图像对应 的校验随机数。
  7. 根据权利要求1所述的方法,所述比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改,包括:
    依次比较所述校验随机数和原始随机数的每位数值,统计相同数值的占比;
    在所述占比大于等于阈值的情况下,确定所述待校验图像没有被篡改;
    在所述占比小于阈值的情况下,确定所述待校验图像被篡改。
  8. 一种检测图像是否被篡改的装置,所述装置包括:
    随机数生成单元,获取原始随机数;
    参数值计算单元,利用随机数与图像颜色,以及图像颜色与成像传感器参数的参数值的线性关系,计算所述原始随机数对应在所述成像传感器参数的参数值,基于所计算出的参数值设置所述成像传感器参数;
    随机数还原单元,获取由设置后的成像传感器采集的待校验图像后,利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数;
    防篡改校验单元,比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改。
  9. 一种电子设备,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器被配置为上述权利要求1-7中任一项所述的方法。
  10. 一种检测图像是否被篡改的系统,所述系统包括安全操作系统中的随机数生成模块、随机数转换模块、参数设置模块、图像获取模块和随机数校验模块;
    所述随机数生成模块在相机硬件被调用采集图像时生成原始随机数;
    所述随机数转换模块利用随机数与图像颜色;以及,图像颜色与成像传感器参数的参数值的线性关系,计算所述原始随机数对应的成像传感器参数的参数值;
    所述参数设置模块基于计算出的所述参数值设置所述成像传感器的参数;
    所述图像获取模块获取由参数设置后的成像传感器采集的待校验图像;
    所述随机数转换模块利用所述随机数与图像颜色的线性关系,计算所述待校验图像对应的校验随机数;
    所述随机数校验模块比较所述校验随机数与原始随机数,基于所述校验随机数与原始随机数的变化情况,确定所述待校验图像是否被篡改。
PCT/CN2020/126959 2019-12-31 2020-11-06 检测图像是否被篡改的方法及装置和电子设备 WO2021135638A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911423169.7 2019-12-31
CN201911423169.7A CN111161259B (zh) 2019-12-31 2019-12-31 检测图像是否被篡改的方法及装置和电子设备

Publications (1)

Publication Number Publication Date
WO2021135638A1 true WO2021135638A1 (zh) 2021-07-08

Family

ID=70560632

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/126959 WO2021135638A1 (zh) 2019-12-31 2020-11-06 检测图像是否被篡改的方法及装置和电子设备

Country Status (3)

Country Link
CN (1) CN111161259B (zh)
TW (1) TWI736264B (zh)
WO (1) WO2021135638A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113763283A (zh) * 2021-09-19 2021-12-07 深圳市爱协生科技有限公司 图像是否去雾的检测方法、装置和智能设备

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111161259B (zh) * 2019-12-31 2021-06-22 支付宝(杭州)信息技术有限公司 检测图像是否被篡改的方法及装置和电子设备
CN111881844B (zh) * 2020-07-30 2021-05-07 北京嘀嘀无限科技发展有限公司 一种判断图像真实性的方法及系统
CN113158893A (zh) * 2021-04-20 2021-07-23 北京嘀嘀无限科技发展有限公司 一种目标识别的方法和系统
CN115187151B (zh) * 2022-09-13 2022-12-09 北京锘崴信息科技有限公司 基于联邦学习的排放可信分析方法及金融信息评价方法

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008037042A2 (en) * 2006-09-29 2008-04-03 Universidade Estadual De Campinas - Unicamp Progressive randomization process and equipment for multimedia analysis and reasoning
CN102291509A (zh) * 2010-06-21 2011-12-21 京瓷美达株式会社 图像形成系统、图像形成装置以及图像形成方法
CN105590043A (zh) * 2014-10-22 2016-05-18 腾讯科技(深圳)有限公司 身份验证方法、装置及系统
CN106503721A (zh) * 2016-10-27 2017-03-15 河海大学常州校区 基于cmos图像传感器puf的哈希算法及认证方法
CN108614971A (zh) * 2018-04-12 2018-10-02 Oppo广东移动通信有限公司 加密处理及解密处理方法和装置
CN111161259A (zh) * 2019-12-31 2020-05-15 支付宝(杭州)信息技术有限公司 检测图像是否被篡改的方法及装置和电子设备

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE60036189T2 (de) * 1999-11-25 2008-05-21 Matsushita Electric Industrial Co., Ltd., Kadoma Informationeinbettungsgerät und -verfahren für Erfassung von Verfälschungen
CN1269343C (zh) * 2002-12-19 2006-08-09 株式会社理光 图像处理方法及其装置,窜改检查方法及其装置
CN1189030C (zh) * 2003-04-03 2005-02-09 上海交通大学 定位型混沌脆弱数字水印嵌入与提取方法
KR20050040523A (ko) * 2003-10-29 2005-05-03 이원형 디지털 영상 위·변조를 검출하는 워터마킹 기법
CN102968803A (zh) * 2012-11-15 2013-03-13 西安理工大学 针对cfa插值图像的篡改检测与篡改定位方法
CN103685939B (zh) * 2013-11-22 2016-07-13 杭州百航信息技术有限公司 拍照时对照片加盖水印的方法
CN105049805B (zh) * 2015-01-04 2018-04-13 浙江工大盈码科技发展有限公司 一种实时隐藏拍摄防伪水印的视频监控装置
CN104933721B (zh) * 2015-06-25 2019-02-01 北京影谱科技股份有限公司 基于颜色滤波阵列特性的拼接图像篡改检测方法
CN108810440A (zh) * 2017-04-26 2018-11-13 宁波观原网络科技有限公司 视频数字水印隐写的实现方法及系统
CN108632511A (zh) * 2018-05-16 2018-10-09 上海小蚁科技有限公司 全景鱼眼相机的亮度补偿值确定、亮度补偿方法及装置、终端、鱼眼相机
CN109873702B (zh) * 2019-01-24 2021-09-21 国网浙江省电力有限公司电力科学研究院 一种面向NB-IoT电力作业移动终端的图像数据传输方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008037042A2 (en) * 2006-09-29 2008-04-03 Universidade Estadual De Campinas - Unicamp Progressive randomization process and equipment for multimedia analysis and reasoning
CN102291509A (zh) * 2010-06-21 2011-12-21 京瓷美达株式会社 图像形成系统、图像形成装置以及图像形成方法
CN105590043A (zh) * 2014-10-22 2016-05-18 腾讯科技(深圳)有限公司 身份验证方法、装置及系统
CN106503721A (zh) * 2016-10-27 2017-03-15 河海大学常州校区 基于cmos图像传感器puf的哈希算法及认证方法
CN108614971A (zh) * 2018-04-12 2018-10-02 Oppo广东移动通信有限公司 加密处理及解密处理方法和装置
CN111161259A (zh) * 2019-12-31 2020-05-15 支付宝(杭州)信息技术有限公司 检测图像是否被篡改的方法及装置和电子设备

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113763283A (zh) * 2021-09-19 2021-12-07 深圳市爱协生科技有限公司 图像是否去雾的检测方法、装置和智能设备
CN113763283B (zh) * 2021-09-19 2023-11-14 深圳市爱协生科技股份有限公司 图像是否去雾的检测方法、装置和智能设备

Also Published As

Publication number Publication date
TW202127381A (zh) 2021-07-16
CN111161259A (zh) 2020-05-15
CN111161259B (zh) 2021-06-22
TWI736264B (zh) 2021-08-11

Similar Documents

Publication Publication Date Title
TWI736264B (zh) 檢測圖像是否被竄改的方法及裝置和電子設備
RU2765611C2 (ru) Способ и устройство обработки претензий в отношении товаров на основе блокчейна и электронное устройство
US10817705B2 (en) Method, apparatus, and system for resource transfer
Boulkenafet et al. OULU-NPU: A mobile face presentation attack database with real-world variations
JP2008517508A (ja) セキュアセンサチップ
US11210541B2 (en) Liveness detection method, apparatus and computer-readable storage medium
US8832461B2 (en) Trusted sensors
WO2020038140A1 (zh) 人脸识别方法及装置
TWI729699B (zh) 人臉資料採集方法、用於人臉資料採集之非易失性電腦可讀媒體及用於人臉資料採集之電腦實施的系統
US20180012094A1 (en) Spoofing attack detection during live image capture
CN108668078A (zh) 图像处理方法、装置、计算机可读存储介质和电子设备
CN109145563A (zh) 一种身份验证方法及装置
CN113780212A (zh) 用户身份核验方法、装置、设备及存储介质
US10892901B1 (en) Facial data collection and verification
WO2022222806A1 (zh) 电子设备的投保校验的方法和装置
CN113032047B (zh) 人脸识别系统应用方法、电子设备及存储介质
Xue et al. ScreenID: Enhancing QRCode security by utilizing screen dimming feature
Li et al. Screenid: Enhancing qrcode security by fingerprinting screens
US11977646B2 (en) Secure sensor arrangement
JP2010231450A (ja) 撮影データ認証装置、撮影データ認証システム、撮影データ認証方法及びプログラム
KR102665968B1 (ko) 블러 추정 방법 및 장치
EP4175310A1 (en) Checking locality of devices
TWI690899B (zh) 人臉偵測系統及人臉偵測方法
Winkler et al. User-based attestation for trustworthy visual sensor networks
CN117917086A (zh) 检查设备的位置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20909050

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20909050

Country of ref document: EP

Kind code of ref document: A1