Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Convert 3 channel Mat into 4 channel doesn't work?

I'm building a VideoMixer class that can take a 3Channel and 4Channel(has alpha) and overlays the 4Channel onto the 3Channel matrix, then converts these back into a 3Channel matrix for further processing.

The idea is that I don't need the alpha channel in the rest of the program so I'm not going to pass that around.

To convert my 3channel passedFrame (input) into my 4channel temporary frame (for mixing) I'm using Mat tempFrame = Mat::zeros(overlayFrame.size(), 30); passedFrame.convertTo(tempFrame,30,1,1);

Where 30 is the enum value of "CV_64FC4", 1 is Alpha (toggling doesn't change anything) and the other 1 is Beta

I'm printing the sizes and types of each frame and my output however is as follows: - Size of overlay is [704 x 576] and type is 30 - Size of passedframe is [704 x 576] and type is 16 - Size of temporaryframe is [704 x 576] and type is 22

When explicitly setting the conversion type to 30, why is my output type 22? (that 8 should be the alpha channel and seems to be ignored)