2012-11-04 6 views
0

opencv MAT 이미지에 블록 화살표를 그려서이 코드를 작성했지만 작동하지만 내 질문은 이미지를 회전하는 더 쉬운 방법입니까? 세부 사항을 코드화해야합니까, 아니면 opencv에서 rotate transpose 또는 flip 메소드가 있습니까?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); 
} 

답변