I found the following piece of code in this In which there is a piece of code to acces the alpha value that looks like this:
double opacity = (double)image.data[y*image.step + x * image.channels () +3]
I can't understand how this piece of code works, from what I have found, Mat.data 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.