I don't know much about motion detection, but your code calls for some remarks:
- color(#ABCDEF) is a redundant call. You can use #ABCDEF directly.
- There is a syntax for easy array initialization, removing the need to write all the indexes...
Instead of color[] c = new color[36]; then initializing each slot in setup(), try:
color[] c =
{
#f4b264,
#bee5e4,
#fe022b,
#082f56,
#f8f3d6,
#fceea7,
#ff7101,
#f1d7ca,
#ffafc3,
#abe6e2,
#e2e8ce,
#ffcb00,
#aae354,
#ddb0b7,
#d2e6b5,
#77a3be,
#005c9d,
#bb3325,
#fdd4e2,
#0dbbde,
#643324,
#99e1d3,
#ff92a9,
#a7bbba,
#d0e099,
#00b14b,
#0376b9,
#fedf2d,
#fbd362,
#fe5900,
#4fb900,
#fdd4e2,
#ddb0b7,
#a9998a,
#77a3be,
#bdb0b7,
};
Same size, but easier to type (here I just used a regular expression in my editor to isolate the relevant parts) and to read. And faster, even if it is unimportant here.