开发者

opencv get subimage in iphone

开发者 https://www.devze.com 2023-02-20 09:05 出处:网络
I am trying to get subimages with Opencv in iphone.What is th开发者_如何学编程e problem in this code?

I am trying to get subimages with Opencv in iphone.What is th开发者_如何学编程e problem in this code? error from console is: OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file /Users/macmade/Desktop/OpenCV-iPhone/OpenCV/build/iPhoneSimulator/../.././tmp/OpenCV-2.0.0/src/cxcore/cxarray.cpp, line 2470 terminate called after throwing an instance of 'cv::Exception'

std::vector<IplImage*> vec_images;
int h = bw->height;
for (int i=0; i<Xleft.size(); ++i) {

    CvRect rect = cvRect(Xleft[i], 0, avgx, h);
    /* dst image */
    IplImage* subimg;
    /* copy ROI to subimg */
    cvSetImageROI(bw, rect);
    cvCopy(bw, subimg, NULL);
    vec_images.push_back(subimg);
    cvResetImageROI(bw);
}
for (int i=0; vec_images.size(); ++i) {
    cvReleaseImage(&vec_images[i]);
}


You must initialize subimg before calling cvCopy.

0

精彩评论

暂无评论...
验证码 换一张
取 消