Hello!
I am a beginner and running into some trouble with the surface matching in opencv.
I am attempting to get depth from a depth camera and give it to a surface match. When I attempt to convert the Mat to CV_32F, which the detector.trainModel() needs, I get a Read Access Violation.
Exception thrown: read access violation. ptr was 0x8A88000.
assuming, your input is CV_8UC3, you cannot convert it in-place to a single float channel (you would need to re-allocate the output) using that “borrowed pointer”.
convertTo also does not change the number of channels
probably the easiest solution is to use a new, empty Mat for the result:
Mat ImageG;
cvtColor(imageD, imageG, COLOR_BGR2GRAY);
Mat imageF;
imageG.convertTo(imageF, CV_32F);
ppf_match_3d::PPF3DDetector detector(0.03, 0.05);
detector.trainModel(imageF);
p.s.
i think, this is all the wrong approach. instead (lossy) conversion to float (what do you think, you gain here, even ?), you should find out, if it is possible to get a better image format from your cam directly