create_matrix (Width, Height, 10, MatrixID)
X:=[]
for Index1 := 0 to Height-1 by 1
for Index2 := 0 to Width-1 by 1
get_grayval (Image1, Index1, Index2, Grayval)
set_grayval (Image4, Index1, Index2, Grayval)
X1[Index1, Index2]:=Grayval
endfor
tuple_concat(X,X1,X)
endfor
create_matrix(Height,Width, X, X1mat)
transpose_matrix(X1mat, XmatT)
get_full_matrix(XmatT, Values1)