2012-12-25 09:15:02 -0500 asked a question (OpenNI+OpenCv Xtion C++) Unable to access elements from depth matrix I have the following simple code to grab the depth data from my Xtion sensor in the main function: VideoCapture capture( CV_CAP_OPENNI ); while (true) { Mat depthMap; capture.grab(); capture.retrieve( depthMap, CV_CAP_OPENNI_DEPTH_MAP ); //depthMap.convertTo(depthMap,CV_16U); cout << "depth: " << depthMap.at(0,0) << endl; namedWindow( "Display window", CV_WINDOW_AUTOSIZE ); imshow( "Display window", depthMap ); waitKey(30); }  As far as I've understood, depthMap should be a matrix of type 16UC1, which I have understood should be a single channel integer matrix. Hence the use of the at function. It compiles fine, but on runtime, I get the following error, also when converting to CV_16U: OpenCV Error: Assertion falied i0 < size.p[0] && ::channels> < <<28>|0x8442211> >> <::depth> & <<1 <<3> -1>*4> & 15> == elemSize1<>> in unknown function, file c:\opencv\build\install\include\opencv2\core\mat.hpp, line 537 Does anyone have any idea what this error could mean?