I am using Opencv in Visual Studio 2012 with C++ in a Console Application.
fastx and fasty are both pointers to image matrices, a cv::Mat. When i hit i=1194 fastJy crashes when assigning it a value. Using break points, it seems that fasty has a value of '<unable to="" read="" memory="">' when the variable is inspected.
[code] void IterationStage(cv::Mat Jx, cv::Mat Jy) { double* fastx; double* fasty; for(int i=0; i<_count;i++) { fastJx = Jx.ptr<double>(0) + Jx.stepi; fastJy = Jy.ptr<double>(0) + Jy.stepi;
fastJx[0] = 255;
fastJx[1] = 255;
}
} [/code]
Making this change fixes fastJy.
[code] void IterationStage(cv::Mat Jx, cv::Mat Jy) { double* fastx; double* fasty; for(int i=0; i<_count;i++) { fastJx = Jx.ptr<double>(0) + Jx.stepi; fastJy = Jx.ptr<double>(0) + Jy.stepi; //CHANGED HERE.
fastJx[0] = 255;
fastJx[1] = 255;
}
} [/code]
This is odd as i am still using the Jy.step with the Jx matrix. Both matrices are initialized with the same constructor, just before the function is calledas shown below.
[code] cv::Mat Jx = cv::Mat::zeros(__paw.nPix(), __shape.nModes()+4, CV_64FC1); cv::Mat Jy = cv::Mat::zeros(__paw.nPix(), __shape.nModes()+4, CV_64FC1); IterationStage(cv::Mat Jx, cv::Mat Jy) [/code]
Anyway, the error message is this.
"Unhandled exception at 0x003A5777 in OpencvShapeTest.exe: 0xC0000005: Access violation writing location 0x024290A0."