Using an ERegion¶
This code snippet shows how to compute statistics inside a region defined by an ERegion.
C++¶
#include <eVision/EasyImage/EImageStatisticsBW8.h>
using namespace eVision;
// Images constructor
EImageBW8 srcImage;
ERegion mask;
// ...
// Compute the average value of the source image pixels
// corresponding to the mask do-care areas only
EImageStatisticsBW8 statistics;
statistics.SetImage(&srcImage, &mask);
float average = statistics.GetPixelAverage();
C#¶
using eVision;
// Images constructor
EImageBW8 srcImage = new EImageBW8();
ERegion mask = new ERegion();
// ...
// Compute the average value of the source image pixels
// corresponding to the mask do-care areas only
EImageStatisticsBW8 statistics = new EImageStatisticsBW8();
statistics.SetImage(srcImage, mask);
float average = statistics.PixelAverage;
See also
Python¶
import eVision
# Image constructors
src_image = eVision.EImageBW8()
mask = eVision.ERegion()
# ...
# Compute the average value of the source image pixels
# corresponding to the mask do-care areas only
statistics = eVision.EImageStatisticsBW8()
statistics.SetImage(src_image, mask)
average = statistics.PixelAverage
See also