Ask Your Question

How to access alpha value at pixel using

asked 2018-02-27 19:23:01 -0500

Blath gravatar image

updated 2018-02-27 21:14:55 -0500

I found the following piece of code in this question. In which there is a piece of code to acces the alpha value that looks like this:

double opacity = (double)[y*image.step + x * image.channels () +3]

I can't understand how this piece of code works, from what I have found, is used to access a pixel at some location, and I can't understand why x*image.channels () is in the code.

Hopefully someone can explain me the code.

Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-02-28 02:17:01 -0500

LBerger gravatar image

updated 2018-02-28 03:01:33 -0500

You can find answer tou your question in opencv tutorials: storing method it's and How is the image matrix stored in memory?

There is no specific function in opencv to use alpha channel : you will have to write everything yourself. There is no alpha values in image processing.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-02-27 19:23:01 -0500

Seen: 413 times

Last updated: Feb 28 '18