So i finally got this picture in picture to work after i looked through Shervin's Chapter 8 code of mastering CV. I was missing the conversion lines below:
Mat srcBGR = Mat(face_resized.size(), CV_8UC3);
cvtColor(face_resized, srcBGR, CV_GRAY2BGR);
cv::Rect roi = cv::Rect(50,50, srcBGR.cols/2, srcBGR.rows/2);
cv::Mat subview = srcBGR(roi);
subview.copyTo(original(roi));
However, i think i am going out of bounds somewhere and i'm not sure how to check this or to stay within it.
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /tmp/opencv-20160502-20452-13c59z2/opencv-2.4.12/modules/core/src/matrix.cpp, line 323
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /tmp/opencv-20160502-20452-13c59z2/opencv-2.4.12/modules/core/src/matrix.cpp:323: error: (-215) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function Mat
Alef