asmrobot
2019-11-21 589ed88a5924a7494e21b95b6bbff5e46ff49ddd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using Emgu.CV;
using Emgu.CV.Structure;
using RichCreator.Utility.Structs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace RichCreator.Utility.CV
{
    public class KaleteCVHelper
    {
        /// <summary>
        /// 卡勒特难度,1¬5级
        /// </summary>
        private static ColorArray[] KaleteNandu = new ColorArray[] {
            ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1579,344,102,0,170$1557,344,255,255,255$1567,344,0,102,170$1590,344,160,0,136$1600,344,170,0,17"),
            ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1579,344,102,0,170$1557,344,102,170,0$1568,344,255,255,255$1590,344,160,0,136$1601,344,170,0,17"),
            ColorArray.FromHsvFloatString(0.002f,0.002f,0.002f,"1579,344,255,255,255$1557,344,102,170,0$1568,344,0,102,170$1590,344,160,0,136$1601,344,170,0,17"),
            ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1568,344,0,102,170$1557,344,102,170,0$1579,344,102,0,170$1590,344,255,255,255$1601,344,170,0,17"),
            ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1590,344,160,0,136$1557,344,102,170,0$1568,344,0,102,170$1579,344,102,0,170$1601,344,255,255,255")
        };
 
 
 
        /// <summary>
        /// 查找凛冬难度
        /// </summary>
        /// <param name="choiceNandu"></param>
        /// <param name="image"></param>
        /// <param name="gameRect"></param>
        /// <returns></returns>
        public static bool GetChoiceKaleteNandu(out Int32 choiceNandu, Image<Rgb, byte> image, ZTRectangle gameRect)
        {
            ZTRectangle limit = new ZTRectangle(gameRect.Start.X + 533, gameRect.Start.Y + 171, gameRect.Start.X + 607, gameRect.Start.Y + 193);
            ZTRectangle position = ZTRectangle.Empty;
            for (int i = 0; i < KaleteNandu.Length; i++)
            {
                if (CVHelper.FindColorArray(out position, image, KaleteNandu[i], limit))
                {
                    choiceNandu = i + 1;
                    return true;
                }
            }
            choiceNandu = 0;
            return false;
        }
 
 
        public static ColorArray KaleteTopText = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.3f, "1119,8,204,193,167$1102,8,0,0,0$1103,8,204,193,167$1104,8,0,0,0$1112,8,0,0,0$1113,8,204,193,167$1114,8,0,0,0$1115,8,204,193,167$1116,8,0,0,0$1118,8,0,0,0$1120,8,0,0,0$1124,8,0,0,0$1125,8,204,193,167$1126,8,0,0,0$1129,8,0,0,0$1130,8,204,193,167$1131,8,0,0,0$1137,8,0,0,0$1138,8,204,193,167$1139,8,0,0,0$1146,8,0,0,0$1147,8,204,193,167$1148,8,0,0,0$1156,19,0,0,0$1155,19,204,193,167$1154,19,204,193,167$1153,19,0,0,0$1151,19,0,0,0$1150,19,204,193,167$1149,19,0,0,0$1148,19,204,193,167$1147,19,0,0,0$1145,19,0,0,0$1144,19,204,193,167$1141,19,204,193,167$1140,19,204,193,167$1139,19,204,193,167$1138,19,0,0,0$1136,19,0,0,0$1135,19,204,193,167$1134,19,0,0,0$1132,19,0,0,0$1131,19,204,193,167$1129,19,204,193,167$1128,19,0,0,0$1126,19,0,0,0$1125,19,204,193,167$1124,19,0,0,0$1121,19,0,0,0$1120,19,204,193,167$1119,19,204,193,167$1118,19,0,0,0$1117,19,204,193,167$1116,19,0,0,0$1114,19,204,193,167$1113,19,0,0,0$1104,19,0,0,0$1103,19,204,193,167$1102,19,0,0,0$1114,9,204,193,167$1114,10,0,0,0$1114,12,204,193,167$1114,13,204,193,167$1114,14,204,193,167$1114,15,204,193,167$1114,16,204,193,167$1114,17,204,193,167$1114,18,204,193,167$1114,19,204,193,167$1130,20,0,0,0$1130,18,0,0,0$1129,18,0,0,0$1129,17,204,193,167$1129,16,0,0,0$1129,14,204,193,167$1129,13,0,0,0$1129,12,204,193,167$1129,11,0,0,0$1129,10,204,193,167$1129,9,0,0,0");
        /// <summary>
        /// 房间上是否存在卡勒特之初的文字
        /// </summary>
        /// <param name="image"></param>
        /// <param name="gameRect"></param>
        /// <returns></returns>
        public static bool ExistKaleteText(Image<Rgb, byte> image, ZTRectangle gameRect)
        {
            ZTRectangle limit = new ZTRectangle(gameRect.End.X - 200, gameRect.Start.Y, gameRect.End.X, gameRect.Start.Y + 40);
            ZTRectangle position = ZTRectangle.Empty;
            return CVHelper.FindColorArray(out position, image, KaleteTopText, limit);
        }
 
 
 
    }
}