Mat write to imge file