Pyramid algorithm for video compression and video analysis
11259051 · 2022-02-22
Assignee
Inventors
Cpc classification
H04N19/59
ELECTRICITY
International classification
Abstract
A method of representing image data comprising a spatial pyramid data structure of order L, said method comprising: providing an initial representation of said image data, said representation comprising a set of lattices of level 0; connecting each said lattices of level 0 to said image data; performing L reduction steps each comprising: for each one of at least one current lattice of the current level, optionally blurring said current lattice; providing a plurality of down sampled sub-lattices of said current optionally blurred lattice, said at least one current lattice being the parent lattice of said respective plurality of down sampled sub-lattices; and connecting said plurality of down sampled sub-lattices to said respective parent lattice, wherein said plurality of down sampled sub-lattices of the current level, comprise the set of current lattices for the next level.
Claims
1. A method of representing image data comprising a spatial pyramid data structure of order L, the method comprising: providing an initial representation of the image data, the initial representation comprising an initial set of current lattices of a current level, each one of said set of current lattices comprising an interpolated image of said image data and having the same resolution as that of said image data; connecting each of the current lattices to the image data; performing L reduction steps, each comprising: a. optionally blurring at least one current lattice of the current level b. providing a plurality of down sampled sub-lattices of the optionally blurred at least one current lattice, the at least one current lattice being the parent lattice of the respective plurality of down sampled sub-lattices; and c. connecting the plurality of down sampled sub-lattices to the respective parent lattice, wherein the plurality of down sampled sub-lattices of the current level, comprise the set of current lattices for the next level.
2. The method of claim 1, wherein the initial set of lattices comprises fractional shifts of the image data.
3. The method of claim 1, wherein the initial set of lattices comprises only one lattice.
4. The method of claim 1, wherein the providing down sampled sub-lattices comprises performing down sampling using the Quincunx down sampling method.
5. The method of claim 1, wherein the at least one current lattice comprises all current lattices of the current level.
6. A method of performing video compression of an input original video yielding an output compressed Bit Stream, comprising: (i) providing a set of N reconstructed frames of said original video, and creating a “spatial pyramid” data structure of order L for each frame of said reconstructed frames, using the steps of: providing an initial representation of the frame data, the initial representation comprising an initial set of current lattices of a current level; connecting each of the current lattices to said frame data; performing L reduction steps, each comprising: a. optionally blurring at least one current lattice of the current level; b. providing a plurality of down sampled sub lattices of the optionally blurred at least one current lattice, the at least one current lattice being the parent lattice of the respective plurality of down sampled sub-lattices; and c. connecting the plurality of down sampled sub-lattices to the respective parent lattice, wherein the plurality of down sampled sub-lattices of the current level, comprises the set of current lattices for the next level; (ii) providing a new original frame of said original video and creating a “simple pyramid” data structure of order L for said new original frame, comprising: setting said new frame as the current original lattice of the current level; performing L reduction steps each comprising: a. optionally blurring the current original lattice of the current level; b. providing a down sampled sub-lattice of the current optionally blurred original lattice; the current original lattice being the parent lattice of the respective down sampled sub-lattice; and c. connecting the down sampled sub-lattice to the respective parent original lattice, wherein the down sampled sub-lattice of the current level, comprises the current original lattice for the next level; iii. reconstructing the lowest level lattice of said “simple pyramid”, comprising: a. predicting said lowest level lattice using said lowest level sets of lattices of said N “spatial pyramids”; b. compressing the difference between said respective original lattice and said predicted lattice of said lowest level “simple pyramid”; and initializing the Bit Stream with said compressed difference; c. decompressing said compressed difference; and d. adding said decompressed difference to said predicted lattice, yielding the reconstructed lowest level lattice of said “simple pyramid”; iv. performing L raise steps, each comprising: a. computing the optical flows between the reconstructed lattice of the current level and each of the lattices of the respective level in said N “spatial pyramids”; b. up scaling the optical flows of the current level to predicted optical flows for the next higher level, wherein said predicted optical flows for the next higher level comprise predicted optical flows between the original lattice of the next higher level of the “simple pyramid” and each of the lattices of the respective next higher level of said N “spatial pyramids”; c. predicting the parent lattice of said current lattice using said up scaled optical flows and said lattice of the current level; and setting said next higher level to be the current level; d. compressing the difference between the respective original lattice and said predicted lattice of the current level of said “simple pyramid”; and inserting said compressed difference to the Bit Stream; and e. decompressing said compressed difference and adding said difference to the predicted lattice, yielding the reconstructed lattice of the current level of said “simple pyramid”.
7. The method of claim 6 where the predicting the decompressed lattice of the next higher level comprises one of spatial and temporal prediction.
8. A method of performing video decompression of a compressed original video, given an input Bit Stream, yielding an output reconstructed video, of said original video, comprising: i. providing a set of N reconstructed frames of said original video and creating a “spatial pyramid” data structure of order L for each frame of said N reconstructed frames, using the steps of: providing an initial representation of the frame data, the initial representation comprising an initial set of current lattices of a current level; connecting each of the current lattices to said frame data; performing L reduction steps, each comprising: a. optionally blurring at least one current lattice of the current level; b. providing a plurality of down sampled sub-lattices of the optionally blurred at least one current lattice, the at least one current lattice being the parent lattice of the respective plurality of down sampled sub-lattices; and c. connecting the plurality of down sampled sub-lattices to the respective parent lattice; wherein the plurality of down sampled sub-lattices of the current level comprise the set of current lattices for the next level; (ii) providing a new compressed frame of said original video in said input Bit Stream, said compressed frame representing a compressed “simple pyramid” data structure of order L, comprising the compressed differences between the original lattice and the predicted lattice of each level, starting from the lowest level L, to the topmost level 0, iii. reconstructing the lowest level lattice of said “simple pyramid”, comprising: a. predicting said lowest level lattice using said lowest level sets of lattices of said N “spatial pyramids”; b. extracting said compressed lowest level difference between the original lattice and said predicted lattice of the lowest level of said “simple pyramid” from the Bit Stream; c. decompressing said compressed lowest level difference; and d. adding said decompressed difference to said predicted lattice, yielding the reconstructed lowest level lattice of said “simple pyramid”; iv. performing L raise steps each comprising: a. computing the optical flows between the reconstructed lattice of the current level and each of the lattices of the respective level in said N “spatial pyramids”; b. up scaling the optical flows of the current level to predicted optical flows for the next higher level, wherein said predicted optical flows for the next higher level comprise predicted optical flows between the original lattice of the next higher level of the “simple pyramid” and each of the lattices of the respective next higher level of said N “spatial pyramids”; c. predicting the parent lattice of said current lattice using said up scaled optical flows and said lattice of the current level; and setting said next higher level to be the current level; d. extracting the compressed difference between the original lattice and said predicted lattice of the current level of said “simple pyramid” from the Bit Stream; and e. decompressing said compressed difference and adding said difference to the predicted lattice, yielding the reconstructed lattice of the current level of said “simple pyramid”.
9. The method of claim 8 where the predicting the parent lattice comprises one of spatial and temporal prediction.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1) For better understanding of the invention and to show how the same may be carried into effect, reference will now be made, purely by way of example, to the accompanying drawings.
(2) With specific reference now to the drawings in detail, it is stressed that the particulars shown are by way of example and for purposes of illustrative discussion of the preferred embodiments of the present invention only, and are presented in the cause of providing what is believed to be the most useful and readily understood description of the principles and conceptual aspects of the invention. In this regard, no attempt is made to show structural details of the invention in more detail than is necessary for a fundamental understanding of the invention, the description taken with the drawings making apparent to those skilled in the art how the several forms of the invention may be embodied in practice. In the accompanying drawings:
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
(11)
(12)
(13)
(14)
(15)
DETAILED DESCRIPTION OF EMBODIMENTS
(16) In the present invention we present a new pyramid data structure and algorithms for video compression and video analysis.
The Spatial Pyramid of Sub-Lattices
(17) A Spatial Pyramid is created using the current frame lattice and its related sub-lattices.
(18) Initialization
(19) We begin by creating additional frames of the same resolution as the original frame using interpolation. For example, we may interpolate the original frame by half pixel along the x (columns) direction, or by half pixel along the y (rows) direction or by half pixel along both the x and y directions. In
(20) In general, let
(21)
denotes the q-fractional interpolation method used to create the additional frames, and let Z denotes the original frame. Then we begin with a set of p.sup.2 shifted frames of the same resolution as the original frame, which we denote as:
Z.sub.i,j,0≤i,j<p.
(22) Here the i-index above represents the q-fractional interpolation of the original frame along the y-direction, and the j-index above represents similarly the q-fractional interpolation of the original frame along the x-direction. Hence, for example, frame Z.sub.0,0 corresponds to the original frame Z, frame Z.sub.1,0 corresponds to the frame resulting from
(23)
fractional interpolation of the original frame Z along the y-direction, etc. We now define the Spatial Pyramid for this set of p.sup.2 shifted frames as defined above. Let L≥0 be some integer defining the order of the Spatial Pyramid. Then we begin by denoting the 0-level of the pyramid by the set of lattices
Z.sub.i,j.sup.0,0≡Z.sub.i,j,0≤i,j<p,
(24) where the first top index represents the level number, and the second top index represents a global numbering for that lattice. We then connect each such lattice to the original frame, see for example
(25) Now, assume we are using some down sampling method, such as Quincunx down sampling, Dyadic down sampling etc. Then, let N denote the number of sub-lattices for that method. For example, for the Quincunx down sampling method N=2, and for the Dyadic down sampling method N=4.
(26) We now proceed to define the creation of the Spatial Pyramid of order L.
(27) Step k=0, . . . , L−1
(28) We first optionally blur each frame lattice of level k to get the blurred frame lattices:
(29)
(30) Next, given said above down sampling method, with N possible sub-lattices, we create all the possible sub-lattices for each of these optionally blurred frame lattices, namely:
(31)
(32) Finally, we denote all these down-sampled sub-lattices as:
(33)
(34) and call them the respective frame lattices of level (k+1).
(35) The Pyramid Relations
(36) We construct the Pyramid by connecting the frame lattices of each level, namely
(37)
(38) to their respective frame lattices of the next level, namely:
(39)
(40) In this context we define {tilde over (Z)}.sub.i,j.sup.k,n.sup.
(41)
(42) An example of a complete Spatial Pyramid and its pyramid relations for L=2, N=2 and q=½ is depicted in
EXAMPLE
The Quincunx Spatial Pyramid
(43) In this section we give a more concrete example of the Quincunx Spatial Pyramid.
(44) Initialization
(45) We begin by creating additional frames of the same resolution as the original frame using interpolation as was done in the previous section. Here, we let q=2.sup.−p denote the fractional interpolation method used to create the additional frames, so that the total number of initial frames is now 4.sup.p, namely:
Z.sub.i,j,0≤i,j<2.sup.p.
(46) Here the index above represents again the q-fractional interpolation of the original frame along the y-direction, and the j-index above represents similarly the q-fractional interpolation of the original frame along the x-direction. Hence, for example, frame Z.sub.0,0 corresponds to the original frame Z, frame Z.sub.1,0 corresponds to the frame resulting from q=2.sup.−p fractional interpolation of the original frame Z along the y-direction, etc. We now use the Quincunx down sampling method to create the Quincunx Spatial Pyramid of order L using the following notations for level 0:
Z.sub.i,j.sup.0≡Z.sub.i,j,0≤i,j<2.sup.p,
(47) In what follows we assume the distances between the pixels of the original frame, along the x and the y directions, are the same, and are equal to 1. We now distinguish between Even and Odd steps as follows.
(48) Even Step k=0, 2, 4, . . .
(49) Let the frame lattices of level k be denoted by
(50)
(51) Here, we can assume by induction that the pixel distances along the x and the y directions are (√{square root over (2)}).sup.k=2.sup.m. Note also that the ith and jth indices of each such lattice correspond to the respective fractional shift of the top left pixel of that lattice with respect to the top left pixel of the original lattice.
(52) Then, as in the previous section, we first optionally blur each such frame lattice to get the optionally blurred frame lattices:
(53)
(54) Then, we create for each of these optionally blurred lattices, the Quincunx-Even sub-lattice and the Quincunx-Odd sub-lattice which we denote as:
(55)
(56) Or more simply as:
(57)
(58) Note that the ith and jth indices of each of these un-rotated Quincunx sub-lattices, as depicted in diagram 210 and diagram 410 respectively, correspond again to the fractional-shift of the top left pixels with respect to the top left pixel of the original frame. Furthermore, the pixel distances along the x and the y directions of these rotated Quincunx sub-lattices, as depicted in diagram 220 and diagram 420 respectively, are now √{square root over (2)}.sup.(k+1)=√{square root over (2)}*2.sup.m. In this context we define similarly {tilde over (Z)}.sub.i,j.sup.k to be the parent of these corresponding sub-lattices, and we denote this as:
(59)
(60) Step k=1, 3, 5, . . .
(61) Let the frame lattices of level k be denoted as above, i.e.
(62)
(63) Then, as observed above, the pixel distances along the x and the y directions of these rotated Quincunx sub-lattices, as depicted in diagram 220 and diagram 420 respectively, are now √{square root over (2)}.sup.k=√{square root over (2)}*2.sup.m. Similarly, the ith and jth indices of each of these un-rotated Quincunx sub-lattices, as depicted in diagram 210 and diagram 410 respectively, correspond to the fractional-shift of the top left pixels with respect to the top left pixel of the original frame.
(64) Then, as in the previous section, we first optionally blur each such frame lattice to get the optionally blurred frame lattices:
(65)
(66) Then, we create for each of these optionally blurred lattices, the Quincunx-Even sub-lattice and the Quincunx-Odd sub-lattice which we denote as:
(67)
(68) Or more simply as
(69)
(70) Note that by now, these sub-lattices become regular rectangular lattices. The ith and jth indices of each of these lattices correspond again to the fractional-shift of the top left pixels with respect to the top left pixel of the original frame. Furthermore, the pixel distances along the x and the y directions are now √{square root over (2)}.sup.(k+1)=2.sup.m+1. In this context we define similarly {tilde over (Z)}.sub.i,j.sup.k to be the parent of these corresponding sub-lattices, and we denote this as:
(71)
(72) To summarize, we can denote the frame lattices of each level as follows:
(73) Step k=0, 1, . . . , 1
(74)
(75) An example of a complete Quincunx Spatial Pyramid and its pyramid relations for L=2 and q=½ is depicted in
An Application to Video Compression
(76) In this section we describe the usage of the Spatial Pyramid in the context of video compression as discussed in the No Latency algorithm presented in Pat [1]. The Spatial Pyramid can also be used in the context of many other video compression algorithms such as the ones presented in Pat [2], and Pat [3], as well as with standard video compression algorithms such as MPEG, see Ref[1].
(77) Introduction
(78) We consider here the problem of encoding and decoding a sequence of video frames, in the order of their appearance. In particular, we do not consider here the problem of encoding and decoding the first frame in the sequence, but only any of the following frames in the sequence. We call the frame to be encoded and decoded the current frame, and assume that all the previously processed frames are known in their decoded form to both Encoder and Decoder. We now describe the process of encoding and decoding the current frame using the previously decoded frames. For simplicity, we use here only the last previously decoded frame, although more of the previously decoded frames can be used. Furthermore, for the purpose of presentation, we use here the Quincunx Spatial Pyramid and the Quincunx down sampling method.
(79) Initialization
(80) Let Y be the current frame to be encoded and decoded, let Z be the last previously decoded frame, and let L denotes the order of the Quincunx Spatial Pyramid to be used. Then we begin by creating a simple pyramid decomposition for Y≡Y.sup.0 as follows: Iteratively perform the following step for k=0, 1, . . . , L−1:
(81) Optionally blur the frame lattice Y.sup.k and denote the optionally blurred lattice by {tilde over (Y)}.sup.k. Then either Quincunx-Even down sample or Quincunx-Odd down sample this optionally blurred lattice and denote the resulting down sampled frame lattice as Y.sup.k+1. We finally denote this whole resulting simple pyramid decomposition of Y by:
Y.sup.k,{tilde over (Y)}.sup.k 0≤k<L,Y.sup.L.
(82) We now create a corresponding Quincunx Spatial Pyramid of order L for the last previously decoded frame Z, as discussed in the previous section, in both the Encoder and the Decoder. To recap, given an initial parameter p≥0, we create the respective 4.sup.p interpolated frames:
Z.sub.i,j.sup.0,0≤i,j<2.sup.p.
(83) Then, we create the corresponding optionally blurred lattices:
(84)
(85) where each such lattice of level k is optionally blurred in the same way as {tilde over (Y)}.sup.k was blurred. Finally we down sample each of these lattices, creating both the Quincunx-Even and Quincunx-Odd sub-lattices, which we then denote as:
(86)
(87) The Algorithm
(88) We encode and decode the current frame Y using the simple pyramid decomposition of Y and the respective Quincunx Spatial Pyramid of the last previously decoded frame Z as discussed above. Denoting by Ŷ the resulting decoded current frame, we will obtain in the process a corresponding simple pyramid decomposition for Ŷ, i.e.
Ŷ.sup.k,{tilde over (Ŷ)}.sup.k 0≤k<L,Ŷ.sup.L.
(89) More precisely, we process the pyramids bottom up, in (L+1) steps, starting from the lowest level L of the pyramid up to the top most level 0 of the pyramid. On each such step we compress/decompress the respective pyramid lattice of Y of that level, yielding the respective pyramid lattice of the decoded frame it of that level. Therefore, by the end of the algorithm we obtain the required decoded frame it as proclaimed.
(90) Step L: We Compress/Decompress Y.sup.L. 1) In the Encoder, we compress Y.sup.L either directly using some known compression method such as Jpeg or Jpeg2000, or we compress Y.sup.L indirectly as follows: We inspect the lowest level lattices of the respective Z Quincunx Spatial Pyramid:
(91)
(92) Step k=L−1, . . . , 0: We may now assume by induction, that we have already processed all the Y pyramid lattices of level m>k, namely:
i Y.sup.L,Y.sup.m,{tilde over (Y)}.sup.m m=L−1,. . . ,k+1.
(93) and obtained the respective pyramid lattices of Ŷ, namely:
Ŷ.sup.L,Ŷ.sup.m,{tilde over (Ŷ)}.sup.m m=L−1,. . . ,k+1.
(94) We now show how to proceed and obtain Ŷ.sup.k and {tilde over (Ŷ)}.sup.k from that respect pyramid of lattices of Ŷ and Y.sup.k and {tilde over (Y)}.sup.k. Hence, by the end of the algorithm we obtain the decoded frame Ŷ≡Ŷ.sup.0 as required. 1) In both the Encoder and Decoder, we first compute the optical flows, see Ref[2], between the lattice Ŷ.sup.k+1 and each of the respective lattices of level (k+1) of the Z Quincunx Spatial Pyramid:
(95)
(96)
D.sup.k={tilde over (Y)}.sup.k−
(97) The Compressed Bit Stream
(98) The compressed bit stream consists of the aggregate compressed bit streams for: Ŷ.sup.L as computed in 1) of Step L above; and for {circumflex over (D)}.sup.k, k=L−1, . . . , 0, as computed in 7) of Step k above.
REFERENCE
(99) Ref[1] https://en.wikipedia.org/wiki/Moving_Picture_Experts_Group.
(100) Ref[2] https://en.wikipedia.org/wiki/Optical_flow.
(101) Ref[3] https://en.wikipedia.org/wiki/Embedded_Zerotrees_of_Wavelet_transforms.
Patents
(102) Pat [1] Ilan Bar-On and Oleg Kostenko, Multi-Level Spatial-Temporal Resolution Increase of Video, App. No. PCT/182014/062524 Pat [2] Ilan Bar-On and Oleg Kostenko, Video Compression Method, App. No. PCT/182013/059007 Pat [3] Ilan Bar-On and Oleg Kostenko, A New Universal Video Codec, App. No. PCT/IB2015/054735.