Table of Contents

Class ImageRedactionArea

Namespace
LMKit.Media.Image
Assembly
LM-Kit.NET.dll

A region of one image page whose pixels must be covered. The geometry is carried by an IBounds in image pixels with the origin at the top-left corner of the page, matching the geometry produced by OCR layouts and layout text elements. The area implements IBounds itself, so it can be passed anywhere a bounds is expected. Its Shape says which pixels of the bounds are covered (the whole rectangle, or the ellipse inscribed in it) and its Cover what they are painted with (an opaque fill, or an irreversible pixelation or blur).

public sealed class ImageRedactionArea : IBounds
Inheritance
ImageRedactionArea
Implements
Inherited Members

Examples

Example 1: an opaque box.

using LMKit.Media.Image;
using LMKit.Graphics.Geometry;

// Cover a 200 x 40 px region near the top of the first page. var area = new ImageRedactionArea(pageIndex: 0, Rectangle.FromSize(left: 72, top: 96, width: 200, height: 40));

Example 2: a blurred face.

using LMKit.Media.Image;
using LMKit.Graphics.Geometry;

// The ellipse inscribed in the face's box, blurred so the face cannot be recovered. var area = new ImageRedactionArea( pageIndex: 0, Rectangle.FromSize(left: 410, top: 120, width: 96, height: 128), ImageRedactionShape.Ellipse, ImageRedactionCover.Blur);

Constructors

ImageRedactionArea(int, IBounds)

Initializes a redaction area from a page index and a bounding box: the whole rectangle is covered with an opaque fill (Rectangle, Fill).

ImageRedactionArea(int, IBounds, ImageRedactionShape, ImageRedactionCover)

Initializes a redaction area from a page index, a bounding box, the shape covered inside it and what it is covered with.

Properties

Bottom

Gets the vertical position of the bottom edge of the bounds.

Bounds

Gets the normalized bounding box of the area in top-left origin image pixels.

Cover

Gets what the covered pixels are painted with. Default: Fill.

Height

Gets the total vertical extent of the bounds (Bottom minus Top).

Left

Gets the horizontal position of the left edge of the bounds.

MidX

Gets the horizontal midpoint of the bounds.

MidY

Gets the vertical midpoint of the bounds.

PageIndex

Gets the zero-based page index the area belongs to.

Right

Gets the horizontal position of the right edge of the bounds.

Shape

Gets which pixels of Bounds are covered: the whole rectangle, or the ellipse inscribed in it. Default: Rectangle.

Top

Gets the vertical position of the top edge of the bounds.

Width

Gets the total horizontal extent of the bounds (Right minus Left).

Methods

FromRegion(TextRegion)

Builds redaction areas from a matched text region, one area per contributing text element so the redaction hugs the matched glyphs. Falls back to the region's bounding box when the region carries no elements.

Share