CN115883839A - Image verification method, device and equipment and computer readable storage medium - Google Patents

Image verification method, device and equipment and computer readable storage medium Download PDF

Info

Publication number
CN115883839A
CN115883839A CN202310219725.9A CN202310219725A CN115883839A CN 115883839 A CN115883839 A CN 115883839A CN 202310219725 A CN202310219725 A CN 202310219725A CN 115883839 A CN115883839 A CN 115883839A
Authority
CN
China
Prior art keywords
image
image block
compression
check code
block
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202310219725.9A
Other languages
Chinese (zh)
Other versions
CN115883839B (en
Inventor
孟照南
张帆
朱奇伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hubei Xinqing Technology Co ltd
Original Assignee
Hubei Xinqing Technology Co ltd
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 Hubei Xinqing Technology Co ltd filed Critical Hubei Xinqing Technology Co ltd
Priority to CN202310219725.9A priority Critical patent/CN115883839B/en
Publication of CN115883839A publication Critical patent/CN115883839A/en
Application granted granted Critical
Publication of CN115883839B publication Critical patent/CN115883839B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses an image checking method, a device, equipment and a computer readable storage medium, wherein the method comprises the following steps: dividing an original image into a plurality of image blocks which are not overlapped with each other; generating corresponding pre-compression image check codes according to the plurality of image blocks; lossless compression is carried out on the plurality of image blocks to obtain image block compressed data and image block header data; lossless decompression is carried out according to the image check code before compression, the image block compressed data and the image block header data to obtain an image block corresponding to the original image, and the decompressed image check code is obtained through calculation according to the decompressed image block; and comparing the before-compression image check code with the decompressed image check code to finish checking. The invention improves the accuracy of image verification.

Description

Image checking method, device and equipment and computer readable storage medium
Technical Field
The present invention relates to the field of data security technologies, and in particular, to an image verification method, an image verification apparatus, an image verification device, and a computer-readable storage medium.
Background
In the real-time digital image compression and decompression technology, a data stream generated after compression is sent to a decompression module through a certain path, and in these paths, if the data stream is wrong, the decompression module cannot correctly restore an image.
Therefore, the prior art verifies the image data to ensure the accuracy of the image data. However, in the prior art, the CRC check is performed on the compressed image data, and the correctness of the compression and decompression processes cannot be guaranteed.
Disclosure of Invention
The embodiment of the invention aims to provide an image checking method, an image checking device, image checking equipment and a computer readable storage medium, which can improve the image splicing efficiency, effectively solve the problems of double images and gaps in a splicing result and enable two adjacent images to be gradually transited during fusion splicing.
In a first aspect, to achieve the above object, an embodiment of the present invention provides an image verification method, including:
dividing an original image into a plurality of image blocks which are not overlapped with each other;
generating corresponding pre-compression image check codes according to the image blocks;
lossless compression is carried out on the plurality of image blocks to obtain image block compressed data and image block header data;
lossless decompression is carried out according to the image check code before compression, the image block compressed data and the image block header data to obtain an image block corresponding to the original image, and the decompressed image check code is obtained through calculation according to the decompressed image block;
and comparing the before-compression image check code with the after-decompression image check code to finish checking.
In a second aspect, to solve the same technical problem, an embodiment of the present invention provides an image verification apparatus, including:
the dividing module is used for dividing an original image into a plurality of image blocks which are not overlapped with each other;
the coding module is used for generating corresponding pre-compression image check codes according to the plurality of image blocks;
the compression module is used for carrying out lossless compression on the plurality of image blocks to obtain image block compressed data and image block header data;
the decompression module is used for carrying out lossless decompression to obtain an image block corresponding to the original image according to the image check code before compression, the image block compressed data and the image block header data, and calculating to obtain a decompressed image check code according to the decompressed image block;
and the checking module is used for comparing the before-compression image checking code with the after-decompression image checking code to finish checking.
In a third aspect, to solve the same technical problem, an embodiment of the present invention provides an electronic device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where the memory is coupled to the processor, and the processor implements the steps in the image verification method described in any one of the above when executing the computer program.
In a fourth aspect, to solve the same technical problem, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored, and when the computer program runs, a device in which the computer-readable storage medium is located is controlled to execute the steps in the image verification method described in any one of the foregoing descriptions.
The embodiment of the invention provides an image checking method, an image checking device, image checking equipment and a computer readable storage medium. The invention can process partial data blocks and carry out error detection on the whole process when reading a part of image data, and can ensure the correctness of the compressed, decompressed, transmitted and stored image.
Drawings
Fig. 1 is a schematic flowchart of an image verification method according to an embodiment of the present invention;
fig. 2 is another schematic flow chart of an image verification method according to an embodiment of the present invention;
FIG. 3 is a schematic flowchart of another image verification method according to an embodiment of the present invention;
FIG. 4 is a schematic flowchart of another image verification method according to an embodiment of the present invention;
FIG. 5 is a schematic flow chart of an image verification method according to an embodiment of the present invention;
fig. 6 is a schematic flowchart of another image verification method according to an embodiment of the present invention;
FIG. 7 is a schematic flow chart illustrating an image verification method according to an embodiment of the present invention;
FIG. 8 is a schematic structural diagram of an image checking apparatus according to an embodiment of the present invention;
fig. 9 is another schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be understood that the various steps recited in method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
Referring to fig. 1, fig. 1 is a schematic flow chart of an image verification method according to an embodiment of the present invention, and as shown in fig. 1, the image verification method according to the embodiment of the present invention includes steps S101 to S103.
S101, dividing an original image into a plurality of image blocks which are not overlapped with each other;
s102, generating corresponding pre-compression image check codes according to the image blocks;
s103, lossless compression is carried out on the plurality of image blocks to obtain image block compressed data and image block header data;
s104, lossless decompression is carried out according to the image check code before compression, the image block compressed data and the image block header data to obtain an image block corresponding to the original image, and the decompressed image check code is obtained through calculation according to the decompressed image block;
s105, comparing the before-compression image check code with the after-decompression image check code to complete check.
Specifically, the invention reduces the bandwidth occupation by using the lossless compression and lossless decompression processing of the image under the scene with functional safety, and simultaneously meets the error detection of the processing process required by the functional safety target. The invention can process partial data blocks and carry out error detection on the whole process when reading a part of image data, and can ensure the image correctness of compression, decompression, transmission and storage.
Referring to fig. 2, fig. 2 is another schematic flow chart of the image verification method according to the embodiment of the present invention, and as shown in fig. 2, the image verification method according to the embodiment of the present invention includes steps S201 to S203.
S201, acquiring the actual size of the original image;
s202, if the actual size is an integral multiple of a preset size, dividing the original image into a plurality of image blocks which are not overlapped and have the preset size, and recording the arrangement positions of the image blocks;
and S203, if the actual size is not an integral multiple of the preset size, dividing the original image into image blocks which are not overlapped and have part of the preset size and part of the other sizes, and recording the arrangement positions of the image blocks.
Referring to fig. 3, fig. 3 is a schematic flow chart of an image verification method according to an embodiment of the present invention, and as shown in fig. 3, the image verification method according to the embodiment of the present invention includes steps S301 to S302.
S301, carrying out gray processing on the image blocks to obtain corresponding gray image blocks;
s302, according to a preset verification algorithm, each gray-scale image block is respectively calculated to obtain a corresponding before-compression image verification code.
Referring to fig. 4, fig. 4 is a schematic flow chart of an image verification method according to an embodiment of the present invention, and as shown in fig. 4, the image verification method according to the embodiment of the present invention includes steps S401 to S403.
S401, acquiring a gray value corresponding to a pixel point in the gray image block;
s402, generating a binary code corresponding to the gray image block according to the arrangement position of each pixel point in the gray image block;
and S403, calculating the binary code according to a preset check algorithm to obtain a pre-compression image check code corresponding to the gray-scale image block.
In particular, the image is convenient to be subjected to graying processing, and graying is a process of converting a color image into a grayscale image. A color image generally includes three components of R, G, and B, and displays various colors such as red, green, and blue, respectively. Each pixel in the gray image has only one sample color, the gray of the pixel is the multi-level color depth between black and white, the pixel with large gray value is brighter, and conversely, the pixel is darker, the gray value is 255 (representing black) at the maximum, and the gray value is 0 (representing white) at the minimum. In the embodiment of the application, the target image block can be converted into the gray image block by adopting gray processing algorithms such as maximum gray processing, floating point gray processing, average gray processing, weighted average gray processing and the like.
And determining the coding value of the pixel point of which the gray value is greater than a preset gray threshold (for example 128) as a first numerical value (for example 1), and determining the coding value of the pixel point of which the gray value is less than the preset gray threshold as a second numerical value (for example 0). And generating a binary code corresponding to the gray-scale image block according to the first numerical value and the second numerical value corresponding to the pixel points and the arrangement positions of the pixel points in the gray-scale image block.
The predetermined Check algorithm includes a CRC Check algorithm, and the like, and the predetermined Error Correction algorithm is substantially an FFC (Forward Error Correction) algorithm, and the FFC algorithm includes hamming Code (i.e., hamming Code), R (abbreviation of Reed-solomon Code, reed solomon Code), LDPC (abbreviation of Low density Parity Check Code, low density Parity Check Code), and the like. The corresponding check bits are different if the types of the preset check algorithms are different, and therefore, the check bits need to be determined according to the types of the preset error correction algorithms and the number of coded bits of the binary code.
Referring to fig. 5, fig. 5 is a schematic flow chart of an image verification method according to an embodiment of the present invention, and as shown in fig. 5, the image verification method according to the embodiment of the present invention includes steps S501 to S503.
S501, calculating storage positions of corresponding image blocks according to arrangement positions of the image blocks in the original image, and storing compressed data of the image blocks into data storage partitions corresponding to the storage positions;
s502, calculating a corresponding check code offset address according to the arrangement position of the image block in the original image, and storing the image check code before compression into a check storage partition corresponding to the check code offset address;
s503, calculating a corresponding packet header offset address according to the arrangement position of the image block in the original image, and storing the packet header data of the image block into a packet header storage partition corresponding to the packet header offset address;
the header data of the image block comprises a storage position of the corresponding image block, a check code offset address and a size of the compressed data block.
Specifically, an initial storage location of the first compressed image block is set. And according to the arrangement positions of all the image blocks in the original image, performing offset calculation from the initial storage position to obtain a corresponding storage position. Similarly, an initial storage location corresponding to the first pre-compression image check code is set, and a check code offset address for storing the pre-compression image check code corresponding to the image block is set. Similarly, an initial storage location of the header of the first image block is set, and a header offset address for storing header data of the image block corresponding to the image block is set.
Referring to fig. 6, fig. 6 is a schematic flow chart of an image verification method according to an embodiment of the present invention, and as shown in fig. 6, the image verification method according to the embodiment of the present invention includes steps S601 to S605.
S601, acquiring an image block reading instruction; the image block reading instruction comprises an identification number of the image block, the identification number and the arrangement position of the image block in the original image have a one-to-one mapping relation, and the identification number and the packet header offset address have a corresponding relation;
s602, reading the header data of the image block corresponding to the header offset address from the header storage partition according to the identification number;
s603, according to the header data of the image block, obtaining a storage position and a check code offset address of the corresponding image block;
s604, reading corresponding image block compressed data from the data storage partition according to the storage position, performing lossless decompression on the image block compressed data to obtain a corresponding image block, and calculating the decompressed image block according to the preset check algorithm to obtain the decompressed image check code;
s605 reads the corresponding image check code before compression from the check storage partition according to the check code offset address.
Specifically, whether the image check code before compression corresponding to the image block is the same as the image check code after decompression is judged; if the image blocks are the same, determining that the image blocks are not tampered; and if the difference is different, determining that the image block is tampered.
And (3) a compression process: the width and height of an image are 64x64, the image is divided according to 16x16 image blocks, each 16x16 image block respectively enters an image block check code generation module, check values of the image blocks are generated to be stored according to a check algorithm, image block data enters an image block lossless compression module to carry out lossless compression on the image blocks to generate two parts of data, one part of data is image block compressed data, the other part of data is an image block header, the image block header comprises the size of the compressed image, the compressed storage position and offset addresses of the check values, the offset first address of a storage space is configured by software, and all the addresses are subjected to offset calculation according to the first address. During the compression process, three portions of data are written into the memory for read use, as shown in the left part of fig. 7, within the dashed box.
And (3) decompression process: as shown in the right part of fig. 7, when a host needs to read a certain image block, a block header of a compressed image is found first, compressed image block data and a check value address are found according to information inside the block header, the two parts are read, the compressed data enters an image block lossless decompression module for decompression, the obtained image block data enters an image block check code inspection module, a generated check code is compared with a check code during compression, if the check codes are the same, the data is correct, and if not, the data is wrong, so that whether the data is correct is inspected.
The compressed data of the image block, the header of the image block and the check value of the original image block are respectively stored in 3 different data buffers. Image packet head the content is as follows: the size of the compressed image data, the offset of the compressed image data (relative to the header address of the compressed data of the image block) and the offset of the check code of the image block. The method and the device can ensure the correctness of the compressed, decompressed, transmitted and stored images, and the host can also ensure the correctness of each image block by reading a part of image data.
Referring to fig. 8, fig. 8 is a schematic structural diagram of an image verification apparatus according to an embodiment of the present disclosure, and as shown in fig. 8, an image verification apparatus 800 according to an embodiment of the present disclosure includes:
a dividing module 801, configured to divide an original image into a plurality of image blocks that are not overlapped with each other;
the encoding module 802 is configured to generate corresponding pre-compression image check codes according to the plurality of image blocks;
the compression module 803 is configured to perform lossless compression on the plurality of image blocks to obtain image block compressed data and image block header data;
the decompression module 804 is configured to perform lossless decompression to obtain an image block corresponding to the original image according to the pre-compression image check code, the image block compressed data, and the image block header data, and calculate to obtain a decompressed image check code according to the decompressed image block;
and the checking module 805 is configured to compare the pre-compression image checking code with the decompressed image checking code to complete checking.
In specific implementation, each module and/or unit may be implemented as an independent entity, or may be implemented as one or multiple entities by any combination, where the specific implementation of each module and/or unit may refer to the foregoing method embodiment, and specific achievable beneficial effects also refer to the beneficial effects in the foregoing method embodiment, which are not described herein again.
In addition, according to the electronic device provided by the embodiment of the invention, the electronic device can be a mobile terminal such as a smart phone and a tablet computer. The electronic device comprises a processor and a memory. The processor is electrically connected with the memory.
The processor is a control center of the electronic equipment, is connected with various parts of the whole electronic equipment by various interfaces and lines, executes various functions of the electronic equipment and processes data by running or loading application programs stored in the memory and calling the data stored in the memory, thereby carrying out the overall monitoring on the electronic equipment.
In this embodiment, a processor in the electronic device loads instructions corresponding to processes of one or more application programs into a memory according to the following steps, and the processor runs the application programs stored in the memory, thereby implementing various functions:
dividing an original image into a plurality of image blocks which are not overlapped with each other;
generating corresponding pre-compression image check codes according to the plurality of image blocks;
lossless compression is carried out on the plurality of image blocks to obtain image block compressed data and image block header data;
lossless decompression is carried out according to the image check code before compression, the image block compressed data and the image block header data to obtain an image block corresponding to the original image, and the decompressed image check code is obtained through calculation according to the decompressed image block;
and comparing the before-compression image check code with the after-decompression image check code to finish checking.
The electronic device may implement the steps in any embodiment of the image verification method provided in the embodiment of the present invention, and therefore, beneficial effects that can be achieved by any image verification method provided in the embodiment of the present invention can be achieved, which are detailed in the foregoing embodiments and will not be described herein again.
Referring to fig. 9, fig. 9 is another schematic structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 9, fig. 9 is a specific structural block diagram of the electronic device according to the embodiment of the present invention, where the electronic device may be used to implement the image verification method provided in the foregoing embodiment. The electronic device 900 may be a mobile terminal such as a smart phone or a notebook computer.
The RF circuit 910 is used for receiving and transmitting electromagnetic waves, so as to achieve the interconversion between the electromagnetic waves and the electrical signals, and thus, communicate with a communication network or other devices. RF circuit 910 may include various existing circuit elements for performing these functions, such as an antenna, a radio frequency transceiver, a digital signal processor, an encryption/decryption chip, a Subscriber Identity Module (SIM) card, memory, and so forth. The RF circuit 910 may communicate with various networks such as the internet, an intranet, a wireless network, or with other devices over a wireless network. The wireless network may comprise a cellular telephone network, a wireless local area network, or a metropolitan area network. The Wireless network may use various Communication standards, protocols and technologies, including but not limited to Global System for Mobile Communication (GSM), enhanced Data GSM Environment (EDGE), wideband Code Division Multiple Access (WCDMA), code Division Multiple Access (CDMA), time Division Multiple Access (TDMA), wireless Fidelity (Wi-Fi) (e.g., IEEE802.11 a, IEEE802.1 b, IEEE802.1 g and/or IEEE802.11 n), voice over Internet Protocol (VoIP), world wide Microwave Access (world Interoperability for micro), other suitable protocols for email, max and short message Communication, and any other suitable protocols, including those not currently developed.
The memory 920 may be used to store software programs and modules, such as program instructions/modules corresponding to the image verification method in the foregoing embodiment, and the processor 980 executes various functional applications and resource accesses by running the software programs and modules stored in the memory 920, that is, implementing the following functions:
the memory 920 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 920 can further include memory located remotely from the processor 980, which can be connected to the electronic device 900 over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input unit 930 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, the input unit 930 may include a touch-sensitive surface 931 as well as other input devices 932. Touch-sensitive surface 931, also referred to as a touch screen or touch pad, may collect user touch operations (e.g., user operations on or near touch-sensitive surface 931 using a finger, stylus, or any other suitable object or attachment) and drive the corresponding connecting device according to a predetermined program. Alternatively, the touch sensitive surface 931 may include both a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 980, and can receive and execute commands sent by the processor 980. In addition, the touch sensitive surface 931 may be implemented using various types of resistive, capacitive, infrared, and surface acoustic waves. The input unit 930 may comprise other input devices 932 in addition to the touch-sensitive surface 931. In particular, other input devices 932 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 940 may be used to display information input by or provided to the user and various graphical user interfaces of the electronic device 900, which may be made up of graphics, text, icons, video, and any combination thereof. The Display unit 940 may include a Display panel 941, and optionally, the Display panel 941 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch-sensitive surface 931 may overlay the display panel 941, and when a touch operation is detected on or near the touch-sensitive surface 931, the touch operation is transmitted to the processor 980 to determine the type of touch event, and the processor 980 then provides a corresponding visual output on the display panel 941 according to the type of touch event. Although the touch-sensitive surface 931 and the display panel 941 are shown as two separate components to implement input and output functions, in some embodiments, the touch-sensitive surface 931 and the display panel 941 may be integrated to implement input and output functions.
The electronic device 900 may also include at least one sensor 950, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 941 according to the brightness of ambient light, and a proximity sensor that may generate an interrupt when the folder is closed or closed. As one of the motion sensors, the gravity acceleration sensor may detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when the mobile phone is stationary, and may be used for applications of recognizing gestures of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and tapping), and other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor that may be configured to the electronic device 900, which are not described herein again.
Audio circuitry 960, speaker 961, microphone 962 may provide an audio interface between a user and electronic device 900. The audio circuit 960 may transmit the electrical signal converted from the received audio data to the speaker 961, and convert the electrical signal into a sound signal for output by the speaker 961; on the other hand, the microphone 962 converts the collected sound signal into an electric signal, converts the electric signal into audio data after being received by the audio circuit 960, and outputs the audio data to the processor 980 for processing, and then transmits the audio data to another terminal via the RF circuit 910, or outputs the audio data to the memory 920 for further processing. The audio circuit 960 may also include an earbud jack to provide communication of a peripheral headset with the electronic device 900.
The electronic device 900, via the transport module 970 (e.g., a Wi-Fi module), may assist the user in receiving requests, sending information, etc., which provides the user with wireless broadband internet access. Although the transmission module 970 is shown in the drawings, it is understood that it does not belong to the essential constitution of the electronic device 900 and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 980 is a control center of the electronic device 900, connects various parts of the entire cellular phone using various interfaces and lines, and performs various functions of the electronic device 900 and processes data by operating or executing software programs and/or modules stored in the memory 920 and calling data stored in the memory 920, thereby integrally monitoring the electronic device. Optionally, processor 980 may include one or more processing cores; in some embodiments, the processor 980 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 980.
Electronic device 900 also includes a power supply 990 (e.g., a battery) for supplying power to various components, which in some embodiments may be logically connected to processor 980 via a power management system, such that the functions of managing charging, discharging, and power consumption are performed via the power management system. Power supply 990 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and the like.
Although not shown, the electronic device 900 further includes a camera (e.g., a front camera, a rear camera), a bluetooth module, etc., which are not described in detail herein. Specifically, in this embodiment, the display unit of the electronic device is a touch screen display, the mobile terminal further includes a memory, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for:
dividing an original image into a plurality of image blocks which are not overlapped with each other;
generating corresponding pre-compression image check codes according to the plurality of image blocks;
lossless compression is carried out on the plurality of image blocks to obtain image block compressed data and image block header data;
lossless decompression is carried out according to the image check code before compression, the image block compressed data and the image block header data to obtain an image block corresponding to the original image, and the decompressed image check code is obtained through calculation according to the decompressed image block;
and comparing the before-compression image check code with the decompressed image check code to finish checking.
In specific implementation, the above modules may be implemented as independent entities, or may be combined arbitrarily, and implemented as the same or several entities, and specific implementations of the above modules may refer to the foregoing method embodiment, which is not described herein again.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor. To this end, an embodiment of the present invention provides a computer-readable storage medium, in which a plurality of instructions are stored, where the instructions can be loaded by a processor to execute the steps of any embodiment of the image verification method provided in the embodiment of the present invention.
Wherein the computer-readable storage medium may include: read Only Memory (ROM), random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the computer-readable storage medium may execute the steps in any embodiment of the image verification method provided in the embodiment of the present invention, beneficial effects that can be achieved by any image verification method provided in the embodiment of the present invention can be achieved, for details, see the foregoing embodiment, and are not described herein again.
The image verification method, the image verification device, the electronic device, and the computer-readable storage medium provided in the embodiments of the present invention are described in detail above, and specific examples are applied herein to explain the principles and embodiments of the present invention, and the description of the embodiments is only used to help understanding the method and the core idea of the present invention; meanwhile, for those skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed, and in summary, the content of the present specification should not be construed as limiting the present invention. Moreover, it will be apparent to those skilled in the art that various modifications and adaptations can be made without departing from the principles of the invention, and such modifications and adaptations are intended to be within the scope of the invention.

Claims (10)

1. An image verification method, comprising:
dividing an original image into a plurality of image blocks which are not overlapped with each other;
generating corresponding pre-compression image check codes according to the image blocks;
lossless compression is carried out on the plurality of image blocks to obtain image block compressed data and image block header data;
lossless decompression is carried out according to the image check code before compression, the image block compressed data and the image block header data to obtain an image block corresponding to the original image, and the decompressed image check code is obtained through calculation according to the decompressed image block;
and comparing the before-compression image check code with the after-decompression image check code to finish checking.
2. The image verification method of claim 1, wherein the dividing the original image into a plurality of non-overlapping image blocks comprises:
acquiring the actual size of the original image;
if the actual size is an integral multiple of a preset size, dividing the original image into a plurality of image blocks which are not overlapped and have the size of the preset size, and recording the arrangement positions of the image blocks;
if the actual size is not an integral multiple of the preset size, dividing the original image into image blocks which are not overlapped and have part of the preset size and part of the other sizes, and recording the arrangement positions of the image blocks.
3. The image verification method of claim 2, wherein the generating the corresponding pre-compression image verification codes according to the image blocks comprises:
carrying out gray processing on the image blocks to obtain corresponding gray image blocks;
and respectively calculating each gray image block according to a preset check algorithm to obtain a corresponding before-compression image check code.
4. The image verification method according to claim 3, wherein the step of calculating each of the gray-scale image blocks according to a preset verification algorithm to obtain the corresponding pre-compression image verification code comprises:
acquiring a gray value corresponding to a pixel point in the gray image block;
generating a binary code corresponding to the gray-scale image block according to the arrangement position of each pixel point in the gray-scale image block;
and calculating the binary codes according to a preset check algorithm to obtain the image check codes before compression corresponding to the gray-scale image blocks.
5. The image verification method according to any one of claims 1 to 4, wherein after lossless compression is performed on the image blocks to obtain image block compressed data and image block header data, the method comprises:
calculating the storage position of the corresponding image block according to the arrangement position of the image block in the original image, and storing the compressed data of the image block to a data storage partition corresponding to the storage position;
calculating a corresponding check code offset address according to the arrangement position of the image block in the original image, and storing the image check code before compression in a check storage partition corresponding to the check code offset address;
calculating a corresponding packet header offset address according to the arrangement position of the image block in the original image, and storing packet header data of the image block to a packet header storage partition corresponding to the packet header offset address;
the header data of the image block comprises a storage position of the corresponding image block, a check code offset address and a size of the compressed data block.
6. The image verification method of claim 5, wherein the performing lossless decompression to obtain the image blocks corresponding to the original image according to the pre-compression image verification code, the image block compressed data, and the image block header data, and calculating to obtain the decompressed image verification code according to the decompressed image blocks comprises:
acquiring an image block reading instruction; the image block reading instruction comprises an identification number of the image block, the identification number and the arrangement position of the image block in the original image have a one-to-one mapping relation, and the identification number and the packet header offset address have a corresponding relation;
reading the header data of the image block corresponding to the header offset address from the header storage partition according to the identification number;
obtaining a storage position and a check code offset address of a corresponding image block according to the header data of the image block;
reading corresponding image block compressed data from the data storage partition according to the storage position, performing lossless decompression on the image block compressed data to obtain a corresponding image block, and calculating the decompressed image block according to the preset check algorithm to obtain the decompressed image check code;
and searching a corresponding image check code before compression from a check storage partition of the memory according to the check code offset address.
7. The image verification method of claim 1, wherein the comparing the pre-compression image verification code with the post-decompression image verification code to complete verification comprises:
judging whether the before-compression image check code corresponding to the image block is the same as the after-decompression image check code;
if the image blocks are the same, determining that the image blocks are not tampered;
and if the difference is different, determining that the image block is tampered.
8. An image verification apparatus, comprising:
the dividing module is used for dividing an original image into a plurality of image blocks which are not overlapped with each other;
the coding module is used for generating corresponding pre-compression image check codes according to the plurality of image blocks;
the compression module is used for carrying out lossless compression on the plurality of image blocks to obtain image block compressed data and image block header data;
the decompression module is used for carrying out lossless decompression to obtain an image block corresponding to the original image according to the image check code before compression, the image block compressed data and the image block header data, and calculating to obtain a decompressed image check code according to the decompressed image block;
and the checking module is used for comparing the before-compression image checking code with the after-decompression image checking code to finish checking.
9. An electronic device comprising a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, the memory being coupled to the processor, and the processor implementing the steps of the image verification method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, wherein when the computer program runs, the computer-readable storage medium is controlled to execute the steps in the image verification method according to any one of claims 1 to 7.
CN202310219725.9A 2023-03-09 2023-03-09 Image verification method, device, equipment and computer readable storage medium Active CN115883839B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310219725.9A CN115883839B (en) 2023-03-09 2023-03-09 Image verification method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310219725.9A CN115883839B (en) 2023-03-09 2023-03-09 Image verification method, device, equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN115883839A true CN115883839A (en) 2023-03-31
CN115883839B CN115883839B (en) 2023-06-06

Family

ID=85762076

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310219725.9A Active CN115883839B (en) 2023-03-09 2023-03-09 Image verification method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN115883839B (en)

Citations (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000078413A (en) * 1998-09-01 2000-03-14 Matsushita Graphic Communication Systems Inc Image processor
US6195391B1 (en) * 1994-05-31 2001-02-27 International Business Machines Corporation Hybrid video compression/decompression system
US6529633B1 (en) * 1998-09-16 2003-03-04 Texas Instruments Incorporated Parallel difference coding method for lossless compression and real time decompression
CN101039417A (en) * 2007-04-26 2007-09-19 广东威创日新电子有限公司 Multi-block parallel compression video data apparatus and compression method thereof
WO2008123825A1 (en) * 2007-04-04 2008-10-16 Telefonaktiebolaget Lm Ericsson (Publ) Multi-mode vector-based image processing
CN103384884A (en) * 2012-12-11 2013-11-06 华为技术有限公司 File compression method and device, file decompression method and device, and server
WO2014075567A1 (en) * 2012-11-19 2014-05-22 腾讯科技(深圳)有限公司 Lossless compression method and device for picture
CN104301726A (en) * 2014-09-15 2015-01-21 成都智明达数字设备有限公司 Method for image lossless compression and uncompress
CN105894069A (en) * 2016-03-29 2016-08-24 吴城凤 CRC QR code generating method for visual navigation and identification method
CN106126367A (en) * 2016-06-28 2016-11-16 湖北锐世数字医学影像科技有限公司 A kind of self checking method and system of file
CN107995384A (en) * 2017-11-23 2018-05-04 晨星半导体股份有限公司 Video tamper resistant method, video capture equipment and video verification method
US20190025369A1 (en) * 2017-07-24 2019-01-24 Chunghwa Picture Tubes, Ltd. Display device and method for detecting electrostatic discharge phenomenon thereof
CN110855638A (en) * 2019-10-28 2020-02-28 中国资源卫星应用中心 Remote sensing satellite data decompression processing system and method based on cloud computing
WO2021007742A1 (en) * 2019-07-15 2021-01-21 上海极清慧视科技有限公司 Compression method for obtaining video file, decompression method, system, and storage medium
CN112364875A (en) * 2020-11-19 2021-02-12 合肥闪捷信息科技有限公司 Method for tracing paper sensitive file based on histogram binarization
CN112650992A (en) * 2020-12-21 2021-04-13 江苏群杰物联科技有限公司 Document tracking encryption method based on digital watermark
CN113949865A (en) * 2021-10-15 2022-01-18 中航航空电子有限公司 Image encoding method, image encoding device, computer apparatus, storage medium, and image decoding method
WO2022079466A1 (en) * 2020-10-13 2022-04-21 Chan Kam Fu Data authentication for data compression
CN114428595A (en) * 2022-01-28 2022-05-03 深圳市爱协生科技有限公司 Image processing method, image processing device, computer equipment and storage medium
WO2022252488A1 (en) * 2021-06-02 2022-12-08 苏州浪潮智能科技有限公司 Image compression method and apparatus, electronic device, and readable storage medium
CN115527101A (en) * 2022-09-23 2022-12-27 阿里巴巴(中国)有限公司 Image tampering detection method and processor

Patent Citations (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6195391B1 (en) * 1994-05-31 2001-02-27 International Business Machines Corporation Hybrid video compression/decompression system
JP2000078413A (en) * 1998-09-01 2000-03-14 Matsushita Graphic Communication Systems Inc Image processor
US6529633B1 (en) * 1998-09-16 2003-03-04 Texas Instruments Incorporated Parallel difference coding method for lossless compression and real time decompression
WO2008123825A1 (en) * 2007-04-04 2008-10-16 Telefonaktiebolaget Lm Ericsson (Publ) Multi-mode vector-based image processing
CN101039417A (en) * 2007-04-26 2007-09-19 广东威创日新电子有限公司 Multi-block parallel compression video data apparatus and compression method thereof
WO2014075567A1 (en) * 2012-11-19 2014-05-22 腾讯科技(深圳)有限公司 Lossless compression method and device for picture
CN103384884A (en) * 2012-12-11 2013-11-06 华为技术有限公司 File compression method and device, file decompression method and device, and server
CN104301726A (en) * 2014-09-15 2015-01-21 成都智明达数字设备有限公司 Method for image lossless compression and uncompress
CN105894069A (en) * 2016-03-29 2016-08-24 吴城凤 CRC QR code generating method for visual navigation and identification method
CN106126367A (en) * 2016-06-28 2016-11-16 湖北锐世数字医学影像科技有限公司 A kind of self checking method and system of file
US20190025369A1 (en) * 2017-07-24 2019-01-24 Chunghwa Picture Tubes, Ltd. Display device and method for detecting electrostatic discharge phenomenon thereof
CN107995384A (en) * 2017-11-23 2018-05-04 晨星半导体股份有限公司 Video tamper resistant method, video capture equipment and video verification method
WO2021007742A1 (en) * 2019-07-15 2021-01-21 上海极清慧视科技有限公司 Compression method for obtaining video file, decompression method, system, and storage medium
CN110855638A (en) * 2019-10-28 2020-02-28 中国资源卫星应用中心 Remote sensing satellite data decompression processing system and method based on cloud computing
WO2022079466A1 (en) * 2020-10-13 2022-04-21 Chan Kam Fu Data authentication for data compression
CN112364875A (en) * 2020-11-19 2021-02-12 合肥闪捷信息科技有限公司 Method for tracing paper sensitive file based on histogram binarization
CN112650992A (en) * 2020-12-21 2021-04-13 江苏群杰物联科技有限公司 Document tracking encryption method based on digital watermark
WO2022252488A1 (en) * 2021-06-02 2022-12-08 苏州浪潮智能科技有限公司 Image compression method and apparatus, electronic device, and readable storage medium
CN113949865A (en) * 2021-10-15 2022-01-18 中航航空电子有限公司 Image encoding method, image encoding device, computer apparatus, storage medium, and image decoding method
CN114428595A (en) * 2022-01-28 2022-05-03 深圳市爱协生科技有限公司 Image processing method, image processing device, computer equipment and storage medium
CN115527101A (en) * 2022-09-23 2022-12-27 阿里巴巴(中国)有限公司 Image tampering detection method and processor

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王健等, 南京:东南大学出版社 *

Also Published As

Publication number Publication date
CN115883839B (en) 2023-06-06

Similar Documents

Publication Publication Date Title
CN106919918B (en) Face tracking method and device
CN109828688B (en) Screen damage processing method, mobile terminal and computer readable storage medium
US11057216B2 (en) Protection method and protection system of system partition key data and terminal
CN109583271B (en) Method, device and terminal for fitting lane line
CN110730017A (en) Radio frequency device, control method thereof and terminal equipment
CN110830127B (en) Radio frequency parameter processing method and device, mobile terminal and storage medium
CN110287655B (en) Verification code input method and device and mobile terminal
CN110933706A (en) Network communication setting method, device, storage medium and terminal
CN111064847B (en) False touch prevention method and device, storage medium and electronic equipment
CN112612745A (en) Data transmission method and device, electronic equipment and readable storage medium
CN109286414B (en) Antenna determination method and terminal
CN111026457A (en) Hardware configuration method and device, storage medium and terminal equipment
CN115883839B (en) Image verification method, device, equipment and computer readable storage medium
US20220263589A1 (en) Digital pre-distortion processing method and electronic device
CN111355991B (en) Video playing method and device, storage medium and mobile terminal
CN110996003B (en) Photographing positioning method and device and mobile terminal
CN109492451B (en) Coded image identification method and mobile terminal
CN112367428A (en) Electric quantity display method and system, storage medium and mobile terminal
CN112199245B (en) Mobile terminal screen detection method, system, storage medium and mobile terminal
CN115905160B (en) Verification method and device for data storage, electronic equipment and storage medium
CN115829897A (en) Image fusion processing method and device, electronic equipment and medium
CN111651313B (en) Conversion method and system of identification card, storage medium and terminal equipment
CN112379857B (en) Audio data processing method and device, storage medium and mobile terminal
CN108959073B (en) Method and device for testing algorithm library, storage medium and electronic equipment
CN116669003A (en) Data processing method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant