[Closed] Dotnet Image manipulation?
So far this is working fairly well. So Pete I have used the grayScaleColorMatrix that you have and I also have a brightnessMatrix and I pass those into the function with the identity matrix and I appear to be getting a good result.
grayScaleColorMatrix=
#(
#(0.299, 0.299, 0.299, 0, 0),
#(0.587, 0.587, 0.587, 0, 0),
#(0.114, 0.114, 0.114, 0, 0),
#(0,0,0,1,0),
#(0,0,0,0,1)
)
brightnessMatrix=
#(
#(0,0,0,0,0),
#(0,0,0,0,0),
#(0,0,0,0,0),
#(0,0,0,1,0),
#(.001,.001,.001,0,1)
)
colorMatrix=
#(
#(1,0,0,0,0),
#(0,1,0,0,0),
#(0,0,1,0,0),
#(0,0,0,1,0),
#(0,0,0,0,1)
)
--This function transforms inMatrix to adjustmentMatrix by the amount.
fn applyColorMatrix amount inMatrix adjustmentMatrix=
(
outMatrix=deepCopy inMatrix
for r= 1 to 5 do
(
for c=1 to 5 do
(
dif=(inMatrix[r][c]-adjustmentMatrix[r][c])
outMatrix[r][c]+=dif*amount
)
)
outMatrix
)
m=applyColorMatrix -1 colorMatrix grayScaleColorMatrix
applyColorMatrix -.2 m brightnessMatrix
Hi Paul,
the saturation matrix i used is probably not as refined as what you need, but i got the info from here, a really useful site! –
Thanks Pete, interestingly enough what I have has worked quite well. I’ll look into what is being done on that site and see if it gets any different a result.
Hi Paul,
I’m pretty sure what you are doing is more advanced than the saturation matrix i used – As for PS’s method, I’d guess that like you, they are doing a few more geekery tweaks in their saturation method to avoid the strange results you were noticing.