rui130129
rui130129
2017-03-24 06:49

不存在从"int"转换到"std::vector<cv::Mat,>>"的适当构造函数

  • 图片

void Cut_img(Mat src_img, int m, int n, vector ceil_img)
{
int t = m * n;
int height = src_img.rows;
int width = src_img.cols;

int ceil_height = height / m;
int ceil_width = width / n;

Mat roi_img, tmp_img;

Point p1, p2;
for (int i = 0; i<m; i++)
    for (int j = 0; j<n; j++) {
        //p1 = 
        Rect rect(i + j*ceil_width, j + i*ceil_height, ceil_width, ceil_height);

        src_img(rect).copyTo(roi_img);

        ceil_img.push_back(roi_img);
        imshow("roi_img", roi_img);
        //getchar();
        waitKey(0);
        //rectangle(i+j*ceil_width,j+i*ceil_height,);
    }

}

void show_images(vector imgs, int n) {

//do something

}

int _tmain(int argc, _TCHAR* argv[])
{
Mat img = imread("dog.jpg", 1);
imshow("src img", img);
int m = 3;
int n = 3;
vector ceil_img = m*n;

Cut_img(img, m, n, ceil_img);

waitKey();
return 0;

}
整个代码是图片剪切的代码,问题出现在倒数第三行代码,cut_img(img,m,n,ceil_img);
错误为:不存在从"int"转换到"std::vectorcv::Mat,std::allocator<cv::Mat>"的适当构造函数

还有错误C2440:"初始化":无法从“int”转换为"std::vectorcv::Mat,std::allocator<_Ty>"

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

4条回答

为你推荐