How to convert CvMat to cv::Mat and use += operator on cv::Mat object?

please show the error !

(and, in the long run, cvarrToMat() is not a solution,
you will need to replace all the CVMat code, too !)

btw,

p is never initialized in the code you show