Just copy the whole functions in binarycvmat cpp to your code or write header. Save and load cv mat as a binary file. Load modify and save an image.