0

opencv MAT画像にブロック矢印を描画するためにこのコードを書きましたが、機能しますが、私の質問は、画像を回転させる簡単な方法はありますか?それを詳細にコーディングする必要がありますか、それともopencvに回転転置または反転メソッドがありますか?

void Arrow( Mat img, int i ) 
    {  
  int lineType = 8;
  Point arrow_points[1][7];
if (i == 1) { //left  
  arrow_points[0][0] = Point( 90*mp, 60*mp );
  arrow_points[0][1] = Point( 90*mp, 40*mp );
  arrow_points[0][2] = Point( 50*mp, 40*mp );
  arrow_points[0][3] = Point( 50*mp, 30*mp );
  arrow_points[0][4] = Point( 10*mp, 50*mp );
  arrow_points[0][5] = Point( 50*mp, 70*mp );
  arrow_points[0][6] = Point( 50*mp, 60*mp );
};
if (i == 2) { //right 
  arrow_points[0][0] = Point( 20*mp, 60*mp );
  arrow_points[0][1] = Point( 20*mp, 40*mp );
  arrow_points[0][2] = Point( 60*mp, 40*mp );
  arrow_points[0][3] = Point( 60*mp, 30*mp );
  arrow_points[0][4] = Point( 100*mp, 50*mp );
  arrow_points[0][5] = Point( 60*mp, 70*mp );
  arrow_points[0][6] = Point( 60*mp, 60*mp );
};
if (i == 3) { //down
  arrow_points[0][0] = Point( 60*mp, 20*mp );
  arrow_points[0][1] = Point( 40*mp, 20*mp );
  arrow_points[0][2] = Point( 40*mp, 60*mp );
  arrow_points[0][3] = Point( 30*mp, 60*mp );
  arrow_points[0][4] = Point( 50*mp, 100*mp );
  arrow_points[0][5] = Point( 70*mp, 60*mp );
  arrow_points[0][6] = Point( 60*mp, 60*mp );
};
  const Point* ppt[1] = { arrow_points[0] };
  int npt[] = { 7 };
  fillPoly( img,
        ppt,
        npt,
           1,
      Scalar( 250, 0, 0 ),
    lineType );
}
4

1 に答える 1

0

回転はアフィン変換です。アフィン変換のドキュメントを確認してください。

http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/warp_affine/warp_affine.html

于 2012-11-04T18:14:34.213 に答える