由于橙色偏差(http://photo.net/learn/orange-negative-mask),如果我简单地说redPositive = 255 – rednegative我得到一个具有强烈青色色调的最终图像,并且非常褪色.这意味着这里给出的答案:Convert negative image to positive不正确.
那么我将如何制作以下例程:
struct RGB{ unsigned byte red; unsigned byte green; unsigned byte blue;};voID FilmNegativetoPositive(RGB const &negative,RGB &positive){ // What goes here?}解决方法 我没有要测试的数据,但根据你提供的链接,负片是青色,品红色和黄色染料的混合物,它们是不纯的:
The yellow dye layer is the most pure. The magenta dye layer has a noticeable amount of yellow in it. The cyan dye layer has noticeable amounts of both yellow and magenta in it.
因此,你想做这样的事情(未经测试的伪代码):
Let I_MY be the ratio of yellow impurity to pure magenta dyeLet I_CY be the ratio of yellow impurity to pure cyan dyeLet I_CM be the ratio of magenta impurity to pure cyan dyeGiven R,G,B in [0,255]Convert to CMY: C = 1.0 - R/255.0 M1 = 1.0 - G/255.0 Y1 = 1.0 - B/255.0Calculate the impuritIEs in the cyan dye and remove them,since we assume no other dye has cyan impuritIEs: M = M1 - I_CM×C Y2 = Y1 - I_CY×CNow the amount of magenta dye is correct,so subtract its yellow impurity: Y = Y2 - I_MY×MConvert the corrected CMY values back to RGB: R' = 255×(1.0-C) G' = 255×(1.0-M) B' = 255×(1.0-Y)
如果事实证明那里的污染比那更复杂,那么就会出现线性代数问题:
[ 1 I_MC I_YC] [C'] [C][I_CM 1 I_YM] × [M'] = [M][I_CY I_MY 1] [Y'] [Y]
在想要求解C’,M’和Y’的位置,然后转换回RGB色彩空间.
总结以上是内存溢出为你收集整理的c – 将胶片负RGB转换为正RGB的算法全部内容,希望文章能够帮你解决c – 将胶片负RGB转换为正RGB的算法所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)