I need help figuring out how to convert an image to sepia. This is what I have so far..but it only changes everything to black and white colors with a very small tint of bro
Your gray level image is not a gray level image. In a gray level image all three channels r
,g
,b
have the same value.
Open paint and try it to verify if your code makes sense.
Fix these lines:
newR = (R * 0.393 + G * 0.769 + B * 0.189)
newG = (R * 0.349 + G * 0.686 + B * 0.168)
newB = (R * 0.272 + G * 0.534 + B * 0.131)
Simply use the mean of r
,g
,b
and put it into newR
, newG
and newG
.
There are some weighted means as well. Just Google for RGB to intensity formulas.