Hi, I have to pad an array, obtain a bigger one with latest element array of every rows and cols of a Mat object around original array.

What I have to do is transalte form Matlab to C this line:

impadded=padarray(impadded,padVect, 'replicate','both');

I was using this code to obtain it:


 Mat padded;
 int padding = padSize;

I have 2 problems:
1) with setTo i m padding with zero element the original matrix and not with last element
2) in copyto(last line) I have an error:
no matching function for call to 'cv::Mat::copyTo(cv::Mat)'