I believe ```CV_IN_OUT```should be removed since you've replaced ```Mat&``` by ```InputOutputArray ```