Possible Bug cv::Mat at() throws exception in debug mode

i took the liberty to remove your useless screenshot
(please post text, not images of it !)

however the answer is simple: if your Mat’s type is CV_32F, you must use:

distances.at<float>(0, 0);

in other words, you have to match the underlying datatpe exactly, no liberties allowed here, with CV_64F you would use at<double>(y,x) and so on …

(problem is ofc the same in release mode, it just wont assert there
(similar to how std::vector behaves))