I assume your camera provides frame as an uchar* buff where A,R,G,B values of type uchar for one pixel are placed sequentially. Then the Mat initialization should look something like this:
int w, h;     // picture width and height