RGB颜色立方体的转换 [英] Transformation of the RGB color cube

查看:155
本文介绍了RGB颜色立方体的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已经完成了主代码,但是在特殊情况下仍然存在问题.如果颜色值在边缘或角落.有人可以帮我吗?

Have already completed the main code, but still have problems with the special cases. If color value on edge or corner. Can someone help me there?

推荐答案

我假设您正在谈论色彩空间的转换.变换颜色空间的一种方法是颜色矩阵.参见 http://en.wikipedia.org/w/index.php?title=Color_matrix& ; redirect = no [ ^ ].

边缘和角落确实存在问题.

您应该了解,将非线性运算符应用于任何对象时,可能会丢失部分信息.如果发生这种情况,例如在各种截止滤波器中.例如,如果您尝试按振幅来切割正弦波,则由于滤波器的非线性而导致这种损耗的情况.好吧,相当偏僻的例子.更为接近的示例是:如果加亮图像,则可以是线性变换,但是如果过大,则具有不同颜色的部分像素将获得相同的颜色.例如,在每像素8位的灰度图像中,一些最初显示不同灰度阴影的像素将获得255的值.这意味着信息丢失,而字节的最大值就像一个特定的数字非线性滤波器.导致某些信息丢失.数字离散化提供了另一种模式微妙的非线性.例如,在大多数颜色转换中,图片中的色粒都会增强,例如,因为假定所计算的像素值应为128.32142309,但将其舍入为128.

你有照片吗?颜色空间,但其本质不是数学中所理解的线性空间.要成为线性空间,它必须是无限的.通过颜色值的离散化和值范围的限制将非线性引入数字单词.

您可以在这里获得色彩空间的概念: http://en.wikipedia.org/wiki/Color_space [ ^ ],另请参见 ^ ].

创建色彩空间来模拟人类的色彩感知(实际上是在不同的人中是独立的),并且不具有矩形/立方体形状.在计算机演示中,所有像素值都限制在某个颜色立方体中,并且立方体的边界呈现非线性.所有值都限制在0和2 8 -1到0或0和2 16 -1之间.在广域数码相机中,使用了大约12位(不确定所谓的"HDR"传感器,但实际上不是"HDR").这是完成颜色转换的方式:您将矩阵正式应用于像素值,并且当结果值超出上述范围时,它们只会被最大值或最小值所削减.就这么简单.

要查看它,请使用任何照片编辑器并执行强"色彩转换-图片的某些部分将烧毁".没什么.

—SA
I assume you are talking about transformation in color space. One of the ways to transform a color space is color matrix. See http://en.wikipedia.org/w/index.php?title=Color_matrix&redirect=no[^].

The edge and the corner really present a problem.

You should understand that when a non-linear operator is applied to anything, part of information can be lost. If happens, for example, in all kinds of cut-off filter. For example, if you try to cut sine wave by amplitude, this is the case of such loss due to non-linearity to the filter. Well, pretty remote example. More close example is this: if you brighten the image, it can be a linear transform, but if you overdo it, part of pixels with different colors gets the same color. For example, in 8-bits-per-pixel gray image some pixels initially showing different shades of gray will get the value of 255. It means the loss of information, and the maximum value of byte act like a specific digital non-linear filter causing loss of some information. Another mode subtle kind of non-linearity is presented by digital discretization. For example, color grain in the picture is boosted in most color transforms just because, for example, the calculated pixel value is supposed to be 128.32142309, but it is rounded to 128.

Are you getting the picture? The color space but its nature is not a linear space as it is understood in mathematics. To be a linear space it has to be infinite. The non-linearity is introduced in digital word by discretization of color values and limitation of the ranges of values.

You can get the idea of color space here: http://en.wikipedia.org/wiki/Color_space[^], see also http://en.wikipedia.org/wiki/Color_theory[^].

Color spaces are created to model human color perception (which is in fact individual in different people) and are not of rectangular/cubical shape. In computer presentation, all pixel values are confined in some color cube, and the boundary of the cube present non-linearity. All values are limited between 0 and 28−1 0 and or 0 and 216−1. In wide-gamut digital cameras some 12 bits are used (not sure about so called "HDR" sensors, but they are not actually "HDR"). Here is how color transformation is done: you formally apply the matrix to pixel values, and when the resulting values go beyond the said range, they are just cut by maximum or minimum value. As simple as that.

To see it, take any photo editor and perform "strong" color transform — some parts of the picture will "burn out". Nothing else.

—SA


这篇关于RGB颜色立方体的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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