Skip to content

Commit

Permalink
fix:添加初始化方法,以避免报错未初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
Sallee1 committed Jun 1, 2023
1 parent ab14857 commit 1af582b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions cvAutoTrack/src/AutoTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,7 @@ bool AutoTrack::GetPosition(double& x, double& y)
}
if (!genshin_minimap.is_init_finish)
{
err = { 1, "没有初始化" };
return false;
init();
}
if (getMiniMapRefMat()==false)
{
Expand Down Expand Up @@ -640,11 +639,14 @@ bool AutoTrack::GetUID(int& uid)

bool AutoTrack::GetAllInfo(double& x, double& y, int& mapId, double& a, double& r, int& uid)
{
if (!genshin_minimap.is_init_finish)
if (workflow_for_begin->run() == false)
{
err = { 1, "没有初始化" };
return false;
}
if (!genshin_minimap.is_init_finish)
{
init();
}
if (getMiniMapRefMat() == false)
{
//err = { 1001, "获取所有信息时,没有识别到paimon" };
Expand Down Expand Up @@ -874,17 +876,19 @@ bool AutoTrack::getMiniMapRefMat()
}

#ifdef _DEBUG
cv::Mat gi_map = Resources::getInstance().MapTemplate;
Resources* resource = &Resources::getInstance();
inline void AutoTrack::showMatchResult(float x, float y, int mapId, float angle, float rotate)
{
cv::Point2d pos(x, y);
//转换到绝对坐标
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);
//绘制扇形

//在图中显示坐标信息
Expand Down

0 comments on commit 1af582b

Please sign in to comment.