Convert image to grayscale image
The simple way is to compute the average of RGB colors values \begin{equation} \begin{aligned} r = \alpha r + \beta \\ g = \alpha g + \beta \\ b = \alpha b + \beta \\ \end{aligned} \end{equation}
code here