How can I reverse the colors of an image with the tool ColorMatrix?
What values do I have to put in the Matrix?
Dim clMatriz As Imaging.ColorMatrix = New Imaging.ColorMatrix(New Single()() _
{New Single() {¿?, 0, 0, 0, 0}, _
New Single() {0, ¿?, 0, 0, 0}, _
开发者_JAVA百科 New Single() {0, 0, ¿?, 0, 0}, _
New Single() {0, 0, 0, ¿?, 0}, _
New Single() {0, 0, 0, 0, ¿?})
Though I am not exactly sure how that particular version of your color matrix works and if your pixel values are in the range 0-255 or 0-1 here's how it should work:
In case your pixel range is 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})
In case it is 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})
精彩评论