How can I create a grayscale image in c++? Image size 100x100. I know that in python this can be done using numpy. The best option would be if this image looks like a scale of 10 colors from white to black. I work in Vivado HLS, so I can only use one-dimensional arrays
I think I've looked all over the internet looking for a solution, which is why I'm here. I suppose I need to create an array, which then needs to be converted to Mat.But how to do it?
The following code generates a grayscale image which contains 10 different shades of grey. The approach taken is to create a view on the part of the original image and colorise it with the computed next shade of grey. The width of the view is equal to the width of the image divided by the number of colors, and the height is unchanged.
CMakeLists.txt:
Building (assuming these files are saved in a
~/grayscale/directory:Result: