在OpenCV 2.4.10中,我要将行矩阵转换为矩阵12x12:
//Extraction SIFT
SiftDescriptorExtractor extractor;
Mat descriptors_1, descriptors_2;
extractor.compute( img_1, keypoints_1, descriptors_1);
extractor.compute( img_2, keypoints_2, descriptors_2);
Mat matrix(12,12, CV_8UC3, Scalar(0));
int j = 0;
for (int x = 0; x<12; x++)
{
for (int y = 0; y<12; y++)
{
matrix [x][y] = descriptors_2[x][j];
j++
}
}
第67行
no match for ‘operator[]’ (operand types are ‘cv::Mat’ and ‘int’)
上的错误。谁能帮我?谢谢。
最佳答案
试试这个也许会有所帮助;
Vec3f intensity = descriptors_2.at<Vec3f>(j, i);
matrix.at<unsigned char>(j,i)[0] = internsity.val[0];
matrix.at<unsigned char>(j,i)[1] = internsity.val[1];
matrix.at<unsigned char>(j,i)[2] = internsity.val[2];
关于c++ - OpenCV帮助-错误: no match for ‘operator[]’ (operand types are ‘cv::Mat’ and ‘int’ ),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40676556/