Region

Support

Required licenses

EasyImage

Recommended images

Any

Location

Image Processing/Region

Purpose

This sample program demonstrates how to:

  • Create an ERegion and use it to restrict processing to its domain.

Code highlights

  1. Create an ERegion with the desired geometrical shape.

    _region = new EPolygonRegion(...);
    _region = new ERectangleRegion(...);
    _region = new ECircleRegion(...);
    _region = new EEllipseRegion(...);
    
  2. Retrieve the handle at the given coordinates so you can later move it to new coordinates and modify the ERegion.

    handle = _region.HitTest(x, y);
    
  3. Move the previously retrieved handle to a new position to modify the ERegion.

    _region.Drag(handle, x, y);
    
  4. Draw the ERegion components, respectively the area, the contour and the handles (for graphical manipulation purposes).

    _region->Draw(drawAdapter);
    _region->DrawContour(drawAdapter);
    _region->DrawHandles(drawAdapter);
    
  5. Compute the pixel average on the image, restricted to the domain of the ERegion.

    EasyImage::PixelAverage(&_image, *_region, average);