Opencv IplImage至Mat refcount 我在编写一个代码时遇到了一些问题,我试图在C++中编写 BWAcPLAG/操作。我遇到了一些内存释放问题,我不知道为什么,因为我试图遵循中的文档。 变量refcountMat本身似乎有问题

Opencv IplImage至Mat refcount 我在编写一个代码时遇到了一些问题,我试图在C++中编写 BWAcPLAG/操作。我遇到了一些内存释放问题,我不知道为什么,因为我试图遵循中的文档。 变量refcountMat本身似乎有问题,opencv,Opencv,这是我的密码: void VideoSeg::bwlabel(IplImage *srce, IplImage *out) { namedWindow( "wndNameOut", CV_GUI_NORMAL ); cvConvertScale(srce,srce,255.); Ptr<IplImage> srcx = srce; Mat src(srcx); imshow( "wndNameOut", src);

这是我的密码:

void VideoSeg::bwlabel(IplImage *srce, IplImage *out)
{

    namedWindow( "wndNameOut", CV_GUI_NORMAL );
    cvConvertScale(srce,srce,255.);
    Ptr<IplImage> srcx = srce; 

    Mat src(srcx);

    imshow( "wndNameOut", src);            //The image is succesfully plotted
    SimpleBlobDetector blobDetector( params );
    blobDetector.create("SimpleBlob");

    blobDetector.detect(src, keyPoints );  // The problem appears in this line

    for(int i=0; i<keyPoints.size(); i++ )
    {
        cv::floodFill(src,keyPoints[i].pt, Scalar::all((i+1)*255/(keyPoints.size()+1)));
    }

    IplImage outx = src;
    //http://docs.opencv.org/doc/tutorials/core/interoperability_with_OpenCV_1/interoperability_with_OpenCV_1.html
    (*out) = outx;

    cout << "Keypoints " << keyPoints.size() << endl;
}
void VideoSeg::bwlabel(IplImage*srce,IplImage*out)
{
namedWindow(“wndNameOut”,CV_GUI_NORMAL);
cvConvertScale(srce,srce,255.);
Ptr srcx=srce;
Mat-src(srcx);
imshow(“wndNameOut”,src);//图像已成功绘制
SimpleBlobDetector blobDetector(参数);
创建(“SimpleBlob”);
blobDetector.detect(src,keyPoints);//问题出现在这一行

对于(int i=0;i,首先尝试C++或C样式。你既混合又不太好。< /P>
cvConvertScale
Mat
IplImage
等。如果可能,请仅使用
cv::Mat
,并且仅使用
cv:
功能


你有什么消息错误?

谢谢你的回答@Alexandre Bizeau,我知道我混合了不同版本的opencv函数,但我无法更改。当代码到达我之前标记的那一行时,我遇到的问题是内存问题。这是opencv断言失败?内存冲突?内存泄漏?这是我得到的错误OnLyPixVooSeEnMur.EXE中的0x75 43C41F中的异常异常:微软C++异常:CV::内存位置0x00 13DA54例外。我可以知道关键点的细节吗?它声明为成员变量吗?