MAT类型是相同的,但我获得的“推动向量类型与函数中的矩阵类型不同' push_back' &quot错误
我正在尝试重塑SIFT描述符矩阵,然后将其推回另一个矩阵,但我会收到此错误 pusthed向量类型与'push_back'push_back'中的矩阵类型不同。
这是我的代码:
Mat get_featuesunclustered( Mat input)
{
if(!input.data)
{
cout << "Image not found !!!" << endl << endl;
}
//To store the keypoints that will be extracted by SIFT
vector<KeyPoint> keypoints;
//To store the SIFT descriptor of current image
Mat descriptor;
//The SIFT feature extractor and descriptor
Ptr<SIFT> detector = SIFT::create();
//detect feature points and compute the descriptors for each keypoint
detector->detectAndCompute(input, noArray(), keypoints, descriptor);
if (descriptor.type() != CV_32F)
{
descriptor.convertTo(descriptor, CV_32F);
}
return descriptor;
}
int main(){
Mat dicodescriptor,labels, feats;
vector<Mat> dico; // dico contains images
for(size_t y = 0; y < dico.size(); y++)
{
dicodescriptor = get_featuesunclustered(dico[y]);
Mat f = dicodescriptor.reshape(dicodescriptor.rows * dicodescriptor.cols, 1);
feats.push_back(f);
}
}
我不知道我的代码有什么问题,有人可以帮忙吗?
I'm trying to reshape the sift descriptor matrix I get into one line and then push it back to another matrix but I get this error Pushed vector type is not the same as matrix type in function 'push_back'.
this is my code:
Mat get_featuesunclustered( Mat input)
{
if(!input.data)
{
cout << "Image not found !!!" << endl << endl;
}
//To store the keypoints that will be extracted by SIFT
vector<KeyPoint> keypoints;
//To store the SIFT descriptor of current image
Mat descriptor;
//The SIFT feature extractor and descriptor
Ptr<SIFT> detector = SIFT::create();
//detect feature points and compute the descriptors for each keypoint
detector->detectAndCompute(input, noArray(), keypoints, descriptor);
if (descriptor.type() != CV_32F)
{
descriptor.convertTo(descriptor, CV_32F);
}
return descriptor;
}
int main(){
Mat dicodescriptor,labels, feats;
vector<Mat> dico; // dico contains images
for(size_t y = 0; y < dico.size(); y++)
{
dicodescriptor = get_featuesunclustered(dico[y]);
Mat f = dicodescriptor.reshape(dicodescriptor.rows * dicodescriptor.cols, 1);
feats.push_back(f);
}
}
I don't know what wrong with my code, someone can help please ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论