如何使用ColorMatrix工具反转图像的颜色?

时间:2011-02-18 10:01:22

标签: colors inversion colormatrix

我必须在Matrix中添加什么值?

Dim clMatriz As Imaging.ColorMatrix = New Imaging.ColorMatrix(New Single()() _
{New Single() {¿?, 0, 0, 0, 0}, _
 New Single() {0, ¿?, 0, 0, 0}, _
 New Single() {0, 0, ¿?, 0, 0}, _
 New Single() {0, 0, 0, ¿?, 0}, _
 New Single() {0, 0, 0, 0, ¿?})

1 个答案:

答案 0 :(得分:1)

虽然我不确定您的颜色矩阵的特定版本是如何工作的,如果您的像素值在0-255或0-1范围内,这里应该如何工作:

如果你的像素范围是0-255:

Dim clMatriz As Imaging.ColorMatrix = New Imaging.ColorMatrix(New Single()() _ {New Single() {-1, 0, 0, 0, 255}, _ New Single() {0, -1, 0, 0, 255}, _ New Single() {0, 0, -1, 0, 255}, _ New Single() {0, 0, 0, 1, 0}, _ New Single() {0, 0, 0, 0, 1})

如果是0-1:

Dim clMatriz As Imaging.ColorMatrix = New Imaging.ColorMatrix(New Single()() _ {New Single() {-1, 0, 0, 0, 1}, _ New Single() {0, -1, 0, 0, 1}, _ New Single() {0, 0, -1, 0, 1}, _ New Single() {0, 0, 0, 1, 0}, _ New Single() {0, 0, 0, 0, 1})