开发者

opencv: how to change the transparency level of an image

开发者 https://www.devze.com 2023-04-11 20:33 出处:网络
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

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

精彩评论

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