Share via


OcrResult.Rotation Property

 

Deprecated. The Rotation property specifies the rotation of the captured image.

Published date: March 4, 2014

Warning

The Bing OCR Control is deprecated as of March 12, 2014

Syntax

public double Rotation { get; }

Property Value

Type: System.Double

The clockwise rotation of the identified text relative to the position of the camera in radians.

Remarks

The Rotation property calculates the clockwise angle, in radians, to rotate the image around its center to make the returned bounding boxes match the angle of the words on the image. Alternatively, you could rotate the bounding boxes by the same amount counterclockwise and render them over the original image.

Example

The following OcrCompleted event handler writes the captured text to a grid named ResponseGrid which will overlay the captured image so that the captured words appear in the same position as the original. The captured image is stored in an Image control named ImageFrame.

private async void OCR_OcrCompleted(object sender, OcrCompletedEventArgs e)
{
    // Position the words on the response grid.
    ...

    // Get the rotation of the result.
    double deg = e.Result.Rotation * 180.0 / Math.PI;
    Debug.WriteLine("Angle in degrees: " + deg);

    // Apply a transform to rotate the response grid and its children.
    ResponseGrid.RenderTransform = new RotateTransform { 
        Angle = -1 * deg,
        CenterX = this.ImageFrame.ActualWidth / 2,
        CenterY = this.ImageFrame.ActualHeight / 2
    };
}

Requirements

Minimum Supported Client

Windows 8.1

Required Extensions

Bing OCR

Namespace

Bing.Ocr