Sample colors🔗

Calculates average of color channels in the given region of interest.


  • image: Input image.

  • frame: A coordinate frame for the rectangle in the world coordinate system.

  • size: The size of the rectangle in which the average is calculated. If size is undefined (either width or height is NAN), the average is computed from the whole image. Otherwise the region of interest is determined by size and frame.

  • setAlpha: If this value is false, the alpha channel of the output color is always set to zero. If the value is true, the alpha channel is sampled from the region of interest of the input image just like the RGB channels are.


  • color: Average of color over the area framed by the region of interest.