Ask Your Question

Revision history [back]

Hi!

This should not be a problem... Please add:

 CV_ASSERT(src.depth()==CV_64F);

That way, you are sure the matrix type is OK... You should also use direct access to speedup a little the iterations:

 cv::Mat rowwise_maximum(const cv::Mat& src, int32_t width)
 {
    CV_ASSERT(src.depth()==CV_64F);
    cv::Mat dest = src.clone();
    double* singleRowSrc, singleRowDest;
    for(int row = 0; row < dest.rows; ++row)
    {
        singleRowSrc = src.ptr<double>(row);
        singleRowDest= dest.ptr<double>(row);
        for(int col = 0; col < dest.cols; ++col)
        {
            singleRowDest[col] = 0.5 * singleRowSrc[col];
        }
    }

    std::cout << "ok" << std::endl;

    return dest;
 }

max_foo.refcount is still 0 because code probably crash before assignment (I think it occurs while removing that data from the stack).