This is a simple go project that applies different filters like grayscale or B&W to an image.
There are several filters you can apply to an image. Here is a start.
The grayscale filter using the weighted coefficients
$ go run main.go ./examples/winxp.png grayscale-coeff
The grayscale filter using the average value of the three channels ((R)ed, (G)reen and (B)lue)
$ go run main.go ./examples/winxp.png grayscale-avg
The black&white filter
$ go run main.go ./examples/winxp.png bw
-
Grayscales
- averaging the RGB components
- weighted sum of the RGB components
Y = 0.299 * R + 0.587 * G + 0.114 * B
-
Black & White
Original image
Grayscale using the weighted sum method
Grayscale using the averaging method
Black & White filter