Here's the code to generate the required 3x3x3 uint8 matrix:
main.m490 chars17 lines
The colors
variable is an array of uint8 values representing the RGB values of each pixel color.
The matrix
variable is a 3x3x3 matrix of uint8 values. Each element in the first two dimensions represents a pixel location, while the third dimension represents the RGB components of that pixel color.
gistlibby LogSnag