Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Scalar has four elements of default type double. As you can see from the documentation, which should be your first place to look, each element can be accessed by using the () operator.

double first = avg(0);
double second = avg(1);
...

The number of elements filled is equal to the number of channels in your image. In this case, only the first is filled.