Color image to grayscale image conversion using OpenCV with C++

Resolution: Group | Duration: Two to four hours



To make student learn how is the structure of color and grayscale image and how to transform color image to grayscale image.

Learning Objectives

By the end of this activity, students will be able to: • Install tools such as codeblocks and opencv library • Convert color image to grayscale image by using difference methods • See the difference structure of they to image types • Understand the process of conversion and methods • See the difference output image by using difference methods


Color to grayscale image transformation is used when the storage size is concern and the analysis process is needed. Grayscale image is better to use in analysis step because it has less information then color image. There are many ways to convert from color to grayscale image, but the results are differences like summation of all three colors together and divided by 3 is brighter than using the formula of coefficient to each color then sum together. The structure of theses two image type also differences, students need to create new image that has only 1 channel to store new image as grayscale image. They cannot just modify the original color image to grayscale image directly.