Thanks for the reply
I have that container already. I will make a Mat just like what you did. Then I process the Mat and get to a new Mat. Now, I want to pass the data of this new Mat to a new container (not the previous one). Something like:
vector<uchar> container = ...
Mat m(h, w, CV_8U, container.data());
Mat gray;
cvtColor(m, gray, COLOR_RGB2GRAY);
vector<uchar> container2;
container2.data() = gray.data;