\begin{tikzpicture}[remember picture,overlay,shift={(current page.center)}]
  \tikzset{
    mstyle/.style={column sep=-\pgflinewidth,row sep=-\pgflinewidth,font=\footnotesize,},
    window/.style={draw,very thick,blue},
  }
  
  \only<1>{
			\matrix(convmat1) at (-6,2.5) [matrix of nodes,ampersand replacement=\&,column sep=-\pgflinewidth,row sep=-\pgflinewidth,nodes in empty cells,
			nodes={draw,rectangle, font=\footnotesize,anchor=south}]{
				|[fill=black!50]| \& |[fill=black!50]| \& |[fill=black!50]| \& |[fill=black!50]| \& |[fill=black!50]| \& |[fill=black!50]| \& |[fill=black!50]|\\ 
				|[fill=black!50]|\&  \&  \&  \&  \&  \&|[fill=black!50]| \\ 
				|[fill=black!50]|\&  \&  \&  \&  \&  \& |[fill=black!50]|\\ 
				|[fill=black!50]| \&  \&  \&  \&  \&  \& |[fill=black!50]|\\ 
				|[fill=black!50]|\&  \&  \&  \&  \&  \& |[fill=black!50]|\\ 
				|[fill=black!50]| \&  \&  \&  \&  \&  \& |[fill=black!50]|\\ 
				|[fill=black!50]|\& |[fill=black!50]| \& |[fill=black!50]| \&  |[fill=black!50]|\&|[fill=black!50]|  \&  |[fill=black!50]|\& |[fill=black!50]|\\ 
			};
 

			% \matrix (mat1) at (-5.23,1.73)  [matrix of nodes,ampersand replacement=\&,
			%   nodes={draw=blue,rectangle},nodes in empty cells]
			%   {
			%      \&  \&  \\
			%      \&  \&  \\
			%      \&  \&  \\
			%   };
			%            \node (text) [below of = mat1, node distance = 3 em, anchor=east]{\footnotesize \textsf{pixel of interest}};
			%               \draw[<-, in=0, out=-90] (-5.23,1.73) to (text.north);  
        
			\matrix(convmat2)[right of=convmat1,node distance=6em,matrix of nodes,ampersand replacement=\&,column sep=-\pgflinewidth,row sep=-\pgflinewidth,nodes in empty cells,
			nodes={draw,rectangle, font=\footnotesize,anchor=south}]{
				\&  \&  \& \& \\
				\&  \&  \& \& \\
				\&  \&  \& \& \\
				\&  \&  \&  \& \\
				\&  \&  \&  \& \\
			};
			
			
			\foreach \i  in {1,...,5}{
				\foreach \j  in {1,...,5}{

					\draw[fill=black] (convmat2-\i-\j)circle(1.5pt);

				}
			}

			\node(text)[left of = convmat2,node distance=2em, anchor=east]{\footnotesize \textsf{=}}; 
		}
              \onslide<2-4>{
              \matrix(convmat1) at (-6,2.5)[matrix of nodes,ampersand replacement=\&,column sep=-\pgflinewidth,row sep=-\pgflinewidth,nodes in empty cells,
                nodes={draw,rectangle, font=\footnotesize,anchor=south}]{
                     \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	  \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	              };
	
	 
	  % \foreach \i/\j [count=\xi from 0] in {1/3,2/4,3/5,4/6,5/7,6/8,7/9,8/10,9/11,10/12,11/13,12/14,13/15,14/16,15/17,16/18,17/19,18/20,19/21,20/22,21/23,22/24,23/25,24/26,25/27,26/28}{
	  %   \foreach \k/\m [count=\yi from \xi*26+1] in {1/3,2/4,3/5,4/6,5/7,6/8,7/9,8/10,9/11,10/12,11/13,12/14,13/15,14/16,15/17,16/18,17/19,18/20,19/21,20/22,21/23,22/24,23/25,24/26,25/27,26/28}{
	  %    \onslide<\yi>{
	  %    \draw[window](convmat1-\i-\k.north west)rectangle(convmat1-\j-\m.south east);
	     
	  %    }
	  %   }
	  % }
	\foreach \i/\j [count=\xi from 2] in {1/5,2/6,3/7}{
	\onslide<\xi>{
	  \draw[window](convmat1-1-\i.north west)rectangle(convmat1-5-\j.south east);
	}
	  
	}
	              
	              
	              \matrix(convmat2)[right of=convmat1,node distance=6em,matrix of nodes,ampersand replacement=\&,column sep=-\pgflinewidth,row sep=-\pgflinewidth,nodes in empty cells,
	                nodes={draw,rectangle, font=\footnotesize,anchor=south}]{
	       \&  \&  \\
	       \&  \&  \\
	       \&  \&  \\
	    };
	
	 
	  % \foreach \i [count=\xi from 0] in {1,...,5}{
	  %             \foreach \j [count=\yi from \xi*5+1] in {1,...,5}{
	    % \onslide<\yi->{
	  %             \draw[fill=black] (convmat2-\i-\j)circle(1.5pt);
	    % }
	  %             }
	  %             }
	  \foreach \i/\j [count=\xi from 2] in {1/1,2/2,3/3}{
	  \onslide<\xi->{
	    \draw[fill=black] (convmat2-1-\j)circle(1.5pt);
	  }
	
	  }
	\node(text)[left of = convmat2,node distance=2em, anchor=east]{\footnotesize \textsf{=}}; 
	}
	
	\only<5>{
	              \matrix(convmat1) at (-6,2.5) [matrix of nodes,ampersand replacement=\&,column sep=-\pgflinewidth,row sep=-\pgflinewidth,nodes in empty cells,
	                nodes={draw,rectangle, font=\footnotesize,anchor=south}]{
	                     \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	  \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	              };
	 
	  \draw[window](convmat1-3-3.north west)rectangle(convmat1-7-7.south east);
	              
	              
	              \matrix(convmat2)[right of=convmat1,node distance=6em,matrix of nodes,ampersand replacement=\&,column sep=-\pgflinewidth,row sep=-\pgflinewidth,nodes in empty cells,
	                nodes={draw,rectangle, font=\footnotesize,anchor=south}]{
	       \&  \&  \\
	       \&  \&  \\
	       \&  \&  \\
	    };
	
	
	 \foreach \i  in {1,...,3}{
	              \foreach \j  in {1,...,3}{
	    
	              \draw[fill=black] (convmat2-\i-\j)circle(1.5pt);
	    
	              }
	              }
	  
	\node(text)[left of = convmat2,node distance=2em, anchor=east]{\footnotesize \textsf{=}}; 
	}
	\only<6>{
	              \matrix(convmat1) at (-6,2.5) [matrix of nodes,ampersand replacement=\&,column sep=-\pgflinewidth,row sep=-\pgflinewidth,nodes in empty cells,
	                nodes={draw,rectangle, font=\footnotesize,anchor=south}]{
	                     \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	  \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	              };
 
  %\draw[window](convmat1-6-6.north west)rectangle($(convmat1-7-7.south east)+(-1,-1)$);
  \matrix (mat1) at (-5.48,1.98)  [matrix of nodes,ampersand replacement=\&,
    nodes={draw=blue,rectangle},nodes in empty cells]
    {
       \&  \&  \& \& \\
       \&  \&  \& \& \\
       \&  \&  \& \& \\
       \&  \&  \&  \& \\
       \&  \&  \&  \& \\
    };
    

    \node (text) [below of = mat1, node distance = 3 em, anchor=east]{\footnotesize \textsf{pixel of interest}};
                \draw[<-, in=0, out=-90] (-5.485,1.975) to (text.north);
              
              \matrix(convmat2)[right of=convmat1,node distance=6em,matrix of nodes,ampersand replacement=\&,column sep=-\pgflinewidth,row sep=-\pgflinewidth,nodes in empty cells,
                nodes={draw,rectangle, font=\footnotesize,anchor=south}]{
       \&  \&  \\
       \&  \&  \\
       \&  \&  \\
    };


	 \foreach \i  in {1,...,3}{
	              \foreach \j  in {1,...,3}{
	    
	              \draw[fill=black] (convmat2-\i-\j)circle(1.5pt);
	    
	              }
	              }
	  
	\node(text)[left of = convmat2,node distance=2em, anchor=east]{\footnotesize \textsf{=}}; 
	}
	
	
	
	\only<7>{
	              \matrix(convmat1) at (-6,2.5) [matrix of nodes,ampersand replacement=\&,column sep=-\pgflinewidth,row sep=-\pgflinewidth,nodes in empty cells,
	                nodes={draw,rectangle, font=\footnotesize,anchor=south}]{
	                     \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	  \&  \&  \&  \&  \&  \& \\ 
	   \&  \&  \&  \&  \&  \& \\ 
	              };
	 
	  %\draw[window](convmat1-6-6.north west)rectangle($(convmat1-7-7.south east)+(-1,-1)$);
	  \matrix (mat1) at (-5.22,1.72)  [matrix of nodes,ampersand replacement=\&,
	    nodes={draw=blue,rectangle},nodes in empty cells]
	    {
	       \&  \&  \& \& \\
	       \&  \&  \& \& \\
	       \&  \&  \& \& \\
	       \&  \&  \&  \& \\
	       \&  \&  \&  \& \\
	    };
	    
	
	    \node (text) [below of = mat1, node distance = 3 em, anchor=east]{\footnotesize \textsf{pixel of interest}};
	                \draw[<-, in=0, out=-90] (-5.22,1.72) to (text.north);
	              
	              \matrix(convmat2)[right of=convmat1,node distance=6em,matrix of nodes,ampersand replacement=\&,column sep=-\pgflinewidth,row sep=-\pgflinewidth,nodes in empty cells,
	                nodes={draw,rectangle, font=\footnotesize,anchor=south}]{
	       \&  \&  \\
	       \&  \&  \\
	       \&  \&  \\
	    };
	
	
	 \foreach \i  in {1,...,3}{
	              \foreach \j  in {1,...,3}{
	    
	              \draw[fill=black] (convmat2-\i-\j)circle(1.5pt);
	    
	              }
	              }
	  
	\node(text)[left of = convmat2,node distance=2em, anchor=east]{\footnotesize \textsf{=}}; 
	}
	
	
	\onslide<8->{
	              \matrix(convmat1) at (-6,2.5) [matrix of nodes,ampersand replacement=\&,column sep=-\pgflinewidth,row sep=-\pgflinewidth,nodes in empty cells,
	                nodes={draw,rectangle, font=\footnotesize,anchor=south}]{
	                    |[fill=black!50]| \& |[fill=black!50]| \& |[fill=black!50]| \& |[fill=black!50]| \& |[fill=black!50]| \& |[fill=black!50]| \& |[fill=black!50]|\\ 
	   |[fill=black!50]|\& |[fill=black!30]| \& |[fill=black!30]| \& |[fill=black!30]| \& |[fill=black!30]| \& |[fill=black!30]|  \&|[fill=black!50]| \\ 
	   |[fill=black!50]|\& |[fill=black!30]| \&  \&  \&  \& |[fill=black!30]| \& |[fill=black!50]|\\ 
	  |[fill=black!50]| \& |[fill=black!30]| \&  \&  \&  \& |[fill=black!30]| \& |[fill=black!50]|\\ 
	   |[fill=black!50]|\& |[fill=black!30]| \&  \&  \&  \& |[fill=black!30]| \& |[fill=black!50]|\\ 
	 |[fill=black!50]| \& |[fill=black!30]| \&  |[fill=black!30]|\& |[fill=black!30]| \& |[fill=black!30]| \& |[fill=black!30]| \& |[fill=black!50]|\\ 
	   |[fill=black!50]|\& |[fill=black!50]| \& |[fill=black!50]| \&  |[fill=black!50]|\&|[fill=black!50]|  \&  |[fill=black!50]|\& |[fill=black!50]|\\ 
	              };
	 
	  %\draw[window](convmat1-6-6.north west)rectangle($(convmat1-7-7.south east)+(-1,-1)$);
	  % \matrix (mat1) at (-5.22,1.72)  [matrix of nodes,ampersand replacement=\&,
	  %   nodes={draw=blue,rectangle},nodes in empty cells]
	  %   {
	  %      \&  \&  \& \& \\
	  %      \&  \&  \& \& \\
	  %      \&  \&  \& \& \\
	  %      \&  \&  \&  \& \\
	  %      \&  \&  \&  \& \\
	  %   };
	    
	
	  %   \node (text) [below of = mat1, node distance = 3 em, anchor=east]{\footnotesize \textsf{pixel of interest}};
	  %               \draw[<-, in=0, out=-90] (-5.22,1.72) to (text.north);
	              
	              \matrix(convmat2)[right of=convmat1,node distance=6em,matrix of nodes,ampersand replacement=\&,column sep=-\pgflinewidth,row sep=-\pgflinewidth,nodes in empty cells,
	                nodes={draw,rectangle, font=\footnotesize,anchor=south}]{
	       \&  \&  \\
	       \&  \&  \\
	       \&  \&  \\
	    };
	
	
	 \foreach \i  in {1,...,3}{
	              \foreach \j  in {1,...,3}{
	    
	              \draw[fill=black] (convmat2-\i-\j)circle(1.5pt);
	    
	              }
	              }
	  
	\node(text)[left of = convmat2,node distance=2em, anchor=east]{\footnotesize \textsf{=}}; 
	}

\end{tikzpicture}