Changed Mat value type from double to uchar.

Stabilized and cleaned the project