What's the best way to create a 3-channel grayscale from BGR?
Hi,
I'm trying to implement a generic algorithm that works with images in fourier space. Grayscale images are normally mxn while bgr/rgb are mxnx3 for each of the color channels. I've tried calling cvtColor in python with dstCn=3, but this still produces a mxn matrix. Is there an opencv/pythonic way to create an mxnx3 grayscale matrix from bgr format?
Thanks
First, you must understand that a MxNx3 in greyscale doesn't exist. I mean, the concept of greyscale is that you have one channel describing the intensity on a gradual scale between black and white. So, it is not clear why would you need a 3 channels greyscale image, but if you do, I suggest that you take the value of each pixel of your 1 channel greyscale image and that you copy it three times, one on each channel of a BGR image. When a BGR image has the same value on each channel, it appears to be grey. I don't program in Python so I can't provide a direct code...
Thanks. That was the answer I was looking for. I'm just trying to make some image code compatible with n-dimensional matrices, as odd as that might seem.