CN113362254A - Image restoration method, device, equipment and storage medium - Google Patents
Image restoration method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN113362254A CN113362254A CN202110740218.0A CN202110740218A CN113362254A CN 113362254 A CN113362254 A CN 113362254A CN 202110740218 A CN202110740218 A CN 202110740218A CN 113362254 A CN113362254 A CN 113362254A
- Authority
- CN
- China
- Prior art keywords
- array
- picture
- frequency
- rgb value
- image restoration
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 47
- 230000005540 biological transmission Effects 0.000 claims abstract description 14
- 238000004590 computer program Methods 0.000 claims description 3
- 229910002056 binary alloy Inorganic materials 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 238000013144 data compression Methods 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/90—Determination of colour characteristics
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
Abstract
The invention discloses an image restoration method, an image restoration device, image restoration equipment and a storage medium, wherein the image restoration method comprises the following steps: obtaining RGB values of all pixel points of a picture to determine an array A, and counting the array A to obtain a high-frequency RGB value m; removing the high-frequency RGB value m in the array A to determine an array B; determining an array X by adopting a BitMap algorithm, wherein the position of the high-frequency RGB value m in the array X is marked; and restoring the picture according to the array B, the high-frequency RGB value m and the array X. The invention reduces the flow loss of the picture in the transmission and improves the picture opening efficiency by designing the method of transmitting the high-frequency pixels in the picture RGB array only once.
Description
Technical Field
The present invention relates to the field of image storage technologies, and in particular, to an image restoration method, an image restoration device, an image restoration apparatus, and a storage medium.
Background
When picture transmission is performed, the picture file is much larger than the structured data, so the transmission speed is relatively slow, and more flow is consumed in the transmission process, thereby increasing the pressure of bandwidth. However, in the prior art, in the process of transmitting the picture, the array recording RGB values of all the pixels on the original picture needs to be stored and transmitted, and in this process, especially for the picture with a large size, the amount of data to be transmitted is very large, which consumes a large amount of traffic and bandwidth, resulting in a slow picture opening speed and poor user experience.
Disclosure of Invention
The invention aims to provide an image restoration method to solve the problem of unstable picture transmission.
In order to achieve the above object, the present invention provides an image restoration method, including:
obtaining RGB values of all pixel points of a picture to determine an array A, and counting the array A to obtain a high-frequency RGB value m;
removing the high-frequency RGB value m in the array A to determine an array B;
determining an array X by adopting a BitMap algorithm, wherein the position of the high-frequency RGB value m in the array X is marked;
and restoring the picture according to the array B, the high-frequency RGB value m and the array X.
Preferably, the obtaining RGB values of all pixel points of the picture determines an array a, and counting the array a to obtain a high-frequency RGB value m includes:
and extracting RGB values of all pixel points of the picture by adopting a preset read method and storing the RGB values into the array A, wherein the high-frequency RGB values of all the pixel points of the picture are counted by accumulating counts during storage, and the high-frequency RGB value m is recorded.
Preferably, the determining an array X by using the BitMap algorithm, where the marking of the position in the array X where the high-frequency RGB value m is removed includes:
the length L of the array X is as follows:
l is 1+ array a length/32.
Preferably, the restoring the picture according to the array B, the high-frequency RGB value m, and the array X includes:
and transmitting the array B, the high-frequency RGB value m and the array X to an array A1 determined by a using end and restoring the picture by a preset write method by adopting a TCP (transmission control protocol) protocol or an http (hyper text transport protocol).
The present invention also provides an image restoration apparatus comprising:
the first acquisition module is used for acquiring RGB values of all pixel points of a picture to determine an array A, and counting the array A to acquire a high-frequency RGB value m;
the second acquisition module is used for removing the high-frequency RGB value m in the array A to determine an array B;
the third acquisition module is used for determining an array X by adopting a BitMap algorithm, wherein the array X is marked with a position for removing the high-frequency RGB value m;
and the restoring module is used for restoring the picture according to the array B, the high-frequency RGB value m and the array X.
Preferably, the first obtaining module is further configured to:
and extracting RGB values of all pixel points of the picture by adopting a preset read method and storing the RGB values into the array A, wherein the high-frequency RGB values of all the pixel points of the picture are counted by accumulating counts during storage, and the high-frequency RGB value m is recorded.
Preferably, the third obtaining module is further configured to:
the length L of the array X is as follows:
l is 1+ array a length/32.
Preferably, the reduction module is further configured to:
and transmitting the array B, the high-frequency RGB value m and the array X to an array A1 determined by a using end and restoring the picture by a preset write method by adopting a TCP (transmission control protocol) protocol or an http (hyper text transport protocol).
The invention also provides a computer terminal device comprising one or more processors and a memory. A memory coupled to the processor for storing one or more programs; when executed by the one or more processors, cause the one or more processors to implement the image restoration method as in any of the embodiments described above.
The present invention also provides a computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the image restoration method according to any of the embodiments described above.
The method comprises the steps of obtaining RGB values of all pixel points of a picture to determine an array A, counting the array A to obtain a high-frequency RGB value m, removing the high-frequency RGB value m in the array A to determine an array B, and determining an array X by adopting a BitMap algorithm, wherein the position of the array X where the high-frequency RGB value m is removed is marked, and the picture is restored according to the array B, the high-frequency RGB value m and the array X, so that the bandwidth occupation of the picture in network transmission is reduced, network resources are saved, and the transmission efficiency of the picture is improved.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of an image restoration method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an image restoration apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the present invention will be described clearly and completely with reference to the accompanying drawings, and it is obvious that the described embodiments are only some embodiments of the present invention, not all 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 step numbers used herein are for convenience of description only and are not used as limitations on the order in which the steps are performed.
It is to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
The terms "comprises" and "comprising" indicate the presence of the described features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The term "and/or" refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1, the present invention provides an image restoration method, including:
s101, obtaining RGB values of all pixel points of a picture, determining an array A, and counting the array A to obtain a high-frequency RGB value m.
Specifically, RGB values of all pixel points of the picture are extracted by a read method of ImageIo and stored in an array A, wherein the high-frequency RGB values of all the pixel points of the picture are counted by accumulating counts during storage, and the high-frequency RGB value m is recorded.
S102, removing the high-frequency RGB value m in the array A to determine an array B.
Specifically, the array a includes the high-frequency RGB value m, and on the basis of the array a, the high-frequency RGB value m in the array a is removed to obtain the data B.
S103, determining an array X by adopting a BitMap algorithm, wherein the position of the high-frequency RGB value m is marked in the array X.
Specifically, the BitMap algorithm marks a value corresponding to an element with a bit, and can perform fast search, duplication judgment and deletion of data, generally speaking, the data range is less than 10 times of int, and data are duplicated to achieve data compression.
Defining an array X, adopting a BitMap algorithm to declare an int array X with the length of [ 1+ array A length/32 ], marking the coordinate position of the removed RGB value m in the array X, wherein a binary 0, 1-bit method is adopted to mark whether the xth pixel uses the high-frequency RGB value m.
And S104, restoring the picture according to the array B, the high-frequency RGB value m and the array X.
And (3) transmitting the array B, the high-frequency RGB value m and the array X to an array A1 determined by a using end and a preset write method to restore the picture by adopting a TCP (transmission control protocol) protocol or an http (hyper text transport protocol) protocol, specifically, declaring an array A1 with the length of [ array X ], traversing the array X from the array coordinate 0 bit, converting the numerical value of the ith bit of the array into a binary system, traversing 8-bit binary numerical values, assuming that the traversal reaches the nth bit, if the value of i 8+ n is 1, indicating that the [ i 8+ n ] th bit of the array A1 needs to use the high-frequency RGB value m, if the value of i 8+ n is 0, indicating that the [ i 8+ n ] th bit of the array A1 needs to use the jth value of the array B, (j starts from 0, and is increased by 1 every time of taking the value of the array B), and transferring the picture into the array A1 through the write method of the agent Io.
According to the invention, the flow loss of the picture in the transmission process is reduced by a method of transmitting the high-frequency pixels in the picture RGB array only once, the bandwidth pressure is greatly reduced, the picture opening speed is improved, the picture or video frame can be loaded more quickly and the operation response to the user is more timely from the user perspective, and better experience can be provided for the user.
Referring to fig. 2, the present invention provides an image restoration apparatus, including:
the first obtaining module 11 is configured to obtain RGB values of all pixel points of a picture to determine an array a, and count the array a to obtain a high-frequency RGB value m.
Specifically, RGB values of all pixel points of the picture are extracted by a read method of ImageIo and stored in an array A, wherein the high-frequency RGB values of all the pixel points of the picture are counted by accumulating counts during storage, and the high-frequency RGB value m is recorded.
And the second obtaining module 12 is configured to remove the high-frequency RGB value m in the array a to determine an array B.
The first obtaining module 11 is connected to the second obtaining module 12, and transmits the array a generated by the first obtaining module 11 to the second obtaining module 12, where the array a includes the high-frequency RGB value m, and on the basis of the array a, removes the high-frequency RGB value m in the array a to obtain the data B.
And a third obtaining module 13, configured to determine an array X by using a BitMap algorithm, where a position of the array X where the high-frequency RGB value m is removed is marked.
The third module 13 is connected to the first obtaining module 11, and receives the array a transmitted by the first obtaining module 11.
The BitMap algorithm marks a value corresponding to an element by using a bit, can quickly search, judge and delete data, generally speaking, the data range is less than 10 times of int, and the data is removed to compress the data.
Defining an array X, adopting a BitMap algorithm to declare an int array X with the length of [ 1+ array A length/32 ], marking the coordinate position of the removed RGB value m in the array X, wherein a binary 0, 1-bit method is adopted to mark whether the xth pixel uses the high-frequency RGB value m.
And the restoring module 14 is configured to restore the picture according to the array B, the high-frequency RGB value m, and the array X.
The restoring module 14 is respectively connected to the first acquiring module 11, the second acquiring module 12, and the third module 13, and transmits the array B, the high-frequency RGB value m, and the array X to the array a1 determined by the user end and restores the picture by a preset write method using a TCP protocol or an http protocol, specifically, declares an array a1 having a length [ array X ] and traverses the array X from the array coordinate 0 bit, converts the value of the array ith bit into a binary system, traverses the binary value of 8 bits, and assumes that the nth bit is traversed, if the value of i x 8+ n is 1, then the [ i x 8+ n ] th bit representing array A1 requires the use of the high frequency RGB value m, if the value of i 8+ n is 0, then the j th bit (i 8+ n) indicating array A1 needs to use the j th value of array B, (j starts with 0 and increases by 1 every time a value is taken from array B), and the picture is restored by passing into array A1 by ImageIo's write method.
According to the invention, the flow loss of the picture in the transmission process is reduced by a method of transmitting the high-frequency pixels in the picture RGB array only once, the bandwidth pressure is greatly reduced, the picture opening speed is improved, the picture or video frame can be loaded more quickly and the operation response to the user is more timely from the user perspective, and better experience can be provided for the user.
The invention provides a computer terminal device comprising one or more processors and a memory. The memory is coupled to the processor for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the image restoration method as in any of the embodiments described above.
The processor is used for controlling the overall operation of the computer terminal equipment so as to complete all or part of the steps of the image restoration method. The memory is used to store various types of data to support the operation at the computer terminal device, which data may include, for example, instructions for any application or method operating on the computer terminal device, as well as application-related data. The Memory may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk.
In an exemplary embodiment, the computer terminal Device may be implemented by one or more Application Specific 1 integrated circuits (AS 1C), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components, for performing the image restoration method and achieving technical effects consistent with the method.
In another exemplary embodiment, there is also provided a computer readable storage medium comprising program instructions which, when executed by a processor, implement the steps of the image restoration method in any one of the above embodiments. For example, the computer readable storage medium may be the above-mentioned memory including program instructions executable by a processor of a computer terminal device to perform the above-mentioned image restoration method, and to achieve technical effects consistent with the above-mentioned method.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.
Claims (10)
1. An image restoration method, comprising:
obtaining RGB values of all pixel points of a picture to determine an array A, and counting the array A to obtain a high-frequency RGB value m;
removing the high-frequency RGB value m in the array A to determine an array B;
determining an array X by adopting a BitMap algorithm, wherein the position of the high-frequency RGB value m in the array X is marked;
and restoring the picture according to the array B, the high-frequency RGB value m and the array X.
2. The image restoration method according to claim 1, wherein the obtaining of the RGB values of all the pixels of the picture determines an array a, and the counting of the array a to obtain the high-frequency RGB value m includes:
and extracting RGB values of all pixel points of the picture by adopting a preset read method and storing the RGB values into the array A, wherein the high-frequency RGB values of all the pixel points of the picture are counted by accumulating counts during storage, and the high-frequency RGB value m is recorded.
3. The image restoration method according to claim 2, wherein the determining an array X by using the BitMap algorithm, wherein marking the position of the array X from which the high-frequency RGB values m are removed comprises:
the length L of the array X is as follows:
l is 1+ array a length/32.
4. The image restoration method according to claim 3, wherein the restoring the picture according to the array B, the high-frequency RGB values m and the array X comprises:
and transmitting the array B, the high-frequency RGB value m and the array X to an array A1 determined by a using end and restoring the picture by a preset write method by adopting a TCP (transmission control protocol) protocol or an http (hyper text transport protocol).
5. An image restoration apparatus, comprising:
the first acquisition module is used for acquiring RGB values of all pixel points of a picture to determine an array A, and counting the array A to acquire a high-frequency RGB value m;
the second acquisition module is used for removing the high-frequency RGB value m in the array A to determine an array B;
the third acquisition module is used for determining an array X by adopting a BitMap algorithm, wherein the array X is marked with a position for removing the high-frequency RGB value m;
and the restoring module is used for restoring the picture according to the array B, the high-frequency RGB value m and the array X.
6. The image restoration device according to claim 5, wherein the first obtaining module is further configured to:
and extracting RGB values of all pixel points of the picture by adopting a preset read method and storing the RGB values into the array A, wherein the high-frequency RGB values of all the pixel points of the picture are counted by accumulating counts during storage, and the high-frequency RGB value m is recorded.
7. The image restoration device according to claim 6, wherein the third obtaining module is further configured to:
the length L of the array X is as follows:
l is 1+ array a length/32.
8. The image restoration device according to claim 7, wherein the restoration module is further configured to:
and transmitting the array B, the high-frequency RGB value m and the array X to an array A1 determined by a using end and restoring the picture by a preset write method by adopting a TCP (transmission control protocol) protocol or an http (hyper text transport protocol).
9. A computer terminal device, comprising:
one or more processors;
a memory coupled to the processor for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the image restoration method of any of claims 1 to 4.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the image restoration method according to any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110740218.0A CN113362254B (en) | 2021-06-30 | 2021-06-30 | Image restoration method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110740218.0A CN113362254B (en) | 2021-06-30 | 2021-06-30 | Image restoration method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113362254A true CN113362254A (en) | 2021-09-07 |
CN113362254B CN113362254B (en) | 2023-01-20 |
Family
ID=77537601
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110740218.0A Active CN113362254B (en) | 2021-06-30 | 2021-06-30 | Image restoration method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113362254B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070206852A1 (en) * | 2006-03-03 | 2007-09-06 | General Atomics | Color condensation for image transformation and/or compression |
JP2008193263A (en) * | 2007-02-01 | 2008-08-21 | Sharp Corp | Image processing method, image processing device, image processing program, and record medium |
CN101272442A (en) * | 2007-03-21 | 2008-09-24 | 杭州波导软件有限公司 | Digital image nondestructive compression method and device, resolution method and image encoder |
CN101546434A (en) * | 2008-03-28 | 2009-09-30 | 深圳市同洲电子股份有限公司 | Method and system for compressing and decompressing BMP picture file |
CN105678710A (en) * | 2016-01-14 | 2016-06-15 | 佛山华芯微特科技有限公司 | Color correction and restoration system and color correction and restoration method |
CN108900843A (en) * | 2018-07-31 | 2018-11-27 | 京东方科技集团股份有限公司 | Monochrome image compression method, device, medium and electronic equipment |
CN112118449A (en) * | 2019-06-21 | 2020-12-22 | 腾讯科技(深圳)有限公司 | Method and device for compressing and decompressing image |
-
2021
- 2021-06-30 CN CN202110740218.0A patent/CN113362254B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070206852A1 (en) * | 2006-03-03 | 2007-09-06 | General Atomics | Color condensation for image transformation and/or compression |
JP2008193263A (en) * | 2007-02-01 | 2008-08-21 | Sharp Corp | Image processing method, image processing device, image processing program, and record medium |
CN101272442A (en) * | 2007-03-21 | 2008-09-24 | 杭州波导软件有限公司 | Digital image nondestructive compression method and device, resolution method and image encoder |
CN101546434A (en) * | 2008-03-28 | 2009-09-30 | 深圳市同洲电子股份有限公司 | Method and system for compressing and decompressing BMP picture file |
CN105678710A (en) * | 2016-01-14 | 2016-06-15 | 佛山华芯微特科技有限公司 | Color correction and restoration system and color correction and restoration method |
CN108900843A (en) * | 2018-07-31 | 2018-11-27 | 京东方科技集团股份有限公司 | Monochrome image compression method, device, medium and electronic equipment |
CN112118449A (en) * | 2019-06-21 | 2020-12-22 | 腾讯科技(深圳)有限公司 | Method and device for compressing and decompressing image |
Non-Patent Citations (1)
Title |
---|
王平: "图像文件压缩算法浅析", 《消费导刊》 * |
Also Published As
Publication number | Publication date |
---|---|
CN113362254B (en) | 2023-01-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108063818B (en) | Data downloading method, device, terminal and computer readable storage medium | |
CN111625503B (en) | Method and equipment for locally and randomly pre-reading file of distributed file system | |
CN107992271B (en) | Data pre-reading method, device, equipment and computer readable storage medium | |
CN113873255B (en) | Video data transmission method, video data decoding method and related devices | |
CN114422807B (en) | Transmission optimization method based on Spice protocol | |
US20070192384A1 (en) | Computer implemented method for automatically managing stored checkpoint data | |
CN113362254B (en) | Image restoration method, device, equipment and storage medium | |
CN108491315A (en) | The page is resident statistical method, device and the computer readable storage medium of duration | |
CN105868057B (en) | A kind of method, apparatus and mobile terminal of data processing | |
CN110941597B (en) | Method and device for cleaning decompressed file, computing equipment and computer storage medium | |
CN100518359C (en) | System and method for processing the signaling message report | |
CN109981487B (en) | Data scheduling method and device, electronic equipment and readable storage medium | |
CN111833232B (en) | Image processing apparatus | |
CN114567787B (en) | Video compression method, system and related device applied to BMC | |
CN115437572A (en) | Data dropping method, device, equipment and medium | |
CN111711860B (en) | Video recommendation filtering method, device, server and storage medium | |
CN113126929A (en) | Method, system, medium and terminal for removing duplicate of feature data | |
CN111654886A (en) | Method and device for limiting user bandwidth | |
CN112055058A (en) | Data storage method and device and computer readable storage medium | |
CN113824962B (en) | Method, system, equipment and storage medium for transmitting cursor information | |
CN114283474A (en) | Snapshot optimization method and device based on target characteristics, computer equipment and medium | |
CN116016694A (en) | Data uploading method, data decompressing method, vehicle and cloud server | |
CN107247562B (en) | Compression optimization method and device | |
EP1143702A3 (en) | Apparatus and method for image feature amount acquisition | |
CN106649354B (en) | Webpage crawling request processing method and device |
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 |