Change Image opacity

asked 2020-03-31 04:36:07 -0600

snehal gravatar image


I have one 16 bit image and i want to change the opacity of that image. If there is any method in OpenCV please suggest me.

edit retag flag offensive close merge delete


opencv, being a computer-vision library, usually discards alpha/opacity when reading/writing images

so, there most likely isnt any opacity in your image, and opencv is the wrong tool for your job

check img.channels() (in c++) or np.shape(img) (python)

berak gravatar imageberak ( 2020-03-31 05:04:38 -0600 )edit

Ok. Is it possible to find transparency of grayscale image ?

snehal gravatar imagesnehal ( 2020-03-31 08:06:33 -0600 )edit

no. grayscale images do not contain this information. (think of it, where would it come from ?)

you could convert it to BGRA, and modify the 4th channel, but there's not much builtin for this.

again, wrong tool for your job, this is NOT photoshop.

berak gravatar imageberak ( 2020-03-31 08:25:37 -0600 )edit

Does this help Change of opacity? Also scroll down to get another another answer.

supra56 gravatar imagesupra56 ( 2020-03-31 10:09:15 -0600 )edit