Ask Your Question

Revision history [back]

I have managed to find the error in additional input data, I wrong created 4d cv::Mat 4d. The right way is

int s[] = { 1, n_channels, w, h };
cv::Mat blob = cv::Mat(4, s, CV_32F, cv::Scalar::all(val));

in my code was

int s[] = { 1, n_channels, w, h };
cv::Mat blob = cv::Mat(4, s, CV_32F);
cv::Mat unit(s[2], s[3], CV_32F, cv::Scalar(val));
for (int i = 0; i < s[1]; i++) {
    unit.copyTo(cv::Mat(unit.rows, unit.cols, CV_32F, blob.ptr((i, 0))));
}

Why it worked in the debug mode and did not work in the release mode I did not understand