2016-11-03 11 views
-2

私はこのコード(source)を使用して、opencvの基本的な行列を探したいと思っています。ベクトルを使用する方法<Point2f>をC++で

int point_count = 100; 
    vector<Point2f> points1(point_count); 
    vector<Point2f> points2(point_count); 

    // initialize the points here ... */ 
    for(int i = 0; i < point_count; i++) 
    { 
     points1[i] = ...; 
     points2[i] = ...; 
    } 

    Mat fundamental_matrix = 
    findFundamentalMat(points1, points2, FM_RANSAC, 3, 0.99); 

しかし、forループでpoints1、points2をどのように初期化するかわかりません。 私が使用して試してみました:

points1[i] = 10.0; 
points1[i] = (10.0, 20.0); 
points1[i] = {10.0, 20.0}; 

をそれらのすべてでこの

no match for ‘operator=’ (operand types are ‘cv::Point_<float>’ and ‘double’) 

のようなエラーを取得。

+0

'cv :: Point_'のドキュメントを見ましたか? – Kevin

+0

@kevin質問を編集してください。 – Rahul

+0

@RahulKSinghあなたの編集は以前のすべての回答を無効にしました。新しい質問をする必要があります。 –

答えて

0

彼らは次のように初期化する必要があります。

points[i] = Point2f(0.3f, 0.f); 

チェックOpenCVのdocumentation

+0

私はあなたのソリューションを試して、ポイント[i] = Point2f(0.3f、0.f)でエラーが発生しないようにしました。 (Cv :: _ InputArray const&、cv :: _ InputArray const&、int、double、double、cv :: _ OutputArray const&) 'への未定義の参照 – Rahul

+0

これはリンクエラーです。関数 'cv :: findFundamentalMat'の実装にリンクしていません。 –

+0

でも同じエラーが発生する – Rahul

関連する問題