mirror of
https://github.com/babalae/better-genshin-impact
synced 2025-01-08 11:57:53 +08:00
update map data to 5.0
This commit is contained in:
parent
bfddb53fa0
commit
36da78cb78
@ -4,7 +4,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="Test"
|
||||
Width="120"
|
||||
Width="240"
|
||||
Height="450"
|
||||
mc:Ignorable="d">
|
||||
<Canvas>
|
||||
@ -62,5 +62,11 @@
|
||||
Height="23"
|
||||
Click="MapPathView"
|
||||
Content="路线地图查看" />
|
||||
<Button Canvas.Left="120"
|
||||
Canvas.Top="10"
|
||||
Width="100"
|
||||
Height="23"
|
||||
Click="ZoomOut"
|
||||
Content="缩小地图到256" HorizontalAlignment="Left" VerticalAlignment="Center" />
|
||||
</Canvas>
|
||||
</Window>
|
@ -48,8 +48,8 @@ public partial class MainWindow : Window
|
||||
private void DoMatchTest(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
// KeyPointMatchTest.Test();
|
||||
EntireMapTest.Test();
|
||||
// EntireMapTest.Storage();
|
||||
// EntireMapTest.Test();
|
||||
EntireMapTest.Storage();
|
||||
// BigMapMatchTest.Test();
|
||||
|
||||
// FeatureTransfer.Transfer();
|
||||
@ -74,4 +74,9 @@ public partial class MainWindow : Window
|
||||
{
|
||||
MapPathTest.Test();
|
||||
}
|
||||
|
||||
private void ZoomOut(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ScaleTest.ZoomOutTest();
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class MapPuzzle
|
||||
|
||||
public static void Put()
|
||||
{
|
||||
string folderPath = @"E:\HuiTask\更好的原神\地图匹配\UI_Map"; // 图片文件夹路径
|
||||
string folderPath = @"E:\HuiTask\更好的原神\地图匹配\UI_Map_5.0"; // 图片文件夹路径
|
||||
string pattern = @"UI_MapBack_([-+]?\d+)_([-+]?\d+)(.*)";
|
||||
var images = Directory.GetFiles(folderPath, "*.png", SearchOption.TopDirectoryOnly); // 获取所有图片文件路径
|
||||
|
||||
@ -158,7 +158,7 @@ public class MapPuzzle
|
||||
}
|
||||
|
||||
// 保存大图
|
||||
Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\map_46_2048.png", largeImage);
|
||||
Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\map_50_2048.png", largeImage);
|
||||
// Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\combined_image_sd4x.png", largeImage.Resize(new Size(largeImage.Width / 4, largeImage.Height / 4), 0, 0, InterpolationFlags.Cubic));
|
||||
// Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\combined_image_small.png", largeImage.Resize(new Size(1400, 1300), 0, 0, InterpolationFlags.Cubic));
|
||||
|
||||
|
16
BetterGenshinImpact.Test/Simple/ScaleTest.cs
Normal file
16
BetterGenshinImpact.Test/Simple/ScaleTest.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.Test.Simple;
|
||||
|
||||
public class ScaleTest
|
||||
{
|
||||
public static void ZoomOutTest()
|
||||
{
|
||||
var mainMap2048BlockMat = new Mat(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\5.0\mainMap2048Block.png", ImreadModes.Grayscale);
|
||||
// 缩小 2048/256 = 8 倍
|
||||
var targetFilePath = @"E:\HuiTask\更好的原神\地图匹配\有用的素材\5.0\mainMap256Block.png";
|
||||
// opencv 缩小
|
||||
var mainMap256BlockMat = mainMap2048BlockMat.Resize(new Size(mainMap2048BlockMat.Width / 8, mainMap2048BlockMat.Height / 8));
|
||||
mainMap256BlockMat.SaveImage(targetFilePath);
|
||||
}
|
||||
}
|
@ -13,22 +13,22 @@ internal class MapPathTest
|
||||
{
|
||||
public static void Test()
|
||||
{
|
||||
var wayJson = File.ReadAllText(Global.Absolute(@"log\way\yl3.json"));
|
||||
var way = JsonSerializer.Deserialize<GiPath>(wayJson, ConfigService.JsonOptions) ?? throw new Exception("way json deserialize failed");
|
||||
|
||||
var points = way.WayPointList.Select(giPathPoint => giPathPoint.MatchRect.GetCenterPoint()).ToList();
|
||||
|
||||
var pointsRect = Cv2.BoundingRect(points);
|
||||
var allMap = new Mat(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\mainMap2048Block.png");
|
||||
|
||||
// 按顺序连线,每个点都画圈
|
||||
for (var i = 0; i < points.Count - 1; i++)
|
||||
{
|
||||
Cv2.Line(allMap, points[i], points[i + 1], Scalar.Red, 1);
|
||||
Cv2.Circle(allMap, points[i], 3, Scalar.Red, -1);
|
||||
}
|
||||
|
||||
var map = allMap[new Rect(pointsRect.X - 100, pointsRect.Y - 100, pointsRect.Width + 200, pointsRect.Height + 200)];
|
||||
Cv2.ImShow("map", map);
|
||||
// var wayJson = File.ReadAllText(Global.Absolute(@"log\way\yl3.json"));
|
||||
// var way = JsonSerializer.Deserialize<GiPath>(wayJson, ConfigService.JsonOptions) ?? throw new Exception("way json deserialize failed");
|
||||
//
|
||||
// var points = way.WayPointList.Select(giPathPoint => giPathPoint.MatchRect.GetCenterPoint()).ToList();
|
||||
//
|
||||
// var pointsRect = Cv2.BoundingRect(points);
|
||||
// var allMap = new Mat(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\mainMap2048Block.png");
|
||||
//
|
||||
// // 按顺序连线,每个点都画圈
|
||||
// for (var i = 0; i < points.Count - 1; i++)
|
||||
// {
|
||||
// Cv2.Line(allMap, points[i], points[i + 1], Scalar.Red, 1);
|
||||
// Cv2.Circle(allMap, points[i], 3, Scalar.Red, -1);
|
||||
// }
|
||||
//
|
||||
// var map = allMap[new Rect(pointsRect.X - 100, pointsRect.Y - 100, pointsRect.Width + 200, pointsRect.Height + 200)];
|
||||
// Cv2.ImShow("map", map);
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.7 MiB |
@ -12,7 +12,7 @@ namespace BetterGenshinImpact.GameTask.Common.Element.Assets;
|
||||
|
||||
public class MapAssets : BaseAssets<MapAssets>
|
||||
{
|
||||
public Lazy<Mat> MainMap2048BlockMat { get; } = new(() => new Mat(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\mainMap2048Block.png", ImreadModes.Grayscale));
|
||||
public Lazy<Mat> MainMap2048BlockMat { get; } = new(() => new Mat(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\5.0\mainMap2048Block.png", ImreadModes.Grayscale));
|
||||
|
||||
public Lazy<Mat> MainMap256BlockMat { get; } = new(() => new Mat(Global.Absolute(@"Assets\Map\mainMap256Block.png"), ImreadModes.Grayscale));
|
||||
|
||||
|
@ -11,10 +11,15 @@ namespace BetterGenshinImpact.GameTask.Common.Map;
|
||||
/// </summary>
|
||||
public class MapCoordinate
|
||||
{
|
||||
#region 每次地图扩大都要更新的参数
|
||||
|
||||
public static readonly int GameMapRows = 13; // 游戏坐标下地图块的行数
|
||||
public static readonly int GameMapCols = 14; // 游戏坐标下地图块的列数
|
||||
public static readonly int GameMapCols = 16; // 游戏坐标下地图块的列数
|
||||
public static readonly int GameMapUpRows = 5; // 游戏坐标下 左上角离地图原点的行数
|
||||
public static readonly int GameMapLeftCols = 7; // 游戏坐标下 左上角离地图原点的列数
|
||||
public static readonly int GameMapLeftCols = 9; // 游戏坐标下 左上角离地图原点的列数
|
||||
|
||||
#endregion 每次地图扩大都要更新的参数
|
||||
|
||||
public static readonly int GameMapBlockWidth = 1024; // 游戏地图块的长宽
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user