\begin{tikzpicture}[auto, on grid, scale=.5, y=-1cm, every node/.style={scale=.5, y=-1cm}] \def\BlockSize{4} \tikzstyle{TextStyle}=[text centered, font=\Huge] \tikzstyle{PU} =[draw, minimum height=\BlockSize cm, minimum width=\BlockSize cm, font=\Huge] \tikzstyle{Neighbour} =[draw, minimum height=1 cm, minimum width=\BlockSize cm, font=\Large, fill=gray!60] \def\TikZColorFill{gray!20} \def\TikZColorFillDark{gray!80} \tikzstyle{PixelAnchor} =[xshift=.5cm, yshift=-.5cm] \tikzstyle{Pixel} =[circle, thin, fill=lightgray, inner sep=0, minimum size=10pt] \tikzstyle{PixelNeighbour} =[Pixel, fill=black!80] \tikzstyle{Arrow} =[-latex,thick, draw=black] \tikzstyle{NeighbourSquares} =[fill=darkgray!80] \draw[Pixel] (0,0) grid ++(4.5,4.5); \node[NeighbourSquares, anchor=north west, minimum width=1cm, minimum height=1cm] at (-1,-1) {}; \node[NeighbourSquares, anchor=north west, minimum width=4cm, minimum height=1cm] at (0,-1) {}; \node[NeighbourSquares, anchor=north west, minimum width=4cm, minimum height=1cm] at (4,-1) {}; \node[NeighbourSquares, anchor=north west, minimum width=1cm, minimum height=4cm] at (-1,0) {}; \node[NeighbourSquares, anchor=north west, minimum width=1cm, minimum height=4cm] at (-1,4) {}; % Pixels \foreach \x in {0,...,3} \foreach \y in {0,...,3} { \node at (\x,\y) [PixelAnchor,Pixel]() {}; } \foreach \x in {-1} \foreach \y in {-1,...,7} { \node at (\x,\y) [PixelAnchor,PixelNeighbour]() {}; } \foreach \x in {0,1,...,7} \foreach \y in {-1} { \node at (\x,\y) [PixelAnchor,PixelNeighbour]() {}; } \path[PixelAnchor, Arrow, dashed, shorten >= 38 pt] (.5,-1) -- ++( -2 , \BlockSize ); \path[PixelAnchor, Arrow, shorten >= 25 pt] (1,-1) -- ++( -2 , \BlockSize ); \path[PixelAnchor, Arrow, dashed, shorten >= 13 pt] (1.5,-1) -- ++( -2 , \BlockSize ); \foreach \x in {2,...,5} { \path[PixelAnchor,Arrow] (\x,-1) -- ++(-2, \BlockSize); } \foreach \x in {2.5,...,4.5} { \path[PixelAnchor,Arrow,dashed] (\x,-1) -- ++(-2, \BlockSize); } \path[Arrow, very thick, -] (-1,4) -- ++(6,0); \path[Arrow, very thick, -] (4,-1) -- ++(0,6); \path[Arrow, very thick, -] (-1,0) -- ++(1,0); \path[Arrow, very thick, -] (0,-1) -- ++(0,1); \path[Arrow, very thick, -] (0,0) -- ++(4,0) node[midway,above, yshift=1cm, scale=1.2] {Top}; \path[Arrow, very thick, -] (4,0) -- ++(4,0) node[midway,above, yshift=1cm, scale=1.2] {Top-right}; \path[Arrow, very thick, -] (0,0) -- ++(0,4) node[midway,above, xshift=-1cm, scale=1.2, rotate=90] {Left}; \path[Arrow, very thick, -] (0,4) -- ++(0,4) node[midway,above, xshift=-1cm, scale=1.2, rotate=90] {Bottom-left}; % \path[Arrow, very thick, -] (8,0) -- ++(0,-1); % \path[Arrow, very thick, -] (0,8) -- ++(-1,0); \node[anchor=south west, align=left, text width=4cm] at (6,6) (RefLabel) {Reference pixels}; \node[anchor=south west, align=left, text width=4cm, below=.5cm of RefLabel] (PredLabel) {Predicted pixels}; \node[anchor=south west, align=left, text width=4cm, below=.5cm of PredLabel] (PredDir) {Prediction direction}; \node[Pixel, left=1.3 cm of PredLabel] {}; \node[PixelNeighbour, left=1.3 cm of RefLabel] {}; \path[Arrow, latex-] (PredDir.west) -- ++(-1,0); % \path[PixelAnchor, Arrow, blue] (2.75,-1) -- ++( -2 , \BlockSize ); \end{tikzpicture}