挨个像素的比较的话,容差是如何计算的呢?是RGB分别比较么?

解决方案 »

  1.   

    好像是的。具体的你可以到photoshop中试一下。
      

  2.   

    哦,你是说RGB分别.  在GDI里有一个DOWRD 的 typedef 叫COLORREF 
    When specifying an explicit RGB color, the COLORREF value has the following hexadecimal form: 0x00bbggrr 
    The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF. 他的四字节是这样表示一种颜色的.  首字节为0x00,之后为蓝,绿,红.
    这样的一个DOWRD数值.  我觉得从这个数值出发来计算容差比较合理. 但容差程序需要你去测试.
      

  3.   

    请到网上看一下“种子填充算法”,比较简单的描述,是图像处理的基本内容。
    容差的计算方式,可以直接用R,G,B,也可以用转化到其他域的,比如HSL等。
    但一般RGB域就够了。你可以直接简单的(R-R0)<iT && (B-B0)<iT && (G-G0)<iT
    R0,G0,B0代表种子点的RGB值,iT代表你设计的范围。
      

  4.   

    光线追踪等算法在反走样渲染的时候会用到容差算法,一般是取RGB三个分量中的最大差值的绝对值作为容差结果。