如何比较2个HDC的取舍误差为1% [英] How to Compare 2 HDC with an error of 1% give or take

查看:60
本文介绍了如何比较2个HDC的取舍误差为1%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我很难在另一个HDC中搜索一个HDC.如果像素都相同,我就可以做到.
如何设置比较值,让我说1%的错误?
这是每个像素的比较逻辑部分:

Hello all,

I am having a hard time, searching one HDC within another HDC. I have been able to do it if the pixels are all the same.
How do I set the comparison to give me an error of lets say 1%?
Here is the the portion of the compare logic for each pixel:

for(int y = 0; y < Rect_To_Compare.bottom; ++y) {
    for(int x = 0; x < Rect_To_Compare.right; ++x) {
        COLORREF Color = ::GetPixel(DlgDC, (x + Rect_To_Compare.left), (y + Rect_To_Compare.top) );
        COLORREF ColorToCompare = ::GetPixel(BitmapDC,x,y);
        if(Color != ColorToCompare) {
            result = false;
        }
    }
}



任何帮助将不胜感激.



Any help would be greatly appreciated.

推荐答案

不要看到错误"结果(顺便说一句,没有什么意义)取决于每个HDC发现的像素?抛开这段代码的荒谬表现.因此,这个问题根本没有道理.

我真的非常希望您能理解这一点.

—SA
Don''t you see that the "error" result (which, by the way, makes very little sense) depends on the pixels found by each HDC?! Set aside ridiculous performance of this code. So, this question makes no sense at all.

I really, really hope you''re going to understand this.

—SA


这篇关于如何比较2个HDC的取舍误差为1%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆