【发布时间】:2014-10-02 08:49:13
【问题描述】:
我使用来自this question的公式:
uint8_t *rgbBuffer = malloc(imageWidth * imageHeight * 3);
// .. iterate over height and width
// from ITU-R BT.601, rounded to integers
rgbOutput[0] = (298 * (y - 16) + 409 * cr - 223) >> 8;
rgbOutput[1] = (298 * (y - 16) + 100 * cb + 208 * cr + 136) >> 8;
rgbOutput[2] = (298 * (y - 16) + 516 * cb - 277) >> 8;
我假设基于ITU-R_BT.601 formula in the wiki article。
但我认为公式不太正确,因为输出图像如下所示:
如何修正公式?
【问题讨论】:
-
会不会是整数上溢/下溢问题?
-
你的数组是什么类型的?
-
@FiddlingBits - 字节数组
uint8_t *rgbBuffer = malloc(imageWidth * imageHeight * 3);将添加到问题中。 -
+1 对问题的精彩介绍,引用了另一个问题的代码,尤其是显示问题所在的图像。
标签: ios c image image-processing colors