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<int>(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 <dims <="2" &&="" data="" &&="" <unsigned="">i0 < <unsigned>size.p[0] && <unsigned><i1*datatype<_tp>::channels> < <unsigned><size.p[1]*channels<>> &&="" <<<<sizeof(size_t=""><<28>|0x8442211> >> <<datatype<_tp>::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?