use InputOutputArray or whatever instead of Mat