代码之家  ›  专栏  ›  技术社区  ›  anti

opencv,从一个描述符cv::Mat中获取一个描述符?

  •  0
  • anti  · 技术社区  · 7 年前

    我有一个opencv应用程序,需要在其中存储一个2d点的坐标,以及该点的特征描述符。

    例如,在运行以下代码之后:

    std::vector<KeyPoint> keypoints_1;
    Mat descriptors_1;
    Ptr<FeatureDetector> detector = ORB::create();
    Ptr<DescriptorExtractor> descriptor = ORB::create();
    
    detector->detect ( img_1,keypoints_1 );
    descriptor->compute ( img_1, keypoints_1, descriptors_1 );
    

    我明白了 descriptors_1 ,这是每个 Keypoint '

    我怎样才能得到对应的描述符,例如, keypoints_1[12] ,并将其作为垫子存储?

    无论是描述符1.rows还是描述符1.cols都没有与关键点数目相同的大小。

    1 回复  |  直到 7 年前
        1
  •  0
  •   Rasmus Debitsch    7 年前

    描述符->如果无法计算给定关键点的描述符,compute可能会从数组中移除关键点。调用compute之后,两个矩阵的行数应该相同。