You could use a \matrix
with a convenient style to do the job for you.
\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix, positioning}
\newcounter{countcells}
\tikzset{
resetcounter/.code={\setcounter{countcells}{0}},
mycell/.style={rectangle,
draw,
outer sep=0pt,
minimum size = 1cm,
inner sep=0pt},
mygrid/.style={matrix of nodes,
nodes in empty cells,
nodes={mycell, anchor=center,
node contents = $C_{\thecountcells}$\stepcounter{countcells}},
row sep = -\pgflinewidth,
column sep= -\pgflinewidth,
resetcounter},
}
\begin{document}
\begin{tikzpicture}
\matrix[mygrid] (C) {
&&&\\
&&&\\
&&&\\
&&&\\};
\matrix[mygrid, right= of C.east] {
&&&&\\
&&&&\\
&&&&\\};
\end{tikzpicture}
\end{document}

Update: The matrix over a figure:
\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix, positioning}
\newcounter{countcells}
\tikzset{
resetcounter/.code={\setcounter{countcells}{0}},
mycell/.style={rectangle,
draw,
outer sep=0pt,
minimum size = 1cm,
inner sep=0pt},
mygrid/.style={matrix of nodes,
inner sep=0pt,
outer sep=0pt,
nodes in empty cells,
nodes={mycell, anchor=center,
node contents = $C_{\thecountcells}$\stepcounter{countcells}},
row sep = -\pgflinewidth,
column sep= -\pgflinewidth,
resetcounter},
}
\begin{document}
\begin{tikzpicture}
\node[outer sep=0pt, inner sep=0pt] (A) {\includegraphics{example-image-a}};
\matrix[mygrid, below right=0pt of A.north west] (C) {
&&&&&&&&&&&\\
&&&&&&&&&&&\\
&&&&&&&&&&&\\
&&&&&&&&&&&\\
&&&&&&&&&&&\\
&&&&&&&&&&&\\
&&&&&&&&&&&\\
&&&&&&&&&&&\\
&&&&&&&&&&&\\
};
\end{tikzpicture}
\end{document}
