Check out example codes for "how to change colour image to grey in opencv c++". It will help you in understanding the concepts better.

Code Example 1

//change the color image to grayscale image
cvtColor(image, image, COLOR_BGR2GRAY);

Learn ReactJs, React Native from akashmittal.com