Skip to content

Commit

Permalink
test:完成可视化调试功能
Browse files Browse the repository at this point in the history
  • Loading branch information
Sallee1 committed Jun 2, 2023
1 parent 54f5213 commit e2b229f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions cvAutoTrack/src/AutoTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,13 +883,23 @@ inline void AutoTrack::showMatchResult(float x, float y, int mapId, float angle,
//转换到绝对坐标
if (mapId == 0)
pos = TianLi::Utils::TransferAxes_inv(pos, user_world_center, user_world_scale);

//获取附近的地图
cv::Mat gi_map = resource->MapTemplate;
cv::Mat subMap = TianLi::Utils::get_some_map(gi_map, pos, 100);
//绘制箭头(没有素材就先用直线代替)
cv::Point2d center(subMap.size[1] / 2,subMap.size[0] / 2);
cv::Point2d direct(0, 0);
cv::Mat subMap = TianLi::Utils::get_some_map(gi_map, pos, 150).clone();

cv::Point2i center(subMap.size[1] / 2, subMap.size[0] / 2);

//绘制扇形
cv::Mat sectorMask = subMap.clone();
cv::ellipse(sectorMask, center, cv::Size2i(100, 100), -rotate - 135, 0, 90, cv::Scalar(255, 255, 255, 100), -1, cv::LINE_AA);
cv::addWeighted(subMap, 0.75, sectorMask,0.25,0,subMap);

//绘制玩家方向
cv::Point2i direct(0, 0);
direct.x = -(30 * sin((angle / 180.0) * _Pi)) + center.x;
direct.y = -(30 * cos((angle / 180.0) * _Pi)) + center.y;
cv::arrowedLine(subMap, center, direct, cv::Scalar(255, 255, 0), 5,cv::LINE_AA,0,0.5);

//在图中显示坐标信息
cv::imshow("Visual Debug", subMap);
Expand Down
2 changes: 1 addition & 1 deletion cvAutoTrack/src/version/version_tag.tag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.8.90
7.8.103

0 comments on commit e2b229f

Please sign in to comment.