CN112929669A - Image encoding and decoding method and device - Google Patents

Image encoding and decoding method and device Download PDF

Info

Publication number
CN112929669A
CN112929669A CN202110083276.0A CN202110083276A CN112929669A CN 112929669 A CN112929669 A CN 112929669A CN 202110083276 A CN202110083276 A CN 202110083276A CN 112929669 A CN112929669 A CN 112929669A
Authority
CN
China
Prior art keywords
component
color
pixel point
escape
index information
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
CN202110083276.0A
Other languages
Chinese (zh)
Other versions
CN112929669B (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.)
Chongqing Jingxiang Microelectronics Co ltd
Original Assignee
Xian Wanxiang Electronics 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 Xian Wanxiang Electronics Technology Co Ltd filed Critical Xian Wanxiang Electronics Technology Co Ltd
Priority to CN202110083276.0A priority Critical patent/CN112929669B/en
Publication of CN112929669A publication Critical patent/CN112929669A/en
Application granted granted Critical
Publication of CN112929669B publication Critical patent/CN112929669B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/182Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a pixel
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation

Abstract

The invention discloses an image coding and decoding method and device. Wherein, the method comprises the following steps: acquiring a target image to be processed; for each pixel point in the target image, acquiring a statistical histogram of each component of each pixel point, and respectively determining a basic color and an escape color in the statistical histogram, wherein the component is a constituent unit of the pixel point; according to the basic color and the escape color, distributing a sequence number to each component to obtain index information of each component; and coding the index information of each component, the basic color and the escape color of each component to obtain the coded data of the target image. The invention solves the technical problems of low compression efficiency and overlarge code stream caused by disturbing the correlation between adjacent pixels of the image by adopting a pixel random scrambling method in the prior art.

Description

Image encoding and decoding method and device
Technical Field
The present invention relates to the field of image transmission, and in particular, to an image encoding and decoding method and apparatus.
Background
The existing encryption algorithm for images generally adopts a pixel random scrambling method to scramble the original image arrangement sequence. Although the method can change the image into a pile of discrete and irregular pixels well to make the image information invisible, the method also breaks up the correlation between adjacent pixels of the image, thereby greatly reducing the compression efficiency, increasing the code stream and making the code stream unusable in the common transmission condition.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides an image coding and decoding method and device, which at least solve the technical problems of low compression efficiency and overlarge code stream caused by scrambling the correlation between adjacent pixels of an image by adopting a pixel random scrambling method in the prior art.
According to an aspect of an embodiment of the present invention, there is provided an image encoding method including: acquiring a target image to be processed; for each pixel point in the target image, acquiring a statistical histogram of each component of each pixel point, and respectively determining a basic color and an escape color in the statistical histogram, wherein the components are constituent units of the pixel points; according to the basic color and the escape color, distributing a sequence number to each component to obtain index information of each component; and coding the index information of each component, the basic color and the escape color of each component to obtain the coded data of the target image.
Optionally, obtaining a statistical histogram of the target image in each component includes: and dividing the value of the target image in each component into a plurality of sub-value intervals respectively to generate a statistical histogram corresponding to each component. Respectively determining a fundamental color and an escape color in the statistical histogram of each component, comprising: determining the frequency of each sub-value interval appearing in the target image according to the statistical histogram; counting the occurrence times of the sub-value intervals in each component of the target image, and sequencing the occurrence times of the sub-value intervals in each component from large to small; and taking the sub-value intervals with the preset number ranked at the top as basic colors, and taking the rest sub-value intervals as escape colors, wherein each component of the target image corresponds to one group of basic colors and escape colors.
Optionally, according to the basic color and the escape color, assigning a sequence number to each component of each pixel point in the target image to obtain index information of each component, including: numbering the basic colors and the escape colors of each component, wherein for each component, each basic color corresponds to a sequence number, and all the escape colors correspond to a sequence number; sequentially comparing the value of each component of the pixel with the respective basic color of each component, and numbering the values of the pixel points on the components if the value of each component of the pixel is within the range of the value interval of any basic color corresponding to the component, wherein the serial number obtained by numbering the pixel points is the same as the serial number of the basic color of the pixel; if the value of each component of the pixel point is not in the range of the value interval of any basic color corresponding to the component, the number of the pixel point is set to be the same as the serial number of the escape color, and the number of the pixel point is used as index information; the serial number of the pixel point on each component is the index information of the pixel point on the component.
Optionally, encoding the index information of each component, the base color and the escape color of each component, includes: quantizing the basic color and the escape color of each component to obtain a quantized basic color and a quantized escape color of each component; carrying out inverse quantization on the quantization basic color and the quantization escape color of each component; comparing the quantized basic color after the inverse quantization of each component with the basic color corresponding to the component to obtain a first comparison result; comparing the quantized escape color of each component after inverse quantization with the escape color corresponding to the component to obtain a second comparison result; determining a residual image of each component according to the first comparison result and the second comparison result, wherein the residual image of each component is used for displaying the deviation of each component when the basic color and the escape color of each component are quantized and then decoded; and encrypting the index information of each component, the basic color and the escape color of each component, and the residual image of each component.
Optionally, the index information of each component, the basic color and the escape color of each component are encrypted by: the index information of each component, the primary color and the escape color of each component are encrypted using a first scrambling encryption algorithm.
Optionally, encrypting the index information of each component, the base color and the escape color of each component using a first scrambling encryption algorithm, comprising: classifying the index information of each component respectively to obtain a prediction index map corresponding to each component and index information corresponding to a third marker symbol; setting a first key for the quantization basic color and the quantization escape color of each component, and respectively setting a second key and a third key for the index information corresponding to the prediction index graph and the third marker symbol; the prediction index map is any pixel point in the target image, and a summary table of coordinate information of any pixel point and a corresponding mark symbol is obtained after the mark symbol replaces the serial number on each component according to a preset rule, wherein each component of the target image is provided with one corresponding prediction index map; and encrypting the quantized basic color and the quantized escape color, the predicted index graph and the index information corresponding to the third marker symbol by using a first mapping scrambling algorithm according to the first key, the second key and the third key.
Optionally, replacing the sequence number with a mark symbol according to a preset rule on each component, including: comparing the serial number of any pixel point on each component with the serial number of the pixel point at a first relative position according to the index information of each component, wherein the first relative position is the adjacent left side or right side of any pixel point, and if the serial number of any pixel point is the same as the serial number of the pixel point at the first relative position, setting a first mark symbol for any pixel point; if the serial number of any pixel point is different from the serial number of the pixel point at the first relative position, comparing the serial number of any pixel point with the serial number of the pixel point at a second relative position, wherein the second relative position is above or below the second relative position which is adjacent to any pixel point; if the serial number of any pixel point is the same as that of the pixel point at the second position, a second mark symbol is set for any pixel point; and setting a third marker symbol for any pixel point which is not set as the first marker symbol or the second marker symbol.
Optionally, for a pixel point set as a third marker, coordinate information and a corresponding sequence number of the pixel point need to be extracted and recorded to obtain index information corresponding to the third marker, and each component corresponds to index information corresponding to one third marker.
According to another aspect of the embodiments of the present invention, there is also provided a decoding method, including: decoding the coded data of the target image to obtain index information, basic color and escape color of each component; determining the value of each pixel point in the target image on each component according to the index information, the basic color and the escape color of each component; and obtaining a target image according to the value of each pixel point on each component.
According to an aspect of the embodiments of the present invention, there is provided an image encoding apparatus, which is adapted to the above encoding method, including: the acquisition module is used for acquiring a target image to be processed; the conversion module is used for acquiring a statistical histogram of each component for each pixel point in the target image, and respectively determining a basic color and an escape color in the statistical histogram of each component; a first determining module, configured to determine a base color and an escape color in the statistical histogram of each component; the second determining module is used for distributing a sequence number to the value on each component of each pixel point in the target image according to the basic color and the escape color of each component to obtain index information corresponding to each component; and the third determining module is used for coding the index information, the basic color and the escape color of each component to obtain coded data of the target image.
Optionally, the second determining module is further configured to obtain a quantization basic color and a quantization escape color of each component, and calculate a residual map of each component.
Optionally, the third determining module is further configured to obtain index information corresponding to the prediction index map and the third marker.
According to another aspect of the embodiments of the present invention, there is also provided an image decoding apparatus, which is adapted to the above decoding method, including: the decoding module is used for decoding the coded data of the target image to obtain the respective index information, basic color and escape color of each component; the determining module is used for determining the value of each pixel in the target image on each component according to the respective index information, the basic color and the escape color of each component; and the conversion module is used for obtaining a target image according to the value of each pixel point on each component.
According to another aspect of the embodiments of the present invention, there is also provided a non-volatile storage medium including a stored program, wherein the apparatus in which the non-volatile storage medium is controlled to execute the above-mentioned image encoding and decoding method when the program is executed.
In the embodiment of the invention, the target image to be processed is acquired; acquiring a statistical histogram of the target image in each component, and respectively determining a basic color and an escape color in the statistical histogram of each component; according to the basic color and the escape color, distributing a sequence number to each pixel point in the target image on each component to obtain respective index information of each component; the method for coding the index information of each component, the basic color and the escape color of each component to obtain the coded data of the target image achieves the purpose of fully utilizing the related information between the pixels of the image by a character coding method, thereby realizing the technical effect of encrypting the image without increasing additional code stream, and further solving the technical problems of low compression efficiency and overlarge code stream caused by the fact that the correlation between adjacent pixels of the image is disturbed by adopting a pixel random scrambling method in the prior art.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart illustrating an image encoding method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a decoding method according to an embodiment of the present invention;
FIG. 3 is a schematic illustration of a statistical histogram according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of an image encoding apparatus according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an image decoding apparatus according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating the results of a scramble encryption according to an embodiment of the present invention;
fig. 7 is a radar map according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, 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 noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In accordance with an embodiment of the present invention, there is provided an image encoding method embodiment, it is noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions and that, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different than here.
Fig. 1 is an image encoding method according to an embodiment of the present invention, as shown in fig. 1, the method including the steps of:
step S102, acquiring a target image to be processed;
step S104, for each pixel point in the target image, acquiring a statistical histogram of each component of each pixel point, and respectively determining a basic color and an escape color in the statistical histogram;
in some embodiments of the present application, a statistical histogram of a target image in each component is obtained, and a basic color and an escape color in the statistical histogram of each component are respectively determined, first, the value of the target image in each component needs to be respectively divided into a plurality of sub-value intervals, and a statistical histogram corresponding to each component one to one is generated; secondly, determining the frequency of each sub-value interval appearing in the target image according to the statistical histogram corresponding to each component one by one; then counting the occurrence times of the sub-value intervals in each component of the target image, and sequencing the occurrence times of the sub-value intervals in each component from large to small; and finally, taking the sub-value intervals with the preset number which are ranked in the front as the basic colors, and taking the rest sub-value intervals as the escape colors, wherein each component of the target image corresponds to a group of basic colors and escape colors.
The encoding mode of the target image may be a common encoding mode such as YUV format or RGB format. When the encoding mode of the image is YUV format, each component of each pixel point in the target image refers to a Y component, a U component, a V component or a color component (R component, G component and B component) of each pixel point in the RGB format image. The encoding method of the target image is not limited to YUV and RGB, and may be an image in another encoding format.
In order to reduce the workload in locating the fundamental color and the escape color, for some pictures with more high-frequency information and more single colors, as shown in the radar situation chart of fig. 7, the ground color and the data graph part of the radar situation chart may be set to different colors, for example, the ground color is set to black, and the rest is green, the image may be first subjected to a reduction processing, for example, a 256-level radar situation chart may be converted into a 32-level radar situation chart, and a specific conversion method is as follows:
Figure BDA0002909887290000051
in the formula, Img (x, y) represents the numerical value of any pixel point in the original radar situation map on three components, and x and y are the horizontal and vertical coordinates of the pixel point and are used for determining the position of the pixel point in the radar situation map. newImg (x, y) represents the value of any pixel in the radar situation map after the reduction in order in three components. Level is 2nIs a positive integer of (1). floor is a floor rounding function.
It should be noted that the pictures with more high-frequency information mean that the frequency of one or more pictures in the pictures is significantly higher than the frequency of other colors.
After the reduced-order radar situation map is obtained, in order to determine the basic color and the escape color on each component of the reduced-order radar situation map, histogram statistics needs to be performed on the value of each component of the reduced-order radar situation map, and the statistical interval deta may be 2,4,8, and the like, which may be expressed as 2nN is a positive integer of a natural number, and may be, for example, deta ═ 2. Namely, the value range [0,31 ] of the reduced-order image pixel is taken]Dividing into 32/deta sub-intervals, and dividing into 16 pixel intervals when deta is 2. Determining the occurrence frequency of each sub-value interval in the target image; then counting the occurrence times of sub-value intervals in the three components of the target image, and sequencing the occurrence times of the sub-value intervals in the three components from large to small; and finally, taking the sub-value intervals with the preset number which are sorted in the front as the basic color, and taking the rest sub-value intervals as the escape color, as shown in fig. 3. The abscissa in fig. 3 is a value of each pixel point of the target image on each component, and the ordinate is the number of occurrences. Wherein, each component of the radar situation map corresponds to a group of basic colors and escape colors respectively.
In some embodiments of the present application, after the basic color and the escape color are determined according to the radar situation map after the rank reduction, the basic color and the escape color of the original radar situation map may also be determined according to the basic color and the escape color of the radar situation map after the rank reduction, and the specific method is to perform the rank-up processing on the basic color and the escape color of the radar situation map after the rank reduction. For example, if a basic color in the reduced-order radar situation map is [2,3], the corresponding basic color in the original radar situation map is [16,31 ]. It should be noted that the ascending procedure performed here is an inverse procedure of descending, and the specific implementation procedure is as follows: and dividing the original radar situation map into 32/deta sub-value intervals, so that a corresponding relation can be established between the sub-value intervals of the original radar situation map and the sub-value intervals of the reduced radar situation map, for example, the sub-value intervals [0,1] of the reduced radar situation map correspond to the sub-value intervals [0,15] of the original radar situation map, and the sub-value intervals [2,3] of the reduced radar situation map correspond to the sub-value intervals [16,31] of the original radar situation map.
Step S106, distributing a serial number for each component of each pixel point in the target image according to the basic color and the escape color to obtain index information of each component;
in some embodiments of the present application, to obtain the respective index information of each component, first numbering the primary color and the escape color of each component, where for each component, each primary color corresponds to a sequence number, and all the escape colors correspond to a sequence number; then, sequentially comparing the value of each component of the pixel point with the respective basic color of each component, and if the value of each component of the pixel point is within the range of the value interval of any basic color corresponding to the component, numbering the value of the pixel point on the component, wherein the serial number obtained by numbering the pixel point is the same as the serial number of the basic color of the pixel point; and if the value of each component of the pixel is not in the range of the value interval of any basic color corresponding to the component, setting the serial number of the pixel to be the same as the serial number of the escape color, and taking the serial number of the pixel as the index information. And the serial number of the pixel point on each component is the index information of the pixel point on the component.
When numbering the primary colors and the escape colors, it should be noted that, for each component, the number corresponding to each primary color is different from the numbers corresponding to other primary colors and the escape colors, and similarly, the number corresponding to the escape color is also different from the number corresponding to any one primary color.
It is understood that the above-mentioned serial numbers of the basic color and the escape color can be any number, letter, Chinese character, special symbol, etc. which can be represented by binary.
In one embodiment of the present application, in order to compress the code stream as much as possible, when the primary color and the escape color are numbered, the numbers of the primary color and the escape color are set to 0,1, and 2 … … 7, respectively, and 8, respectively. This also facilitates the picture receiver to determine the number of the primary colors.
It should be noted that, since each component corresponds to a set of the basic color and the escape color, the above process of setting the sequence numbers for the basic color and the escape color should be performed once for each component. Moreover, although the number corresponding to each basic color is different from the numbers corresponding to other basic colors and escape colors and the number corresponding to an escape color is also different from the number corresponding to any one basic color for each component, the numbers of the basic colors corresponding to different components may be the same for different components, as well as the numbers of the escape colors. For example, in one embodiment of the present application, the primary color numbers are set to 0,1, 2 … … 7 and the escape color numbers are set to 8 for the three components Y, U, and V of the radar map. It can be understood that when the serial numbers are set for the basic colors and the escape colors on the three components, the serial numbers of the basic colors corresponding to each component are different, and the serial numbers of the escape colors are also different. For example, the basic color numbers of the Y component may be set to 0,1, 2 … … 7, the escape color number may be set to 8, the basic color numbers of the U component may be set to 9, 10, 11 … … 15, the escape color number may be set to 16, the basic color numbers of the V component may be set to 17, 18, 19 … … 23, and the escape color number may be set to 24. Of course, when the numbers are set for the primary color and the escape color, the numbers are not necessarily consecutive and are not necessarily the same character, and for example, some numbers may be set as a number, and others may be set as a letter, or the like.
After numbering the basic color and the escape color, the value of the pixel point in the target image on each component needs to be indexed and numbered according to the serial numbers of the basic color and the escape color, and the following coding logic is as follows:
sequentially comparing the value of a pixel on the Y component in the image with sub-value intervals corresponding to a plurality of basic colors of the Y component, and if the value on the Y component is in the sub-value intervals, setting the color index value at the position as the serial number of the corresponding basic color;
if the value on the Y component is not in the sub-value interval corresponding to any basic color any more, but the boundary distance of the sub-value interval corresponding to a certain basic color is less than or equal to 2, setting the color index value at the position as the corresponding basic color serial number;
if a plurality of sub-value intervals corresponding to the qualified basic colors exist at the same time, selecting the basic color sequence number corresponding to the sub-value interval with the minimum boundary distance;
if the boundary distance of the sub-value intervals corresponding to a plurality of basic colors is equal to the value on the Y component, selecting the serial number of one basic color from the basic colors, and setting the color index value at the serial number;
if the condition is not met, the color index value is set as the serial number of the escape color;
and respectively executing the steps on the values of the pixels on the U component and the V component in the image to obtain index information corresponding to the three components.
The index information may be understood as a correspondence between coordinates of any one pixel point in the image and a sequence number on each component, for example, a sequence number on a Y component corresponding to a pixel with coordinates (0, 0) is 1, a sequence number on a U component is 2, a sequence number on a V component is 3, and the like.
And step S108, encoding the index information of each component, the basic color and the escape color of each component to obtain the encoded data of the target image.
In some embodiments of the present application, the index information of each component, the primary color and the escape color of each component may be encrypted using a first scrambling encryption algorithm.
In some embodiments of the present application, in order to further compress the code stream, after obtaining the index information of each component in the original image according to the upgraded base color and the escape color, the base color and the escape color of the reduced-order image need to be quantized. And encrypting the basic color and the escape color of the quantized reduced-order image corresponding to each component by using a first scrambling encryption algorithm. The basic color and the escape color of the quantized reduced-order image are each element in a sub-value interval corresponding to the basic color and the escape color of the reduced-order image, divided by a preset quantization factor, and rounded to obtain a new sub-value interval, which is as follows:
quanBaseColor[i]=floor(BaseColor[i]/2)i∈[0,7]
quanEscapeColor[t]=floor(EscapeColor[t]/2)t∈[0,∞]
in the formula, baseColo [ i ] is the basic color of the reduced-order image, quanBaseColor [ i ] is the basic color of the quantized reduced-order image, and i is the serial number of the basic color. Similarly, escapeColor [ t ] is the escape color of the reduced order image, quanEscapColor [ t ] is the escape color of the quantized reduced order image, and t represents any escape color.
For example, the quantization factor may be set to 2, the sub-value interval corresponding to the basic color of the reduced-order image is [2,3], and the sub-value interval corresponding to the basic color of the quantized reduced-order image is [1,2 ].
It should be noted that, since the basic color and the escape color of the quantized reduced-order image are transmitted in the past, when the receiving end wants to obtain the original image from the received code stream, it is necessary to perform inverse quantization on the basic color and the escape color of the quantized reduced-order image. In order to obtain an accurate image, it is necessary to determine a deviation generated in a quantization process in advance, and therefore, after obtaining a sub-value interval corresponding to a basic color and an escape color of a quantized reduced-order image, inverse quantization processing is performed on the sub-value interval, and then the basic color and the escape color of the inversely quantized reduced-order image are compared with the basic color and the escape color of the reduced-order image to obtain a residual image, that is, the deviation is as follows:
residualBaseMap[i]=quanBaseColor[i]*2-BaseColor[i]i∈[0,7]
residualEscapeMap[t]=guanEscapeColor[t]*2-EscapeColor[t]i∈[0,∞]
in the formula, residulalBaseMap [ i ] is the deviation generated by quantizing and then performing inverse quantization on the basis color of the reduced-order radar situation map, baseColo [ i ] is the basis color of the reduced-order image, quanBaseColor [ i ] is the basis color of the quantized reduced-order image, and i is the serial number of the basis color. Similarly, residual Escapemap [ i ] is the deviation generated by the inverse quantization after the escape color of the reduced-order radar situation map is quantized, EscapColor [ i ] is the escape color of the reduced-order image, quancapeColor [ i ] is the escape color of the quantized reduced-order image, and t represents any escape color.
For example, the sub-value interval corresponding to the basic color of the reduced image is [2,3], the sub-value interval corresponding to the basic color of the quantized reduced image is [1,2], the sub-value interval corresponding to the basic color of the inversely quantized reduced image is [2,4], and the deviation can be represented as [0, -1 ]. The residual map also needs to be encrypted using the first scrambling encryption algorithm.
In some embodiments of the present application, before encrypting the index information of each component, the basic color and the escape color, a prediction index map of the target image needs to be obtained first. Firstly, comparing the serial number of any pixel point on each component with the serial number of a pixel point at a first position according to the index information of each component, wherein the first position is the adjacent left side or right side of the any pixel point; if the serial number of the any pixel point is the same as that of the pixel point at the first position, setting a first mark symbol for the any pixel point; if the serial number of the any pixel point is different from the serial number of the pixel point at the first position, comparing the serial number of the any pixel point with the serial number of the pixel point at the second position, wherein the second position is immediately above or below the any pixel point; if the serial number of the any pixel point is the same as that of the pixel point at the second position, setting a second mark symbol for the any pixel point; for any pixel point, if the pixel point is set as a first mark symbol, replacing the original serial number with the first mark symbol, and if the pixel point is set as a second mark symbol, replacing the original serial number with the second mark symbol to obtain a prediction index map; if the serial number of the any pixel point is different from the serial number of the pixel point at the second position, setting a third mark symbol for the any pixel point; for the arbitrary pixel point, if no pixel point exists at the first position and the second position of the arbitrary pixel point, or a pixel point with the first position relation or the second position relation exists, and the serial number of the arbitrary pixel point is different from that of the pixel point, setting a third marker symbol for the arbitrary pixel point; and determining the position information and the serial number of the pixel point corresponding to the third marker symbol, and generating index information corresponding to the third marker symbol.
It should be noted that, the prediction index map is also a prediction index map corresponding to each component, and the step of generating the prediction index map needs to be performed once for each component.
The purpose of the prediction index map is to further eliminate the spatial redundancy of the index map by utilizing the spatial correlation existing between the index information of the original image.
In some embodiments of the present application, the first symbol, the second symbol, and the third symbol may be any characters, for example, the first symbol may be L, the second symbol may be U, and the third symbol may be O. The following formula:
Figure BDA0002909887290000101
for the case that the prediction index value is O, the color index corresponding to O needs to be recorded as O _ symbol. Where (i, j) is the coordinate of any pixel, Gs (i, j) represents the prediction index map, and cim (i, j) is the serial number of the pixel at coordinate (i, j).
In some embodiments of the present application, in order to increase the security of the transmission code stream, the first relative position and the second relative position may also be relative positions determined according to other preset rules, and are not necessarily adjacent to each other right and left or up and down. For example, the first relative position may be a pixel point immediately above and to the left of any pixel point; the second relative position may be a position relationship such that, for any pixel, the right is separated by one pixel.
After obtaining the prediction index map and the index information corresponding to the third marker symbol, it is further required to set a first key for the quantization elementary color and the quantization escape color, set a second key and a third key for the prediction index map and the index information corresponding to the third marker symbol, and then encrypt the quantization elementary color and the quantization escape color by using a first mapping scrambling algorithm according to the first key, the second key and the third key, the prediction index map and the index information corresponding to the third marker symbol.
In the process of encoding and compressing the radar situation image, if the image is successfully decoded and recovered, data to be encoded comprises quanBaseColor, quanEscapColor, residalBaseMap, residalEscapMap, Group _ symbol and O _ symbol.
It should be noted that each component corresponds to a set of quantization elementary color and quantization escape color, and the index information corresponding to the prediction index map and the third flag symbol, that is, the above-mentioned obtained index information corresponding to the prediction index map and the third flag symbol, and a set of keys are set for the quantization elementary color and the quantization escape color, the prediction index map and the index information corresponding to the third flag symbol, and then according to the keys, the quantization elementary color and the quantization escape color are encrypted by using the first mapping scrambling algorithm, and the process of encrypting the index information corresponding to the prediction index map and the third flag symbol is performed once for each component, so that the finally obtained image information to be transmitted also corresponds to each component.
In some embodiments of the present application, the first scrambling encryption algorithm may be a Logistic chaotic mapping scrambling algorithm, that is, scrambling the data to be encoded by using the Logistic chaotic mapping scrambling algorithm, where the scrambling process is as follows:
the one-dimensional Logistic mapping is a simpler chaotic mapping in terms of mathematical form, the system has extremely complex dynamic behavior and is widely applied in the field of secure communication, and the mathematical expression is as follows:
Xk+1=μXk(1-Xk)k∈(1,+∞)
wherein mu is more than or equal to 0 and less than or equal to 4 is a branch parameter, when mu is more than 3.569945 … … and less than or equal to 4, Logistic mapping works in a chaotic state, namely the value X is in a non-periodic and non-convergence unpredictable state, and at the moment, the mapping system is used for an initial value X0Also called keys, are very sensitive.
The scheme includes three groups of keys, namely [ mu ]0,X′0]、[μ1,X″0]、[μ2,X″′0]Respectively, for encrypting quanBaseColor and quancecapecolor, Group _ symbol, and O _ symbol. Wherein, mu is used for ensuring that Logistic mapping is in the most chaotic state0、μ1、μ2The value range is [3.57, 4]]An interval.
By inputting the encryption key [ mu, X ]0]Obtaining a chaos coefficient (X) with a length of L through Logistic mapping0,X1,X2,……,XL) Wherein the length L is also the length of the data to be encrypted. The chaotic coefficient X is sequenced from low to high or from high to low through a sequencing algorithm, and the numerical value of the chaotic coefficient X is in a disordered state, so that the sequencing sequence of the chaotic coefficient X is also in a disordered state. And finally, placing the input data corresponding to the original chaotic coefficient according to the rearranged chaotic coefficient position to obtain the encrypted and scrambled data. As shown in FIG. 6, X is set accordingly0After μ, calculate XnAnd re-pairing X according to the magnitude relationshipnThe original sequence relation can be disturbed by arranging the values of (A) to (B) so as to play a role of encryption.
After the processing, the purposes of data statistics of coding preprocessing and scrambling encryption are achieved, and then Huffman entropy coding is carried out on the scrambled data such as the data quanBaseCoolor, quanEscapeColor, resendalBaseMap, resendalEscapeMap, Group _ symbol and O _ symbol.
And finally, transmitting the obtained Huffman coded code stream as a final code stream of the scrambled and encrypted radar situation map.
Fig. 2 is an image decoding method according to an embodiment of the present invention, as shown in fig. 2, the method including the steps of:
step S202, decoding the coded data of the target image to obtain the index information, basic color and escape color of each component;
in some embodiments of the present application, when decrypting a transmitted image, the transmitted codestream is first decoded by Huffman, and then decrypted by the agreed three sets of encryption keys [ mu ]0,X′0]、[μ1,X″0]、[μ2,X″′0]And performing Logistic inverse processing and decryption on the decoded image data to obtain a prediction index map, index information corresponding to the third marker symbol, the basic color of the quantized reduced-order radar situation map, the escape color of the quantized reduced-order radar situation map and a residual map.
And then, obtaining the basic color and the escape color of the reduced-order radar situation map according to the quantized basic color of the reduced-order radar situation map, the quantized escape color of the reduced-order radar situation map and the residual map, and then performing upscaling on the basic color and the escape color of the reduced-order radar situation map to obtain an original image, namely the basic color and the escape color of the target image. And obtaining the index information of the target image according to the index information corresponding to the prediction index map and the third marker symbol.
Step S204, determining the value of each pixel point in the target image on each component according to the index information, the basic color and the escape color of each component;
it should be noted that, according to the respective index information, the basic color and the escape color of each component, it is determined whether each pixel point in the target image belongs to the basic color or the escape color on each component, that is, the value range of each pixel point on each component is determined. After the value interval is obtained, the value of each pixel point on each component needs to be determined by using a first value-taking algorithm.
For the radar situation map shown in fig. 7 in which the background color is black and the rest is green, the first value-taking algorithm may be to take the median or average of each value in the interval. Because the radar situation map is an image with simple colors, the image obtained by decoding by the method does not lose too much information.
Step S206, obtaining a target image according to the value of each pixel point on each component.
Fig. 4 is a schematic structural diagram of an image encoding apparatus according to an embodiment of the present invention, the image encoding apparatus being configured to implement the image encoding method described in fig. 1. As shown in fig. 4, the image encoding apparatus includes:
an obtaining module 40, configured to obtain a target image to be processed; a conversion module 42 for converting the target image into a statistical histogram for each component; a first determining module 44, configured to determine a primary color and an escape color in the statistical histogram of each component; a second determining module 46, configured to assign a sequence number to each component of each pixel point in the target image according to the basic color and the escape color of each component, so as to obtain index information corresponding to each component; and a third determining module 48, configured to encode the index information, the basic color, and the escape color of each component to obtain encoded data of the target image.
The preferred implementation of the embodiment shown in fig. 4 can be referred to the description related to the embodiment shown in fig. 1, and is not repeated herein.
Fig. 5 is a schematic structural diagram of an image decoding apparatus according to an embodiment of the present invention, the image decoding apparatus being configured to implement the image decoding method described in fig. 2. As shown in fig. 5, the image decoding apparatus includes:
a decoding module 50, configured to decode the encoded data of the target image to obtain respective index information, a basic color and an escape color, of each component; a determining module 52, configured to determine, according to the respective index information, the basic color and the escape color of each component, a value of each pixel in the target image on each component; and the conversion module 54 obtains the target image according to the value of each pixel point on each component.
The preferred implementation of the embodiment shown in fig. 5 can be referred to the description related to the embodiment shown in fig. 2, and the description thereof is omitted here.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (13)

1. An image encoding method characterized by comprising, in a frame,
acquiring a target image to be processed;
for each pixel point in the target image, acquiring a statistical histogram of each component of each pixel point, and respectively determining a basic color and an escape color in the statistical histogram, wherein the component is a constituent unit of the pixel point;
according to the basic color and the escape color, distributing a sequence number to each component to obtain index information of each component;
and coding the index information of each component, the basic color and the escape color of each component to obtain the coded data of the target image.
2. The method of claim 1,
acquiring a statistical histogram of each component of the target image, wherein the statistical histogram comprises the following steps: dividing the value of the target image in each component into a plurality of sub-value intervals respectively to generate a statistical histogram corresponding to each component;
respectively determining a fundamental color and an escape color in the statistical histogram of each component, including: determining the frequency of each sub-value interval appearing in the target image according to the statistical histogram; counting the occurrence times of sub-value intervals in each component of the target image, and sequencing the occurrence times of the sub-value intervals in each component from large to small; and taking the sub-value intervals with the preset number ranked at the top as the basic colors, and taking the rest sub-value intervals as the escape colors, wherein each component of the target image corresponds to a group of basic colors and escape colors.
3. The method of claim 1, wherein assigning a sequence number to each component of each pixel point in the target image according to the primary color and the escape color to obtain index information of each component, comprises:
numbering the basic colors and the escape colors of each component, wherein for each component, each basic color corresponds to a sequence number, and all the escape colors correspond to a sequence number;
comparing the value of each component of the pixel point with the respective basic color of each component in sequence, and numbering the value of the pixel point on each component if the value of each component of the pixel point is within the range of the value interval of any basic color corresponding to each component, wherein the serial number obtained by numbering the value of the pixel point on each component is the same as the serial number of the basic color of the pixel point;
and if the value of each component of the pixel point does not fall into the range of the value interval of any basic color corresponding to each component, setting the serial number of each classification in the pixel point to be the same as the serial number of the escape color, and taking the serial number of each component in the pixel point as the index information.
4. The method of claim 1, wherein encoding the index information of each component, the base color and the escape color of each component comprises:
quantizing the basic color and the escape color of each component to obtain the quantized basic color and the quantized escape color of each component;
inverse quantizing the quantization basic color and the quantization escape color of each component;
comparing the quantized basic color of each component after inverse quantization with the basic color corresponding to each component to obtain a first comparison result; comparing the quantized escape color of each component after inverse quantization with the escape color corresponding to each component to obtain a second comparison result;
determining a residual map of each component according to the first comparison result and the second comparison result, wherein the residual map of each component is used for displaying the deviation of each component when the residual map of each component is decoded after quantization of the basic color and the escape color;
encrypting the index information of each component, the basic color of each component, the escape color of each component and the residual map of each component.
5. The method according to claim 4, wherein the index information of each component, the basic color and the escape color of each component are encrypted by:
and encrypting the index information of each component and the basic color and the escape color of each component by using a scrambling encryption algorithm.
6. The method of claim 5, wherein encrypting the index information of each component and the base color and escape color of each component using a scrambling encryption algorithm comprises:
classifying the index information of each component respectively to obtain a prediction index map corresponding to each component and index information corresponding to a third marker symbol;
setting a first key for the quantization basic color and the quantization escape color of each component, and setting a second key and a third key for the index information corresponding to the third marker symbol of the prediction index map; the prediction index map is a summary table of coordinate information of any pixel point and a corresponding mark symbol obtained after replacing a serial number with the mark symbol on each component according to a preset rule, wherein each component of the target image is provided with one corresponding prediction index map;
and encrypting the quantized basic color and the quantized escape color, the predicted index map and index information corresponding to the third marker symbol by using a mapping scrambling algorithm according to the first key, the second key and the third key.
7. The method according to claim 6, wherein replacing the sequence numbers with the mark symbols on each component according to a preset rule respectively comprises:
comparing the serial number of any pixel point on each component with the serial number of the pixel point at a first relative position according to the index information of each component, wherein the first relative position is the adjacent left side or right side of the any pixel point, and if the serial number of the any pixel point is the same as the serial number of the pixel point at the first relative position, setting a first mark symbol for the any pixel point;
if the serial number of the any pixel point is different from the serial number of the pixel point at the first relative position, comparing the serial number of the any pixel point with the serial number of the pixel point at a second relative position, wherein the second relative position is immediately above or below the any pixel point; if the serial number of the any pixel point is the same as that of the pixel point at the second relative position, setting a second mark symbol for the any pixel point;
and setting a third marker symbol for any pixel point which is not set as the first marker symbol or the second marker symbol.
8. The method of claim 7, further comprising: and for the pixel point set as a third mark symbol, extracting and recording the coordinate information and the corresponding serial number of the pixel point to obtain the index information corresponding to the third mark symbol, wherein each component corresponds to the index information corresponding to one third mark symbol.
9. A method of decoding, comprising:
decoding the coded data of the target image to obtain index information, basic color and escape color of each component;
determining the value of each pixel point in the target image on each component according to the index information, the basic color and the escape color of each component;
and obtaining the target image according to the value of each pixel point on each component.
10. An image encoding device characterized by comprising:
the acquisition module is used for acquiring a target image to be processed;
the conversion module is used for acquiring a statistical histogram of each component for each pixel point in the target image, and respectively determining a basic color and an escape color in the statistical histogram of each component;
a first determining module, configured to determine a base color and an escape color in the statistical histogram of each component;
a second determining module, configured to assign a sequence number to a value on each component of each pixel point in the target image according to the basic color and the escape color of each component, so as to obtain index information corresponding to each component;
and a third determining module, configured to encode the index information, the basic color, and the escape color of each component to obtain encoded data of the target image.
11. The apparatus of claim 10,
the second determining module is further configured to obtain a quantization basic color and the quantization escape color of each component, and calculate a residual map of each component;
the third determining module is further configured to obtain index information corresponding to the prediction index map and the third marker.
12. An image decoding apparatus, comprising:
the decoding module is used for decoding the coded data of the target image to obtain the respective index information, basic color and escape color of each component;
the determining module is used for determining the value of each pixel in the target image on each component according to the respective index information, basic color and escape color of each component;
and the conversion module is used for obtaining the target image according to the value of each pixel point on each component.
13. A non-volatile storage medium, comprising a stored program, wherein when the program runs, a device in which the non-volatile storage medium is located is controlled to execute the image encoding and decoding method according to any one of claims 1 to 9.
CN202110083276.0A 2021-01-21 2021-01-21 Image encoding and decoding method and device Active CN112929669B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110083276.0A CN112929669B (en) 2021-01-21 2021-01-21 Image encoding and decoding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110083276.0A CN112929669B (en) 2021-01-21 2021-01-21 Image encoding and decoding method and device

Publications (2)

Publication Number Publication Date
CN112929669A true CN112929669A (en) 2021-06-08
CN112929669B CN112929669B (en) 2022-12-06

Family

ID=76164163

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110083276.0A Active CN112929669B (en) 2021-01-21 2021-01-21 Image encoding and decoding method and device

Country Status (1)

Country Link
CN (1) CN112929669B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090003692A1 (en) * 2005-08-19 2009-01-01 Martin Pettersson Texture Compression Based on Two Hues with Modified Brightness
US20120070047A1 (en) * 2010-09-20 2012-03-22 Johnson Alfred J Apparatus, method and computer readable storage medium employing a spectrally colored, highly enhanced imaging technique for assisting in the early detection of cancerous tissues and the like
CN105335989A (en) * 2014-06-11 2016-02-17 富士通株式会社 Image coding method and image coding apparatus
CN105491384A (en) * 2014-10-06 2016-04-13 财团法人工业技术研究院 Palette encoding method, palette decoding method, and electronic device
CN106851280A (en) * 2017-01-04 2017-06-13 苏睿 The method and apparatus of compression of images
CN107509079A (en) * 2017-08-16 2017-12-22 西安万像电子科技有限公司 Word block coding method and device
CN110401833A (en) * 2019-06-04 2019-11-01 西安万像电子科技有限公司 Image transfer method and device
CN111447452A (en) * 2020-03-30 2020-07-24 西安万像电子科技有限公司 Data coding method and system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090003692A1 (en) * 2005-08-19 2009-01-01 Martin Pettersson Texture Compression Based on Two Hues with Modified Brightness
US20120070047A1 (en) * 2010-09-20 2012-03-22 Johnson Alfred J Apparatus, method and computer readable storage medium employing a spectrally colored, highly enhanced imaging technique for assisting in the early detection of cancerous tissues and the like
CN105335989A (en) * 2014-06-11 2016-02-17 富士通株式会社 Image coding method and image coding apparatus
CN105491384A (en) * 2014-10-06 2016-04-13 财团法人工业技术研究院 Palette encoding method, palette decoding method, and electronic device
CN106851280A (en) * 2017-01-04 2017-06-13 苏睿 The method and apparatus of compression of images
CN107509079A (en) * 2017-08-16 2017-12-22 西安万像电子科技有限公司 Word block coding method and device
CN110401833A (en) * 2019-06-04 2019-11-01 西安万像电子科技有限公司 Image transfer method and device
WO2020244324A1 (en) * 2019-06-04 2020-12-10 西安万像电子科技有限公司 Image transmission method and device
CN111447452A (en) * 2020-03-30 2020-07-24 西安万像电子科技有限公司 Data coding method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
宋传鸣: "调色板编码中双向预测的索引值优化分配", 《模式识别与人工智能》 *

Also Published As

Publication number Publication date
CN112929669B (en) 2022-12-06

Similar Documents

Publication Publication Date Title
Cao et al. High capacity reversible data hiding in encrypted images by patch-level sparse representation
Saha et al. Steganographic techniques of data hiding using digital images
Swain et al. Classification of image steganography techniques in spatial domain: a study
CN107578452B (en) JPEG image encryption method with compatible format and invariable size
CN111401320B (en) Privacy-protecting biometric image processing method, device, medium, and apparatus
CN111050022B (en) High-security image transmission system and method
Sarmah et al. JPEG based steganography methods using cohort intelligence with cognitive computing and modified multi random start local search optimization algorithms
CN106791882B (en) image coding and encrypting method and device
CN108881913B (en) Method and apparatus for image encoding
Ernawan et al. A blind multiple watermarks based on human visual characteristics
Chang et al. A steganographic method for hiding secret data using side match vector quantization
Kalita et al. A comparative study of steganography algorithms of spatial and transform domain
EP0833518B1 (en) Compression of image data with associated cost data
Lee et al. Information hiding based on block match coding for vector quantization-compressed images
Dhaka et al. A novel algorithm for image steganography based on effective channel selection technique
CN112929669B (en) Image encoding and decoding method and device
Al-Shatnawi et al. An integrated image steganography system with improved image quality
Chutani et al. LSB embedding in spatial domain-a review of improved techniques
CN111325807A (en) Encryption and feature extraction method based on JPEG image
Kekre et al. Image Reconstruction using Fast Inverse Half tone and Huffman Coding Technique
Shah et al. A review of contemporary image compression techniques and standards
CN115695988A (en) Intelligent equipment true random key generation method, device, terminal and medium
Chadha et al. Image steganography using Karhunen-Loève transform and least bit substitution
CN109145610B (en) Picture hiding method and device, picture restoring method and device and terminal equipment
Gupta et al. Lossless compression based Kmp technique

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20221107

Address after: 401122 No. 99, datagu Middle Road, Xiantao street, Yubei District, Chongqing

Applicant after: Chongqing Jingxiang Microelectronics Co.,Ltd.

Address before: Room 302, 3rd floor, No.4 factory building, 3G intelligent terminal Industrial Park, No.8, Tangyan South Road, high tech Zone, Xi'an City, Shaanxi Province, 710075

Applicant before: XI'AN VANXVM ELECTRONICS TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant