Ask Your Question

Possible to load a RGBA avi file with cvCaptureFromAVI ?

asked 2013-03-24 02:00:32 -0600

Poppy Petal gravatar image


I have been trying to load an avi file with RGBA using the cvCaptureFromAVI function, but each time it loses the alpha channel. It is a valid 8bit depth RGBA avi file (with a real value in alpha), but whenever I use cvQueryFrame the channels are reported as 3, and also the widthstep shows it to be only 3 bytes data (i.e. RGB). I have tried it with various codecs (huffyuv, lagraith, etc), and it decodes and plays perfectly, except that the alpha is lost.

Now I know that the LoadImage functionality in opencv does not support loading RGBA - but is it the same in cvCaptureFromAVI?

I only need to know 'in principle' if it can load RGBA, and I will continue to work it out - otherwise I need to know if I am chasing a dead duck.


edit retag flag offensive close merge delete


highly unlikely for video, but LoadImage("my.img",-1); might still work (-1 for "keep as is")

berak gravatar imageberak ( 2013-03-24 03:49:25 -0600 )edit

I'd also really like to be able to be able to read frames from a video file without losing the alpha channel.

morganpackard gravatar imagemorganpackard ( 2014-05-13 13:44:31 -0600 )edit

so go and implement it ;)

berak gravatar imageberak ( 2014-05-13 13:50:21 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-12 12:55:19 -0600

outputing image files with alpha works well for png and tiff.

Why is that we can't do the reverse?

I think this feature should be added for videwriter and videocapture. As a matter of fact I need it.


edit flag offensive delete link more


Nice remark, though this is not the sole feature request. If you are in need of it, why not go head on with the problem and try to implement it. Add a pull request once you have it and then everyone will be happy.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-12 16:24:43 -0600 )edit

Question Tools

1 follower


Asked: 2013-03-24 02:00:32 -0600

Seen: 761 times

Last updated: Apr 12 '13