Chinese Simplified (简体中文)

CoordinatesConverter Object (ICoordinatesConverter Interface)

This object contains information about the pixel coordinates on the image at the moment when it was obtained from the ImageDocument object (the CoordinatesConverter property). It allows you to convert the pixel coordinates from one image modification state to another.

You can use this object to convert the pixel coordinates between any two stages in the image processing. For example:

  1. Obtain this object directly after image opening, during which image skew was corrected.
  2. Apply a number of other modifications and obtain another instance of this object from the ImageDocument.
  3. Now you can convert pixel coordinates between the initially deskewed image plane and the modified image plane by twice applying the ConvertCoordinates method:
    • convert from the deskewed image plane to the original using the first instance of the CoordinatesConverter;
    • convert the result from the original image plane to the modified image plane using the second instance of the CoordinatesConverter.

The CoordinatesConverter object is a persistent object. This means that the object's current state can be written to persistent storage: an area in the global memory or a disk file. Later, the object can be re-created by reading the object's state from persistent storage. The following methods provide persistence of the object: SaveToFile, LoadFromFile, SaveToMemory, and LoadFromMemory.

Properties

Name Type Description
Application Engine, read-only Returns the Engine object.

Methods

Name Description
ConvertCoordinates Converts coordinates of a pixel between different modification states or image planes of the ImageDocument.
LoadFromFile Restores the object's contents from a file on disk.
LoadFromMemory Restores the object's contents from the global memory.
SaveToFile Saves the object's contents into a file on disk.
SaveToMemory Saves the object's contents into the global memory.

Related objects

Object Diagram

Samples

Here is a sample in which this object is used to convert coordinates between two different modification states:

C#

FREngine.IEngine engine;
FREngine.IFRDocument frDoc;
// Skew correction is performed by default while adding the images to the document
frDoc.AddImageFile ("D:\\Sample.tif", null, null);
// Open ImageDocument of the first page
FREngine.IImageDocument imageDoc = frDoc.Pages[0].ImageDocument; 
// Create a snapshot of coordinates after opening
FREngine.ICoordinatesConverter convAfterOpening = imageDoc.CoordinatesConverter;
// Transform the image some more
imageDoc.Transform(FREngine.RotationTypeEnum.RT_Counterclockwise, false, false);
// Create a snapshot of coordinates after transformation
FREngine.ICoordinatesConverter convAfterModification = imageDoc.CoordinatesConverter;
...
// After some processing you find a pixel on the modified image plane whose coordinates you need to convert
int x, y;
convAfterModification.ConvertCoordinates(FREngine.ImageTypeEnum.IT_Base, FREngine.ImageTypeEnum.IT_Modified, ref x, ref y);
convAfterOpening.ConvertCoordinates(FREngine.ImageTypeEnum.IT_Modified, FREngine.ImageTypeEnum.IT_Base, ref x, ref y);
// now x, y contain the coordinates of the necessary point on the deskewed image plane
    

This object is used in the Business Card Recognition demo tool.

See also

ImageDocument

Working with Images

Working with Properties

24.03.2023 8:51:52

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.