C# 游戏卡价值识别使用Forge.NET给出错误结果
实际上,我正在使用C# 游戏卡价值识别使用Forge.NET给出错误结果,c#,image-processing,image-recognition,aforge,C#,Image Processing,Image Recognition,Aforge,实际上,我正在使用a org.NET从游戏卡中识别套装和值 下面是一个片段,我决定哪一个suit/value: public static CardTemplateIdentifier GetBestMatchingIdentifier(this List<CardTemplateIdentifier> templates, Bitmap bitmap) { float maxSimilar = 0f; CardTemplateIdentifier result =
a org.NET
从游戏卡中识别套装
和值
下面是一个片段,我决定哪一个suit/value
:
public static CardTemplateIdentifier GetBestMatchingIdentifier(this List<CardTemplateIdentifier> templates, Bitmap bitmap)
{
float maxSimilar = 0f;
CardTemplateIdentifier result = null;
foreach (var template in templates)
{
// Identify similarity between template and bmp
ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0);
TemplateMatch[] matchings = tm.ProcessImage(bitmap, template.Sample);
// If the currently tested template fits better than the best one so far,
// set the value as the identified card value
if (matchings.Length > 0 && matchings[0].Similarity > maxSimilar)
{
maxSimilar = matchings[0].Similarity;
result = template;
}
}
return result;
}
公共静态CardTemplateIdentifier GetBestMatchingIdentifier(此列表为模板、位图)
{
float maxsimular=0f;
CardTemplateIdentifier结果=空;
foreach(模板中的var模板)
{
//识别模板和bmp之间的相似性
ExtreatveTemplateMatching tm=新的ExtreatveTemplateMatching(0);
TemplateMatch[]matchings=tm.ProcessImage(位图,template.Sample);
//如果当前测试的模板比目前为止最好的模板更适合,
//将该值设置为已识别的卡值
if(matchings.Length>0&&matchings[0]。相似性>最大相似性)
{
maxSimilar=匹配[0]。相似性;
结果=模板;
}
}
返回结果;
}
CardTemplateIdentifier
包含一个包含所有可能的卡及其比较示例的列表
现在,如果试图识别图像,我不能依赖于可靠的识别:有时图像的缩放与我制作的样本不同。或者字体厚度变小,请参见下面的示例:
我想我用错误的方法来检测图像中的值。有没有更好或更方便的方法来解决这个问题