CN115883839B - Image verification method, device, equipment and computer readable storage medium - Google Patents
Image verification method, device, equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN115883839B CN115883839B CN202310219725.9A CN202310219725A CN115883839B CN 115883839 B CN115883839 B CN 115883839B CN 202310219725 A CN202310219725 A CN 202310219725A CN 115883839 B CN115883839 B CN 115883839B
- Authority
- CN
- China
- Prior art keywords
- image
- compression
- data
- image block
- blocks
- 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.)
- Active
Links
- 238000012795 verification Methods 0.000 title claims abstract description 81
- 238000000034 method Methods 0.000 title claims abstract description 64
- 238000007906 compression Methods 0.000 claims abstract description 93
- 230000006835 compression Effects 0.000 claims abstract description 91
- 230000006837 decompression Effects 0.000 claims abstract description 20
- 238000004422 calculation algorithm Methods 0.000 claims description 16
- 238000005192 partition Methods 0.000 claims description 15
- 238000012545 processing Methods 0.000 claims description 11
- 238000004590 computer program Methods 0.000 claims description 8
- 238000013500 data storage Methods 0.000 claims description 5
- 239000000872 buffer Substances 0.000 claims description 3
- 238000013507 mapping Methods 0.000 claims description 2
- 230000006870 function Effects 0.000 description 10
- 238000001514 detection method Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 8
- 238000004891 communication Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 230000009286 beneficial effect Effects 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 4
- 238000012937 correction Methods 0.000 description 4
- 238000010295 mobile communication Methods 0.000 description 4
- 230000001133 acceleration Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000005236 sound signal Effects 0.000 description 2
- 230000001413 cellular effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 238000007667 floating Methods 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000010897 surface acoustic wave method Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Compression Of Band Width Or Redundancy In Fax (AREA)
Abstract
The invention discloses an image verification method, an image verification device, image verification equipment and a computer readable storage medium, wherein the image verification 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 image blocks; performing lossless compression on the image blocks to obtain image block compression data and image block packet header data; performing lossless decompression according to the pre-compression image check code, the image block compression data and the image block packet header data to obtain an image block corresponding to the original image, and calculating according to the decompressed image block to obtain a decompressed image check code; and comparing the pre-compression image check code with the post-decompression image check code to finish check. The invention improves the accuracy of image verification.
Description
Technical Field
The present invention relates to the field of data security technologies, and in particular, to an image verification method, apparatus, device, and computer readable storage medium.
Background
In the technology of compressing and decompressing real-time digital images, a data stream generated after compression is sent to a decompressing module through a certain path, and if the data stream is in error in the paths, the decompressing module cannot correctly recover images.
Therefore, the prior art performs verification on the image data to ensure the accuracy of the image data. However, in the prior art, CRC check is performed on the compressed image data, so that the correctness of the compression and decompression processes cannot be guaranteed.
Disclosure of Invention
The embodiment of the invention aims to provide an image verification method, an image verification device and a computer readable storage medium, which are used for improving the image splicing efficiency, effectively solving the problems of double images and gaps in a splicing result and enabling two adjacent images to be gradually transited when being fused and spliced.
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;
performing lossless compression on the image blocks to obtain image block compression data and image block packet header data;
performing lossless decompression according to the pre-compression image check code, the image block compression data and the image block packet header data to obtain an image block corresponding to the original image, and calculating according to the decompressed image block to obtain a decompressed image check code;
and comparing the pre-compression image check code with the post-decompression image check code to finish check.
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 the original image into a plurality of image blocks which are not overlapped with each other;
the encoding 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 image blocks to obtain image block compression data and image block packet header data;
the decompression module is used for performing lossless decompression according to the pre-compression image check code, the image block compression data and the image block packet header data to obtain an image block corresponding to the original image, and calculating according to the decompressed image block to obtain a decompressed image check code;
and the verification module is used for comparing the pre-compression image verification code with the post-decompression image verification code to finish verification.
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 where the processor executes the computer program to implement the steps in the image verification method described in any one of the above.
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, where a device where the computer readable storage medium is controlled to execute the steps in the image verification method described in any one of the above when the computer program runs.
The embodiment of the invention provides an image verification method, an image verification device, image verification equipment and a computer readable storage medium. The invention can read partial image data, process partial data block and error detection in the whole process, and ensure the correctness of compressed, decompressed, transmitted and stored image.
Drawings
FIG. 1 is a schematic flow chart of an image verification method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of another image verification method according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of another image verification method according to an embodiment of the present invention;
FIG. 4 is a schematic flow chart of another image verification method according to an embodiment of the present invention;
FIG. 5 is a schematic flow chart of another image verification method according to an embodiment of the present invention;
FIG. 6 is a schematic flow chart of another image verification method according to an embodiment of the present invention;
FIG. 7 is a schematic flow chart of another image verification method according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of an image verification device according to an embodiment of the present invention;
fig. 9 is a schematic diagram of another structure of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, 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 "including" and variations thereof as used herein are intended to be 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. Related definitions of other terms will be given in the description below.
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 an 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, carrying out lossless compression on the image blocks to obtain image block compression data and image block packet header data;
s104, performing lossless decompression according to the pre-compression image check code, the image block compression data and the image block packet header data to obtain an image block corresponding to the original image, and calculating according to the decompressed image block to obtain a decompressed image check code;
s105, comparing the pre-compression image check code with the post-decompression image check code to finish check.
Specifically, the invention uses lossless compression and lossless decompression of images to reduce bandwidth occupation under a functional safety scene, and simultaneously meets the error detection of the processing process required by the functional safety target. The invention can read partial image data, process partial data block and error detection in the whole process, and ensure the correctness of compressed, decompressed, transmitted and stored image.
Referring to fig. 2, fig. 2 is another flow chart of the image verification method provided by the embodiment of the invention, and as shown in fig. 2, the image verification method provided by the embodiment of the invention includes steps S201 to S203.
S201, acquiring the actual size of the original image;
s202, if the actual size is an integer multiple of a preset size, dividing the original image into a plurality of image blocks which are not overlapped with each other and have the preset size, and recording the arrangement positions of the plurality of image blocks;
and S203, if the actual size is not an integer multiple of the preset size, dividing the original image into image blocks which are not overlapped with each other and have partial sizes of the preset size and image blocks which have partial sizes of 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 an embodiment of the present invention includes steps S301 to S302.
S301, carrying out gray processing on the image block to obtain a corresponding gray image block;
s302, respectively calculating each gray image block according to a preset verification algorithm to obtain a corresponding pre-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 an embodiment of the present invention includes steps S401 to S403.
S401, acquiring gray values corresponding to pixel points in the gray image block;
s402, generating binary codes corresponding to the gray image blocks according to the arrangement positions of the pixel points in the gray image blocks;
s403, calculating the binary code according to a preset check algorithm to obtain a pre-compression image check code corresponding to the gray image block.
Specifically, the method facilitates the graying treatment of the image, wherein the graying treatment is the process of converting a color image into a gray image. A color image generally includes three components R, G, B, and each of the three components shows various colors such as red, green, and blue, and graying is a process of equalizing the three components R, G, B of the color image. Each pixel in the gray image has only one sample color, the gray is a multi-level color depth between black and white, the pixel with large gray value is lighter, and is darker, the gray value is 255 (representing black) at maximum, and the gray value is 0 (representing white) at 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 points with the gray values being larger than a preset gray threshold (for example, 128) as a first numerical value (for example, 1), and determining the coding value of the pixel points with the gray values being smaller than the preset gray threshold as a second numerical value (for example, 0). And generating binary codes corresponding to the gray image blocks according to the arrangement positions of the pixel points in the gray image blocks according to the first numerical value and the second numerical value corresponding to the pixel points.
The preset checking algorithm includes a CRC checking algorithm and the like, and the preset error correction algorithm is essentially an FFC (Forward Error Correction abbreviation, i.e., forward error correction coding) algorithm, and the FFC algorithm includes hamming codes (i.e., hanmming codes), R (Reed-solomon codes), LDPC (Low Denity Parity Check Code abbreviation, i.e., low density parity check codes), and the like. The types of the preset checking algorithms are different so that the corresponding check digits are different, and therefore, the check digits need to be determined according to the types of the preset error correction algorithms and the binary coded code digits.
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 an 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 the image block compressed data to a data storage partition corresponding to the storage positions;
s502, calculating a corresponding check code offset address according to the arrangement position of the image blocks in the original image, and storing the pre-compression image check code 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 blocks in the original image, and storing the packet header data of the image blocks into a packet header storage partition corresponding to the packet header offset address;
the image block packet head data comprises storage positions, check code offset addresses and compressed data block sizes of corresponding image blocks.
Specifically, an initial storage location of the first compressed picture 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 position 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 position of a first image block packet header is set, and a packet header offset address for storing image block packet header data 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 an 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, wherein 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 image block packet header data corresponding to the packet header offset address from the packet header storage partition according to the identification number;
s603, obtaining a storage position and a check code offset address of a corresponding image block according to the image block packet header data;
s604, corresponding image block compression data are read from the data storage partition according to the storage position, lossless decompression is carried out on the image block compression data to obtain corresponding image blocks, and the decompressed image block is calculated according to the preset verification algorithm to obtain the decompressed image verification code;
s605, corresponding pre-compression image check codes are read from the check storage partition according to the check code offset addresses.
Specifically, judging whether the pre-compression image check code corresponding to the image block is identical to the post-decompression image check code; if the image blocks are the same, determining that the image blocks are not tampered; if it is determined differently that the image block has been tampered with.
The compression process comprises the following steps: an 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 enter an image block lossless compression module to carry out lossless compression on the image blocks to generate two parts of data, one part of the data is image block compressed data, the other part of the data is an image block packet header, the image block packet header comprises the size of the compressed image, a compressed storage position and offset addresses of the check values, the offset first addresses of the storage space are configured by software, and offset calculation is carried out according to the first addresses when all the addresses are used. In the compression process, as shown in the left part of fig. 7, three parts of data in the dotted line frame are written into the memory to wait for reading.
Decompression process: when the host needs to read a certain image block, the right part shown in fig. 7 finds the block header of the compressed image, finds the compressed image block data and the check value address according to the information in the block header, reads out the two parts, and sends the compressed data into the lossless decompression module of the image block for decompression, so as to obtain the image block data, and sends the image block data into the check code checking module of the image block, so that the check code is generated and compared with the check code in the compression, if the check codes are the same, the data are correct, and if the check codes are different, the data are wrong, so that whether the data are correct is checked.
The image block compressed data, the image block packet header and the original image block check value are respectively stored in 3 different data buffers. The content of the image packet header: the size of the compressed image data, the offset of the compressed image data (relative to the first address of the compressed data of the image block) and the offset of the image block check code. The method and the device can ensure the correctness of the compressed, decompressed, transmitted and stored image, 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 provided in an embodiment of the present application, and as shown in fig. 8, an image verification apparatus 800 provided in an embodiment of the present application includes:
a dividing module 801, configured to divide an original image into a plurality of image blocks that do not overlap with each other;
the encoding module 802 is configured to generate a corresponding pre-compression image check code 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 packet header data;
the decompression module 804 is configured to perform lossless decompression according to the pre-compression image check code, the image block compression data, and the image block header data to obtain an image block corresponding to the original image, and calculate according to the decompressed image block to obtain a decompressed image check code;
and the verification module 805 is configured to compare the pre-compression image verification code with the post-decompression image verification code to complete verification.
In the implementation, each module and/or unit may be implemented as an independent entity, or may be combined arbitrarily and implemented as the same entity or a plurality of entities, where the implementation of each module and/or unit may refer to the foregoing method embodiment, and the specific beneficial effects that may be achieved may refer to the beneficial effects in the foregoing method embodiment, which are not described herein again.
In addition, the electronic equipment provided by the embodiment of the invention can be mobile terminals such as smart phones, tablet computers and other equipment. The electronic device includes a processor, a memory. The processor is electrically connected with the memory.
The processor is a control center of the electronic device, and uses various interfaces and lines to connect various parts of the whole electronic device, and executes various functions of the electronic device and processes data by running or loading application programs stored in the memory and calling the data stored in the memory, so as to monitor the electronic device as a whole.
In this embodiment, the processor in the electronic device loads the instructions corresponding to the processes of one or more application programs into the memory according to the following steps, and the processor executes the application programs stored in the memory, so as to implement 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 image blocks;
performing lossless compression on the image blocks to obtain image block compression data and image block packet header data;
performing lossless decompression according to the pre-compression image check code, the image block compression data and the image block packet header data to obtain an image block corresponding to the original image, and calculating according to the decompressed image block to obtain a decompressed image check code;
and comparing the pre-compression image check code with the post-decompression image check code to finish check.
The electronic device can realize the steps in any embodiment of the image verification method provided by the embodiment of the present invention, so that the beneficial effects that any image verification method provided by the embodiment of the present invention can realize can be realized, and detailed descriptions of the previous embodiments are omitted herein.
Referring to fig. 9, fig. 9 is another schematic structural diagram of an electronic device provided in the embodiment of the present invention, and fig. 9 is a specific structural block diagram of the electronic device provided in the embodiment of the present invention, where the electronic device may be used to implement the image verification method provided in the embodiment. The electronic device 900 may be a mobile terminal such as a smart phone or a notebook computer.
The RF circuit 910 is configured to receive and transmit electromagnetic waves, and to perform mutual conversion between the electromagnetic waves and the electrical signals, so as to communicate with a communication network or other devices. The RF circuitry 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 the like. The RF circuitry 910 may communicate with various networks such as the internet, intranets, wireless networks, or with other devices via wireless networks. The wireless network may include a cellular telephone network, a wireless local area network, or a metropolitan area network. The wireless networks described above may use a variety of communication standards, protocols, and technologies including, but not limited to, global system for mobile communications (Global System for Mobile Communication, GSM), enhanced mobile communications technology (Enhanced Data GSM Environment, EDGE), wideband code division multiple access technology (Wideband Code Division Multiple Access, WCDMA), code division multiple access technology (Code Division Access, CDMA), time division multiple access technology (Time Division Multiple Access, TDMA), wireless fidelity technology (Wireless Fidelity, wi-Fi) (e.g., IEEE802.11 a, IEEE802.11 b, IEEE802.11g, and/or IEEE802.11 n), voice over internet protocol (Voice over Internet Protocol, voIP), worldwide interoperability for microwave access (Worldwide Interoperability for Microwave Access, wi-Max), other protocols for mail, instant messaging, and short messaging, and any other suitable communication protocols, even 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 above embodiments, 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 input unit 930 may be used to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, the input unit 930 may comprise a touch-sensitive surface 931 and other input devices 932. The touch-sensitive surface 931, also referred to as a touch display screen or touch pad, may collect touch operations thereon or thereabout by a user (e.g., operations of the user on or thereabout the touch-sensitive surface 931 using a finger, stylus, or any other suitable object or accessory) and actuate the corresponding connection device according to a predetermined program. Alternatively, the touch sensitive surface 931 may include two portions, a touch detection device and a touch controller. The touch detection device detects the touch azimuth 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 detection device and converts it into touch point coordinates, which are then sent to the processor 980, and can receive commands from the processor 980 and execute them. In addition, the touch-sensitive surface 931 may be implemented in various types of resistive, capacitive, infrared, surface acoustic wave, and the like. In addition to the touch-sensitive surface 931, the input unit 930 may also include other input devices 932. 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, mouse, joystick, etc.
The display unit 940 may be used to display information entered by a user or provided to a user as well as various graphical user interfaces of the electronic device 900, which may be composed of graphics, text, icons, video, and any combination thereof. The display unit 940 may include a display panel 941, and alternatively, 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 upon detection of a touch operation thereon or thereabout, the touch-sensitive surface 931 is passed 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 depending on the type of touch event. Although in the figures the touch-sensitive surface 931 and the display panel 941 are implemented as two separate components, in some embodiments the touch-sensitive surface 931 may be integrated with the display panel 941 to implement the input and output functions.
The electronic device 900 may also include at least one sensor 950, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, where the ambient light sensor may adjust the brightness of the display panel 941 according to the brightness of ambient light, and the proximity sensor may generate an interruption when the flip cover is closed or closed. As one of the motion sensors, the gravitational acceleration sensor may detect the acceleration in all directions (generally, three axes), and may detect the gravity and direction when stationary, and may be used for applications of recognizing the gesture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer, and knocking), and other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, which may be further configured in the electronic device 900, will not be described herein.
The electronic device 900 may facilitate user reception of requests, transmission of information, etc. via the transmission module 970 (e.g., wi-Fi module), which provides wireless broadband internet access to the user. 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 can be omitted entirely as required within the scope of not changing the essence of the invention.
The electronic device 900 also includes a power supply 990 (e.g., a battery) that provides power to the various components, and in some embodiments, may be logically coupled to the processor 980 through a power management system to perform functions such as managing charging, discharging, and power consumption by the power management system. The power source 990 may also include one or more of any components, such as a direct current or alternating current power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown, the electronic device 900 further includes a camera (e.g., front camera, rear camera), a bluetooth module, etc., which are not described herein. In particular, 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, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including 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 image blocks;
performing lossless compression on the image blocks to obtain image block compression data and image block packet header data;
performing lossless decompression according to the pre-compression image check code, the image block compression data and the image block packet header data to obtain an image block corresponding to the original image, and calculating according to the decompressed image block to obtain a decompressed image check code;
and comparing the pre-compression image check code with the post-decompression image check code to finish check.
In the implementation, each module may be implemented as an independent entity, or may be combined arbitrarily, and implemented as the same entity or several entities, and the implementation of each module may be referred to the foregoing method embodiment, which is not described herein again.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various 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 having stored therein a plurality of instructions capable of being loaded by a processor to perform the steps of any one of the embodiments of the image verification method provided by the embodiment of the present invention.
Wherein the computer-readable storage medium may comprise: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
Because the instructions stored in the computer readable storage medium can execute the steps in any embodiment of the image verification method provided by the embodiment of the present invention, the beneficial effects that any image verification method provided by the embodiment of the present invention can achieve can be achieved, which are detailed in the previous embodiments and are not described herein.
The foregoing has described in detail the methods, apparatuses, electronic devices and computer readable storage medium for verifying images provided by the embodiments of the present invention, and specific examples have been applied to illustrate the principles and embodiments of the present invention, where the above description of the embodiments is only for helping to understand the methods and core ideas of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in light of the ideas of the present invention, the present description should not be construed as limiting the present invention. Moreover, it will be apparent to those skilled in the art that various modifications and variations can be made without departing from the principles of the present invention, and such modifications and variations are also considered to be within the scope of the invention.
Claims (8)
1. An image verification method, comprising:
dividing an original image into a plurality of image blocks which are not overlapped with each other;
the dividing the original image into a plurality of image blocks which are not overlapped with each other comprises:
acquiring the actual size of the original image;
if the actual size is an integer multiple of a preset size, dividing the original image into a plurality of image blocks which are not overlapped with each other and have the preset size, and recording the arrangement positions of the plurality of image blocks;
if the actual size is not integral multiple of the preset size, dividing the original image into image blocks which are not overlapped with each other and have partial sizes of the preset size and image blocks which have partial sizes of other sizes, and recording the arrangement positions of the image blocks;
generating corresponding pre-compression image check codes according to the image blocks;
performing lossless compression on the image blocks to obtain image block compression data and image block packet header data;
the lossless compression of the image blocks to obtain image block compression data and image block header data comprises the following steps:
calculating a corresponding compressed storage position according to the arrangement position of the image blocks in the original image, and storing the compressed data of the image blocks into a data storage partition corresponding to the storage position;
calculating a corresponding check code offset address according to the arrangement position of the image blocks in the original image, and storing the pre-compression image check code into 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 blocks in the original image, and storing the packet header data of the image blocks into a packet header storage partition corresponding to the packet header offset address;
the image block packet head data comprises a corresponding compressed storage position, a check code offset address and a compressed data block size;
performing lossless decompression according to the pre-compression image check code, the image block compression data and the image block packet header data to obtain an image block corresponding to the original image, and calculating according to the decompressed image block to obtain a decompressed image check code;
comparing the pre-compression image check code with the post-decompression image check code to finish check;
the image block compressed data, the image block packet header data and the pre-compression image check code are respectively stored in 3 different data buffers.
2. The image verification method according to claim 1, wherein said generating a corresponding pre-compression image verification code from said number of 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 checking algorithm to obtain a corresponding pre-compression image checking code.
3. The image verification method according to claim 2, wherein the calculating the corresponding pre-compression image verification code for each gray image block according to the preset verification algorithm includes:
acquiring a gray value corresponding to a pixel point in the gray image block;
generating binary codes corresponding to the gray image blocks according to the arrangement positions of the pixel points in the gray image blocks;
and calculating the binary code according to a preset checking algorithm to obtain a pre-compression image checking code corresponding to the gray image block.
4. The image verification method according to claim 1, wherein the performing lossless decompression according to the pre-compression image verification code, the image block compression data, and the image block header data to obtain the image block corresponding to the original image, and calculating the decompressed image verification code according to the decompressed image block comprises:
acquiring an image block reading instruction; the image block reading instruction comprises an identification number of the image block, wherein 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 image block packet header data corresponding to the packet header offset address from the packet header storage partition according to the identification number;
obtaining a corresponding compression storage position and a check code offset address according to the image block packet header data;
reading corresponding image block compression data from the data storage partition according to the storage position, performing lossless decompression on the image block compression data to obtain corresponding image blocks, and calculating the decompressed image blocks according to a preset verification algorithm to obtain the decompressed image verification code;
and searching the corresponding pre-compression image check code from the check storage partition of the memory according to the check code offset address.
5. The image verification method according to claim 1, wherein said comparing the pre-compression image verification code with the post-decompression image verification code to complete verification comprises:
judging whether the pre-compression image check code corresponding to the image block is identical to the decompressed image check code or not;
if the image blocks are the same, determining that the image blocks are not tampered;
if it is determined differently that the image block has been tampered with.
6. An image verification apparatus, comprising:
the dividing module is used for dividing the original image into a plurality of image blocks which are not overlapped with each other;
the dividing the original image into a plurality of image blocks which are not overlapped with each other comprises:
acquiring the actual size of the original image;
if the actual size is an integer multiple of a preset size, dividing the original image into a plurality of image blocks which are not overlapped with each other and have the preset size, and recording the arrangement positions of the plurality of image blocks;
if the actual size is not integral multiple of the preset size, dividing the original image into image blocks which are not overlapped with each other and have partial sizes of the preset size and image blocks which have partial sizes of other sizes, and recording the arrangement positions of the image blocks;
the encoding 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 image blocks to obtain image block compression data and image block packet header data;
the lossless compression of the image blocks to obtain image block compression data and image block header data comprises the following steps:
calculating a corresponding compressed storage position according to the arrangement position of the image blocks in the original image, and storing the compressed data of the image blocks into a data storage partition corresponding to the storage position;
calculating a corresponding check code offset address according to the arrangement position of the image blocks in the original image, and storing the pre-compression image check code into 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 blocks in the original image, and storing the packet header data of the image blocks into a packet header storage partition corresponding to the packet header offset address;
the image block packet head data comprises a corresponding compressed storage position, a check code offset address and a compressed data block size;
the decompression module is used for performing lossless decompression according to the pre-compression image check code, the image block compression data and the image block packet header data to obtain an image block corresponding to the original image, and calculating according to the decompressed image block to obtain a decompressed image check code;
the verification module is used for comparing the pre-compression image verification code with the post-decompression image verification code to complete verification;
the image block compressed data, the image block packet header data and the pre-compression image check code are respectively stored in 3 different data buffers.
7. 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, when executing the computer program, implementing the steps in the image verification method according to any one of claims 1 to 5.
8. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program, wherein the computer program, when run, controls a device in which the computer readable storage medium is located to perform the steps in the image verification method according to any one of claims 1 to 5.
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 CN115883839A (en) | 2023-03-31 |
CN115883839B true 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 (16)
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 |
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 |
CN107995384A (en) * | 2017-11-23 | 2018-05-04 | 晨星半导体股份有限公司 | Video tamper-proof method, video shooting device and video verification method |
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 |
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 |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2014089753A1 (en) * | 2012-12-11 | 2014-06-19 | 华为技术有限公司 | File compression method, file decompression method, device and server |
CN106126367B (en) * | 2016-06-28 | 2019-09-20 | 湖北锐世数字医学影像科技有限公司 | A kind of self checking method and system of file |
CN109298254A (en) * | 2017-07-24 | 2019-02-01 | 中华映管股份有限公司 | 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 |
CN112650992B (en) * | 2020-12-21 | 2024-12-06 | 江苏群杰物联科技有限公司 | A document tracking encryption method based on digital watermark |
-
2023
- 2023-03-09 CN CN202310219725.9A patent/CN115883839B/en active Active
Patent Citations (16)
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 |
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 |
CN107995384A (en) * | 2017-11-23 | 2018-05-04 | 晨星半导体股份有限公司 | Video tamper-proof method, video shooting device and video verification method |
WO2021007742A1 (en) * | 2019-07-15 | 2021-01-21 | 上海极清慧视科技有限公司 | Compression method for obtaining video file, decompression method, system, and storage medium |
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 |
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 |
Also Published As
Publication number | Publication date |
---|---|
CN115883839A (en) | 2023-03-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10986332B2 (en) | Prediction mode selection method, video encoding device, and storage medium | |
US20190349202A1 (en) | Protection method and protection system of system partition key data and terminal | |
CN111836310B (en) | UCI transmission method, terminal and network equipment | |
CN110933706A (en) | Network communication setting method, device, storage medium and terminal | |
CN110730017A (en) | Radio frequency device, control method thereof and terminal equipment | |
CN104915625B (en) | A method and device for face recognition | |
CN112612745A (en) | Data transmission method and device, electronic equipment and readable storage medium | |
CN110287655B (en) | Verification code input method and device and mobile terminal | |
CN112888024B (en) | Data processing method, data processing device, storage medium and electronic equipment | |
CN115883839B (en) | Image verification method, device, equipment and computer readable storage medium | |
CN111064847B (en) | False touch prevention method and device, storage medium and electronic equipment | |
CN109286414B (en) | Antenna determination method and terminal | |
CN109492451B (en) | Coded image identification method and mobile terminal | |
CN117632856A (en) | Data processing method, device, electronic equipment and storage medium | |
CN109003313B (en) | Method, device and system for transmitting webpage picture | |
CN112380520B (en) | Screen unlocking method and device, storage medium and mobile terminal | |
CN117412055A (en) | Image processing method, electronic device, and storage medium | |
CN110061813B (en) | A data encoding method and decoding method, and related device | |
CN109005377A (en) | A kind of method for processing video frequency and terminal device | |
CN111355991B (en) | Video playing method and device, storage medium and mobile terminal | |
CN110996003B (en) | Photographing positioning method and device and mobile terminal | |
KR20230029122A (en) | Electronic device for transmitting a plurality of image streams during performing video call and method for the same | |
CN107204882B (en) | Method and equipment for filtering data packet and mobile terminal | |
CN117202146B (en) | Display control method, device and medium for NFC passive display equipment | |
CN115829897B (en) | Image fusion processing method and device, electronic equipment and 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 |