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.
精彩评论