Mat a mat object representing the image to be written. This is the input of the ann. Following program is an example to write an image using java program using opencv library.