c# - 图像之间的平等c#
问题描述
我需要比较两张图片,看看它们是否相同。
图片仅包含文字。
我在硬盘上保存了一张图像,我需要查看它是否与我正在下载的图像相同。
我尝试使用此代码建立 5% 的误差范围,但我遇到的主要问题是图像文本可以在 0 到 30 度或 0 到 -30 度之间旋转
int width;
int height;
if (bmp1.width < bmp2.width)
{
width = bmp1.width;
}
else
{
width = bmp2.width;
}
if (bmp1.heigth < bmp2.width)
{
heigth = bmp1.heigth;
}
else
{
heigth = bmp2.heigth;
}
int contador = 0;
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
if (bmp1.GetPixel(x, y) == bmp2.GetPixel(x, y))
{
contador++
}
}
}
int similar_percent = (contador / (height * width) * 100);
我留下两个图像的小例子
解决方案
推荐阅读
- java - 布尔值是否自动装箱到同一个实例?
- spring-boot - 在 DefaultMessageListenerContainer 中配置 sessionAcknowledgeMode
- javascript - Chrome 扩展在网页中寻找资源,而不是扩展
- r - 当 reference_map = TRUE 时,Choroplethr 不会产生我可以看到的图形输出
- android - Android:使用个性化按键布局时布局不变
- ruby-on-rails - 电子邮件验证参数 - 测试中错误的参数数量 Michael Hartl Rails 教程
- python - Conda 中是否支持 Python 3.8?(我需要带窗口功能的 sqlite 3.25)
- c++ - C ++:在另一个函数中声明一个函数不是编译器错误所以......它是什么?
- swift - 如何在右侧绘制类似于所示图像的带有 ARC 的 UIBezierPath?
- c# - C# 使用预定义的排序数组对数组进行排序