颜色减法 [英] Color subtraction
问题描述
除了彩色外,我有两个看起来相同的位图。是否有一种简单的减去的方法一个位图的颜色,逐个像素,所以
只剩下颜色的差异。例如,如果我在点(50,75)处取一个
像素,并且发现颜色分别是FF00FF和FF0000
,有没有办法确定剩余的颜色是
0000FF?
提前致谢!
祝福
Paul
-
http:/ /www.paullee.com
Hi,
I have two bitmaps that look the same, except in color. Is there a
simple way to "subtract" the color of one bitmap, pixel by pixel so
that only the difference in colour remains. For instance, if I take a
pixel at point (50,75), and find that the colours are FF00FF and FF0000
respectively, is there a way to determine that the residual colour is
0000FF ?
Thanks in advance!
Best wishes
Paul
--
http://www.paullee.com
推荐答案
在位图之间执行XOR应该
给你差异。
Performing an XOR between the bitmaps should
give you the difference.
所以类似于:
Bitmap3 .SetPixel(50,75,
Bitmap1.GetPixel(50,75)^ Bitmap2.GetPixel(50,75));
如果我想要在第三个
位图中设置像素颜色等于这个差异?
So, something like:
Bitmap3.SetPixel(50,75,
Bitmap1.GetPixel(50,75)^Bitmap2.GetPixel(50,75));
if I wanted to set the pixel color equal to this difference in a third
bitmap?
pa ** @ paullee.com 写道:
我有除了颜色外,两个看起来相同的位图。是否有一种简单的方法来减去一个位图的颜色,逐个像素,所以只剩下颜色的差异。例如,如果我在点(50,75)处取一个
像素,并且发现颜色分别为FF00FF和FF0000,有没有办法确定残留的颜色是什么? 0000FF?
Hi,
I have two bitmaps that look the same, except in color. Is there a
simple way to "subtract" the color of one bitmap, pixel by pixel so
that only the difference in colour remains. For instance, if I take a
pixel at point (50,75), and find that the colours are FF00FF and FF0000
respectively, is there a way to determine that the residual colour is
0000FF ?
目前尚不清楚两种颜色之间的区别是否可以用第三种颜色来表示
,但哟你想尝试一下
组件的绝对差异。也就是说,提取每个输入颜色的RGB分量
,找出差值r1-r2,g1-g2,b1-b2
(忽略符号),并使用那些构造输出颜色。不确定
输出的效果如何 - 亮度之间的区别是明亮的
红色FF0000和橙色FF8000最好用深绿色代表
008000?我想这是你的应用程序:)
-
Larry Lard
回复团体请
It''s not immediately clear that the difference between two colours can
be usefully represented by a third colour, but yo umight like to try a
component-wise absolute difference. That is, extract the RGB components
of each input colour, find the differences r1-r2, g1-g2, b1-b2
(ignoring sign), and use those to construct the output colour. Not sure
how useful the output will be though - is the difference between bright
red FF0000 and orange FF8000 really best represented by deep green
008000? I guess it''s your application :)
--
Larry Lard
Replies to group please
这篇关于颜色减法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!