• No results found

Progressive coding of contours

4.4 Progressive coding of GSO sequences

4.4.1 Progressive coding of contours

Z0(x,y) m(τ +1)`

'

,where m(τ +1)` is the number of pixels in the region Ω(τ +1)` . On the other hand, at each step τ from n − 1 to 0, P-GSO is generating each image Zτusing the known image Zτ +1and auxiliary information (encoded with the lowest possible codelength) to obtain Zτ. Hence,P-GSOis encoding n(τ )∆Γ contour segments, ∆Γ(τ ), that are added to the contours of Zτ +1, in order to obtain the contours of Zτ. In the reconstruction stage, the depth values d(τ )i and d(τ )j are reconstructed using d(τ +1)` . Although at the beginning of the process only a few regions (in the order of tens) are split in Zn, at the end of the process P-GSO typically gets to split several thousand regions.

4.4.1 Progressive coding of contours

At each iteration τ, the contour segments from ∆Γ(τ ) are added to the already encoded contours Γ(τ +1),of the last known image Zτ +1(see Figure 4.2), to obtain the contours of the next image in the sequence, Zτ, i.e. Γ(τ ) = ∆Γ(τ )∪Γ(τ +1). The contour segments ∆Γ(τ ) are encoded using a vertex representation, i.e. Γk is represented by an anchor point, P1, a direction point, P2, and a chain-code vector Sk (see Section 3.2.1). The same anchor point classification as in [P5] is used also in [P6]: double, relative, and edge. However,P-GSOhas a progressive functionality, and, at step τ, the contour Γ(τ +1) is used as a priori information by anchor points search procedures, which are different than the ones in [P5].

As we described in Section 3.2.1, the first step, in the coding of the contour using the vertex representation, is to find the anchor points. The relative anchor points are found by traversing the contour segments Γ(τ +1),and by marking, in a binary vector Ψ(τ ),the vertices that have more adjacent vertices in Γ(τ ) than in Γ(τ +1). The found vertices may have a minimum of two adjacent vertices part of the contour Γ(τ +1), and a maximum of two adjacent vertices part of the contour Γ(τ ),which are possible direction points. Next we analyse the possible cases that appear for a found vertex, say Pk. (i) If four adjacent vertices are part of Γ(τ +1), then Pk can not be an anchor point, since there is no other possibility to start a

200 400 600 800 1000 1200 100

200 300 400

500 600 700 800 900

1000 1100

Figure 4.2: Contour coding of Zτ at step τ. Contour map of last known image, Zτ +1,is represented by contour edges marked with red. Contour segments ∆Γ(τ ), encoded at step τ, are represented by contour edges marked with blue. Double anchor points are marked with black; relative anchor points are marked with green.

contour segment in Γ(τ ). (ii) If three adjacent vertices are part of Γ(τ +1), then it is possible that Pk is an anchor point and the remaining adjacent vertex is the direction point. However, this case is very rare and may appear when the image has a high contour density. (iii) If two adjacent vertices are part of Γ(τ +1)and Pkis set as anchor point, then there are two options for the direction point. Therefore, a binary switch, ξk,is used to select the correct position. The binary switches are collected in a vector Ξ(τ ). Let us denote n(τ )ξ the number of relative anchor points, and n(τ )ξ the number of direction points found for ∆Γ(τ ).

The column-wise search is finding the edge and double anchor points, which are then marked in a vector Υ(τ ) by checking column-wise the contour graph of Zτ. There is no need to encode a direction point for these two types of anchor points as we have already shown in Section 3.2.1.

The contour segments from ∆Γ(τ ) are encoded using two functions. One is called Integer Value Encoder (IVE), which was developed to encode efficiently one integer value that belongs to a predictable range. The other function is called Golomb-Rice Encoding of Vectors (GR-EV) and was developed to encode a vector of integer values using a modified version of the GR algorithm. The first stage of the P-GSO algorithm is the progressive coding of the image contours, which is summarized here in Algorithm 4.5. See Figure 4.3 for examples of progressive re-constructions for the depth-map image Art. Note that on step (6) of the algorithm, before encoding S(τ ), a deterministic change is done (see Appendix A); also the

IVEfunction was involved in the coding of the optimal context tree.

Algorithm 4.5: Progressive coding of GSO sequences (P-GSO) - one loop step in contour compression stage

Algorithm for progressive coding of the contour Γ(τ ) of the image Zτ using the contour Γ(τ +1)of the image Zτ +1.

(1) Search for the relative anchor points by traversing contour Γ(τ ), and then mark in the list Ψ(τ )the anchor point vertices found by analyzing each contour vertex.

Find for each Γk its direction point, ξk, and vector of3OTsymbols, SkT.

(2) Search for the edge and double anchor points using a column-wise search, and mark their positions in Υ(τ ). Find for each Γkits vector of3OTsymbols, SkT.

(3) Encode the number of relative anchor points v1 = n(τ )ξ , and the number of edge and double anchor points v2 = n(τ )∆Γ− n(τ )ξ , by applying the IVE function as IVE(vi, 4, 2), i = 1, 2.

(4) Encode the anchor points by first obtaining a vector Φ, which saves the number of consecutive values 0, and then by applying the GR-EV function to Φ. Apply this procedure first to Ψ(τ ), and then to the vectorized matrix Υ(τ ).

(5) Write directly in the output file the vector of direction points, Ξ(τ ), on n(τ )ξ bits.

(6) Encode the vector of concatenated 3OT vectors, S(τ ) =



S1T S2T · · · ST

n(τ )

∆Γ

T , usingCTMwith Laplace estimator, and with a maximum tree depth of dT = 17.

Integer Value Encoder, IVE(v, nbδ, nbr)

The IVE function was developed to encode an integer v ≥ 0 by first finding a smaller interval in which it belongs, and then by encoding integer v more efficient, using the found interval limits. The process of designing the set of intervals is the most important part of the algorithm.

Using the parameters nbδand nbr,theIVEfunction is generating four intervals, in which v is searched, as follows. The first interval is set as [0, 2nbδ] and, if it is selected, integer v is encoded using log22nbδ = nbδbits. The following intervals are obtained by shifting incrementally, with nbr,the number of bits needed to represent the upper bound of the previous interval. The second interval is [2nbδ, 2nbδ(1 + 2nbr)] and log22nbδ+nbr = nbδ+ nbrbits are needed to encode now v0= v − 2nbδ (we subtract from v the lower limit of the interval to scale the integer to the found interval). The third interval is [2nbδ(1 + 2nbr), 2nbδ(1 + 2nbr(1 + 2nbr))]

and log22nbδ+2nbr = nbδ + 2nbr bits are needed to encode v0 = v − 2nbδ(1 + 2nbr(1 + 2nbr)). The last interval is reserved for encoding high values, i.e. for v ≥ 2nbδ(1+2nbr(1+2nbr)), where we encode the value v0= v−2nbδ(1+2nbr(1+2nbr)) on log22nbδ+3nbr+Q= nbδ+ 3nbr+ Q bits, where Q is a positive integer constant.

Since v is an integer number,IVEdoes not cover all possible cases. However, for the values v encoded we can easily predict their upper bound and usually this last interval is not selected.

200 400 600 800 1000 1200

200 400 600 800 1000 1200

100

200 400 600 800 1000 1200

100

200 400 600 800 1000 1200

100

200 400 600 800 1000 1200

100

200 400 600 800 1000 1200

100

Figure 4.3: Examples of progressive reconstructions of depth-map images having different distortion. The contour map of the last known image is represented by contour edges marked with red. The contour segments encoded at the current step are represented by contour edges marked with blue. Double anchor points are marked with black; relative anchor points are marked with green.

Golomb-Rice Encoding of Vectors, GR-EV(Φ)

TheGR-EVfunction distinguishes two cases when coding the vector Φ, depending on its number of elements, nΦ.A switch is used to select one of the two cases. In the first case, the GRalgorithm is applied to Φ with the parameter M = 2k, by first finding the best parameter k and then encoding the vector Φ using M.

In the second case, the input vector is divided into two sub-vectors, denoted ΦL

and ΦH, then for each element from Φ we need to encode a decision specifying if the current value is added to ΦLor to ΦH.The sub-vector ΦLcollects the elements from Φ smaller than M, while the sub-vector ΦH collects the remaining elements.

The two sub-vectors are each encoded by theGRalgorithm applied to ΦL and ΦH

with the parameters ML = 2kL and MH = 2kH, respectively. The variables k, k− kL and kH− k are each encoded byAMMwith Laplace estimator.