开发者

opencv: how to change the transparency level of an image

Is it possible 开发者_JAVA技巧to change the transparency level of an IplImage (the alhpa channel)? I can do this using cvSet and setting all the values to a cvScalar, but that would change not only the alpha channel, but the actual RGB channels, as well.

thanks for the help.


You can add a scalar to an RGBA image with cvAddS:

void cvAddS(const CvArr* src, CvScalar value, CvArr* dst, const CvArr* mask=NULL)

For increasing just the alpha channel of an image you could use for example a cvScalar(0,0,0,30). This will increase the alpha value by 30. The same way cvSubS can be applied to substract a scalar.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜