173 lines
5.4 KiB
Plaintext
173 lines
5.4 KiB
Plaintext
|
|
\usetikzlibrary{calc}
|
|
\usetikzlibrary{snakes}
|
|
\usetikzlibrary{arrows}
|
|
\usetikzlibrary{positioning}
|
|
\usetikzlibrary{decorations}
|
|
\usetikzlibrary{decorations.markings}
|
|
\usetikzlibrary{arrows.meta}
|
|
|
|
\newcommand{\scale}{0.65}
|
|
% \newcommand{\TikZyslant}{-0.2}
|
|
% \newcommand{\TikZyfshift}{0.05cm}
|
|
\newcommand{\yframeshift}{0.05cm}
|
|
\newcommand{\xframeshift}{7cm}
|
|
|
|
|
|
\pgfdeclarelayer{background}
|
|
\pgfdeclarelayer{foreground}
|
|
\pgfdeclarelayer{L0}
|
|
\pgfdeclarelayer{L1}
|
|
\pgfdeclarelayer{L2}
|
|
\pgfdeclarelayer{L3}
|
|
\pgfsetlayers{background,L0,L1,L2,L3,main,foreground}
|
|
|
|
|
|
|
|
|
|
\begin{tikzpicture}[scale=\scale,every node/.style={minimum size=1cm},on grid ]
|
|
|
|
\tikzstyle{pel}=[rectangle,draw=black, thick]
|
|
\tikzstyle{refblock}=[rectangle,draw=darkgray, thick]
|
|
\tikzstyle{projectedblock}=[rectangle,draw=black, thick,dashed]
|
|
\tikzstyle{refmv_linestyle}=[-, thick]
|
|
\tikzstyle{frame_label}=[anchor=center,scale=0.8]
|
|
|
|
\tikzstyle{refmv}=[draw=black, refmv_linestyle,decoration={markings,mark=at position 1 with {\arrow[ultra thick,scale=1]{latex}}},postaction={decorate}]
|
|
\tikzstyle{extrapolated_mv}=[refmv_linestyle,dashed, draw, decoration={markings,mark=at position 1 with {\arrow[ultra thick,scale=1]{latex}}},postaction={decorate}]
|
|
|
|
\tikzstyle{arrow}=[draw, ->,>=stealth',thick,,decoration={markings,mark=at position 1 with {\arrow[ultra thick,scale=0.5]{stealth}}},postaction={decorate}]
|
|
|
|
\tikzstyle{every node}=[font=\large]
|
|
|
|
\tikzstyle{frame_contour}=[ultra thick,fill=white,draw=black,fill opacity=.7]
|
|
|
|
\newcommand{\DrawFrame}[2]
|
|
{
|
|
\fill[fill=#1,fill opacity=.6] (0,0) rectangle (#2+1,#2+1); % Opacity
|
|
\draw[thick] (0,0) rectangle (#2+1,#2+1);
|
|
\foreach \x in {1,...,#2}
|
|
\draw[dotted] (\x,0) -- ++(0,#2+1);
|
|
\foreach \y in {1,...,#2}
|
|
\draw[dotted] (0,\y) -- ++(#2+1,0);
|
|
}
|
|
|
|
% Frame t
|
|
\begin{pgfonlayer}{L1}
|
|
\begin{scope}[ yshift=3*\yframeshift, xshift=3*\xframeshift,
|
|
style={yslant=\TikZyslant,xscale=\TikZxscale}]
|
|
|
|
|
|
%Draw a frame
|
|
\draw[very thick,fill=white,draw=black,fill opacity=.7,dashed](0,0) rectangle (5,5);
|
|
\foreach \x in {0,2,4}
|
|
\foreach \y in {0,2,4}
|
|
\draw[black, dotted] (\x,\y) +(0,0) rectangle ++(1,1);
|
|
\foreach \x in {1,3}
|
|
\foreach \y in {1,3}
|
|
\draw[black, dotted] (\x,\y) +(0,0) rectangle ++(1,1);
|
|
|
|
\coordinate (TB1) at (1,4);
|
|
%\coordinate (TB2) at (3,4);
|
|
\coordinate (TB3) at (3+0.2/2,2-0.8/2);
|
|
\coordinate (TB4) at (2+0.9,2+0.6);
|
|
|
|
\draw[projectedblock] (TB1) rectangle ++(1,-1);
|
|
\draw[projectedblock] (TB4) rectangle ++(1,-1);
|
|
|
|
|
|
% \coordinate (TB4) at (3,2);
|
|
% \draw[projectedblock] (TB4) rectangle ++(1,-1);
|
|
|
|
\end{scope}
|
|
\end{pgfonlayer}
|
|
|
|
|
|
% Frame t-1
|
|
\begin{pgfonlayer}{L1}
|
|
\begin{scope}[ yshift=2*\TikZyfshift, xshift=2*\xframeshift,
|
|
style={yslant=\TikZyslant,xscale=\TikZxscale}]
|
|
|
|
\coordinate (T0B1) at (1,4);
|
|
\coordinate (T0B2) at (3,4);
|
|
\coordinate (T0B3) at (1,2);
|
|
\coordinate (T0B4) at (2,2);
|
|
|
|
\coordinate (T0B1_aux) at (1-0.7,4-0.8);
|
|
|
|
% Draw Motion vectors
|
|
\coordinate (TM1B0) at (3+0.2,2-0.8);
|
|
\coordinate (TM1B0C) at (3+0.2/2,2-0.8/2);
|
|
|
|
\path[extrapolated_mv] (TB1) -- (T0B1_aux) node[above,pos=.2] {\footnotesize $v^{1}_{0}$};;
|
|
\path[extrapolated_mv] (TB4) -- (T0B4) node[above,pos=.4] {\footnotesize $v^{2}_{0}$};;
|
|
|
|
|
|
\DrawFrame{white}{4}
|
|
|
|
\draw[black,very thick] (T0B1) +(0,0) rectangle ++(1,-1);
|
|
\draw[projectedblock] (T0B1_aux) +(0,0) rectangle ++(1,-1);
|
|
\draw[black,very thick] (T0B4) +(0,0) rectangle ++(1,-1);
|
|
|
|
|
|
|
|
\end{scope}
|
|
\end{pgfonlayer}
|
|
|
|
% Frame t-2
|
|
\begin{pgfonlayer}{L2}
|
|
\begin{scope}[ yshift=1*\TikZyfshift, xshift=1*\xframeshift,
|
|
style={yslant=\TikZyslant,xscale=\TikZxscale}]
|
|
|
|
%Define Points
|
|
\coordinate (TM2B1) at (1-0.7,4-0.8);
|
|
\coordinate (TM2B2) at (3-0.6,4-0.5);
|
|
\coordinate (TM2B4) at (2-0.9,2-0.6);
|
|
|
|
% Draw Motion vectors
|
|
\path[refmv] (T0B1) -- (TM2B1) node[above,pos=.2] {\footnotesize $v^{1}_{-1}$};
|
|
\path[refmv] (T0B4) -- (TM2B4) node[above,pos=.3] {\footnotesize $v^{2}_{-1}$};
|
|
|
|
\DrawFrame{white}{4}
|
|
|
|
\coordinate (TM2B4_aux) at (3+0.3/2,2-0.4/2);
|
|
|
|
% Draw block
|
|
\draw[refblock] (TM2B1) rectangle ++(1,-1);
|
|
\draw[refblock] (TM2B4) rectangle ++(1,-1);
|
|
|
|
\end{scope}
|
|
\end{pgfonlayer}
|
|
|
|
|
|
%MVs name
|
|
% \node[scale=0.5] at (3*\xframeshift-1.0cm,4.9) {(2)};
|
|
% \node[scale=0.5] at (3*\xframeshift-1.0cm,3) {(1)};
|
|
% \node[scale=0.5] at (3*\xframeshift-2.0cm,2) {(2)};
|
|
% \node[scale=0.5] at (3*\xframeshift-1.0cm,0.3) {(4)};
|
|
|
|
|
|
% \node[frame_label,scale=0.95] (LostFrameLabel) at (4*\xframeshift-0.9cm,-1.8) {Lost frame };
|
|
% \path[draw,-latex,thick] (LostFrameLabel) edge[out=90, in=0] (3*\xframeshift+5cm*\TikZxscale,0cm);
|
|
|
|
% Frame number
|
|
\begin{scope}[xshift=2.5cm*\TikZxscale,yshift=5.5cm]
|
|
% \node[frame_label] at (0*\xframeshift,\yframeshift*3) { $f_{-3}, v_{-3}$ };
|
|
\node[frame_label] at (1*\xframeshift,\yframeshift*3) { $f_{-2}, v_{-2}$ };
|
|
\node[frame_label] at (2*\xframeshift,\yframeshift*3) { $f_{-1,} v_{-1}$ };
|
|
\node[frame_label] at (3*\xframeshift,\yframeshift*3) { $f_{0}, v_{0}$ };
|
|
% \node[frame_label] at (4*\xframeshift,\yframeshift*4) { $f_{1}, v_{1}$ };
|
|
\end{scope}
|
|
|
|
% Frame number
|
|
\begin{scope}[xshift=2.5cm*\TikZxscale,yshift=-1.2cm]
|
|
% \node[frame_label] at (0*\xframeshift,\yframeshift*3) { $t_{-3}$ };
|
|
\node[frame_label] at (1*\xframeshift,\yframeshift*3) { $t_{-2}$ };
|
|
\node[frame_label] at (2*\xframeshift,\yframeshift*3) { $t_{-1}$ };
|
|
\node[frame_label] at (3*\xframeshift,\yframeshift*3) { $t_{0}$ };
|
|
% \node[frame_label] at (4*\xframeshift,\yframeshift*4) { $t_{1}$ };
|
|
\end{scope}
|
|
|
|
|
|
\end{tikzpicture}
|