\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{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=blue, 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+0.7,4+0.8); \draw[projectedblock] (TB1) rectangle ++(1,-1); \coordinate (TB2) at (3,4); \draw[projectedblock] (TB2) rectangle ++(1,-1); \coordinate (TB3) at (3+0.2/2,2-0.8/2); \draw[projectedblock] (TB3) rectangle ++(1,-1); \coordinate (TB4) at (3,2); \draw[projectedblock] (TB4) rectangle ++(1,-1); \end{scope} \end{pgfonlayer} % % Frame t+1 % \begin{pgfonlayer}{L0} % \begin{scope}[ yshift=4*\yframeshift, xshift=4*\xframeshift, % style={yslant=\TikZyslant,xscale=\TikZxscale}] % % % \coordinate (TP1B1) at (1,4); % \coordinate (TP1B2) at (3,4); % \coordinate (TP1B3) at (1,2); % \coordinate (TP1B4) at (3,2); % % %Draw a frame % \DrawFrame{white}{4} % % % \draw[black,very thick] (TP1B2) +(0,0) rectangle ++(1,-1); % \draw[black,very thick] (TP1B4) +(0,0) 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 (3,2); \coordinate (TM1AuxB3) at (1,2); \coordinate (Bottom_V1) at (2.5,0); \draw[extrapolated_mv] (TB1) to (T0B1); % Draw Motion vectors \coordinate (TM1B0) at (3+0.2,2-0.8); \coordinate (TM1B0C) at (3+0.2/2,2-0.8/2); % \draw[refmv] (TP1B4) to (TM1B0); \draw[refblock] (TM1B0) rectangle ++(1,-1); \draw[extrapolated_mv] (TB3) to (TM1B0); \draw[refblock] (TM1B0C) rectangle ++(1,-1); \draw[extrapolated_mv] (TB4) to (TM1B0C); \coordinate (TM1B1) at (3-0.6,4-0.5); \draw[extrapolated_mv] (TB2) to (TM1B1); \DrawFrame{white}{4} \draw[black,very thick] (T0B1) +(0,0) rectangle ++(1,-1); \draw[black,very thick] (T0B2) +(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); % Draw Motion vectors \draw[refmv] (T0B1) to (TM2B1); \draw[refmv] (T0B2) to (TM2B2); \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] (TM2B2) 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)}; \tikzstyle{frame_label}=[anchor=center,scale=0.8] % \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} % \begin{scope}[yshift=-3.2cm,xshift=-0.5cm] % \begin{scope} % \draw[refmv] (0,0) to (1.5,0); % \fill (2cm,0) node[frame_label,scale=0.95,right]{Original Motion Vector}; % \end{scope} % \begin{scope}[xshift=14cm] % \draw[extrapolated_mv] (0,0) to (1.5,0); % \fill (2cm,0) node[frame_label,scale=0.95,right]{Extrapolated Motion Vector}; % \end{scope} % \end{scope} \end{tikzpicture}