错误 56 error C2665: “std::vector
错误 57 IntelliSense: 没有与参数列表匹配的构造函数 "std::vector<_Ty, _Alloc>::vector [其中 _Ty=edge, _Alloc=std::allocator
参数类型为: (int, int) f:\test\堆\OpenCV_MFC\OpenCV_MFC\OpenCV_MFCView.cpp 3432 47 OpenCV_MFC
struct edge{
//float w;
double weight_v[8] ;
int width = 0, high = 0, value = 0;
};
void COpenCV_MFCView::On_graph_cut_test()//以两个阈值把图像分割为三个区域
{
COpenCV_MFCDoc* pDoc = GetDocument();
CDC* pDC = GetDC();
int i, j, ii;
Mat srcImg = imread(pDoc->filePath, CV_LOAD_IMAGE_COLOR);//读取图像
cvtColor(srcImg, srcImg, CV_BGR2GRAY);//灰度化
MatShowImg(pDC, srcImg, srcImg.cols, 0);//显示灰度图
int width = srcImg.size().width;
int height = srcImg.size().height;
vector > graph_img(height, vector(width, 0));//点的结构图矩阵,积分图
vector model_line(width, 0);
}
这里有明显的初始化错误,结构体为edge,不能用0初始化,(例如:普通案例vector
struct edge{
//float w;
double weight_v[8];
int width = 0, high = 0, value = 0;
};
void COpenCV_MFCView::On_graph_cut_test()//以两个阈值把图像分割为三个区域
{
COpenCV_MFCDoc* pDoc = GetDocument();
CDC* pDC = GetDC();
int i, j, ii;
Mat srcImg = imread(pDoc->filePath, CV_LOAD_IMAGE_COLOR);//读取图像
cvtColor(srcImg, srcImg, CV_BGR2GRAY);//灰度化
MatShowImg(pDC, srcImg, srcImg.cols, 0);//显示灰度图
int width = srcImg.size().width;
int height = srcImg.size().height;
edge model_point;
model_point.weight_v[8] = { 0 };
model_point.width = 0;
model_point.high = 0;
model_point.value = 0;
vector > graph_img(height, vector(width, 0));//点的结构图矩阵,积分图
vector model_line(width, model_point);
}