1 package inkrecognizer 2 3 // Copyright (c) Microsoft Corporation. All rights reserved. 4 // Licensed under the MIT License. See License.txt in the project root for license information. 5 // 6 // Code generated by Microsoft (R) AutoRest Code Generator. 7 // Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9 import ( 10 "github.com/Azure/go-autorest/autorest" 11 ) 12 13 // The package's fully qualified name. 14 const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v1.0/inkrecognizer" 15 16 // AlternatePatternItem ... 17 type AlternatePatternItem struct { 18 // Category - Possible values include: 'LeafInkDrawing', 'LeafInkBullet', 'LeafInkWord', 'LeafUnknown' 19 Category Leaf `json:"category,omitempty"` 20 // Points - Array of point objects that represent points that are relevant to the type of recognition unit. For example, for leaf node of inkDrawing category that represents a triangle, points would include the x,y coordinates of the vertices of the recognized triangle. The points represent the coordinates of points used to create the perfectly drawn shape that is closest to the original input. They may not exactly match. 21 Points *[]PointDetailsPattern `json:"points,omitempty"` 22 // RotationAngle - The angular orientation of an object relative to the horizontal axis 23 RotationAngle *float64 `json:"rotationAngle,omitempty"` 24 // Confidence - A number between 0 and 1 which indicates the confidence level in the result 25 Confidence *float64 `json:"confidence,omitempty"` 26 // RecognizedString - The recognized string from an inkWord or the name of a recognized shape in an inkDrawing object 27 RecognizedString *string `json:"recognizedString,omitempty"` 28 } 29 30 // AnalysisRequest this shows the expected contents of a request 31 type AnalysisRequest struct { 32 // ApplicationType - This describes the domain of the client application. Possible values include: 'Drawing', 'Writing', 'Mixed' 33 ApplicationType Application `json:"applicationType,omitempty"` 34 // InputDeviceKind - This identifies the kind of device used as the writing instrument. Possible values include: 'Digitizer', 'Pen', 'LightPen', 'TouchScreen', 'TouchPad', 'WhiteBoard', 'ThreedDigitizer', 'StereoPlotter', 'ArticulatedArm', 'Armature' 35 InputDeviceKind InputDevice `json:"inputDeviceKind,omitempty"` 36 // Unit - This is the physical unit of the ink strokes. It is up to the application developer to decide how to convert the device specific units to physical units before calling the service. The conversion factor can be different based on the type of the device used. Possible values include: 'Mm', 'Cm', 'In' 37 Unit Unit `json:"unit,omitempty"` 38 // UnitMultiple - This is a scaling factor to be applied to the point coordinates when interpreting them in the physical units specified. 39 UnitMultiple *float64 `json:"unitMultiple,omitempty"` 40 // Language - The IETF BCP 47 language code (for ex. en-US, en-GB, hi-IN etc.) of the expected language for the handwritten content in the ink strokes. The response will include results from this language. 41 Language *string `json:"language,omitempty"` 42 InkPointValueAttributes *[]InkPointValueAttribute `json:"inkPointValueAttributes,omitempty"` 43 // Strokes - This is the array of strokes sent for recognition. Best results are produced when the order of strokes added in the array matches the order in which the user created them. Changing the stroke order may produce unexpected results. 44 Strokes *[]Stroke `json:"strokes,omitempty"` 45 } 46 47 // AnalysisResponse this shows the expected contents of a response from the service 48 type AnalysisResponse struct { 49 autorest.Response `json:"-"` 50 // Unit - This is the physical unit of the ink strokes. It is up to the application developer to decide how to convert the device specific units to physical units before calling the service. The conversion factor can be different based on the type of the device used. Possible values include: 'Mm', 'Cm', 'In' 51 Unit Unit `json:"unit,omitempty"` 52 // UnitMultiple - This is a scaling factor to be applied to the point coordinates when interpreting them in the physical units specified. 53 UnitMultiple *float64 `json:"unitMultiple,omitempty"` 54 // Language - This is the language used for recognizing handwriting from the ink strokes in the request. 55 Language *string `json:"language,omitempty"` 56 RecognitionUnits *[]RecognitionUnitItem `json:"recognitionUnits,omitempty"` 57 } 58 59 // DrawingAttributesPattern the properties to use when rendering ink 60 type DrawingAttributesPattern struct { 61 // Width - The width of the stylus used to draw the stroke 62 Width *float64 `json:"width,omitempty"` 63 // Color - This shows the components of the color in rgba format 64 Color *DrawingAttributesPatternColor `json:"color,omitempty"` 65 // Height - The height of the stylus used to draw the stroke 66 Height *float64 `json:"height,omitempty"` 67 // FitToCurve - This indicates whether Bezier smoothing is used to render the stroke 68 FitToCurve *bool `json:"fitToCurve,omitempty"` 69 // RasterOp - Possible values include: 'NoOperation', 'CopyPen', 'MaskPen' 70 RasterOp RasterOp `json:"rasterOp,omitempty"` 71 // IgnorePressure - This indicates whether the thickness of a rendered Stroke changes according the amount of pressure applied. 72 IgnorePressure *bool `json:"ignorePressure,omitempty"` 73 // Tip - This specifies the tip to be used to draw a stroke. Possible values include: 'Ellipse', 'Rectangle' 74 Tip Tip `json:"tip,omitempty"` 75 } 76 77 // DrawingAttributesPatternColor this shows the components of the color in rgba format 78 type DrawingAttributesPatternColor struct { 79 // R - The red component of the color 80 R *float64 `json:"r,omitempty"` 81 // G - The green component of the color 82 G *float64 `json:"g,omitempty"` 83 // B - The blue component of the color 84 B *float64 `json:"b,omitempty"` 85 // A - The alpha component of the color 86 A *float64 `json:"a,omitempty"` 87 } 88 89 // ErrorModel ... 90 type ErrorModel struct { 91 // Code - This represents the error code 92 Code *string `json:"code,omitempty"` 93 // Message - This represents the error message 94 Message *string `json:"message,omitempty"` 95 // Target - This represents the target of the error message 96 Target *string `json:"target,omitempty"` 97 // Details - This gives details of the reason(s) for the error 98 Details *[]ErrorModelDetailsItem `json:"details,omitempty"` 99 } 100 101 // ErrorModelDetailsItem ... 102 type ErrorModelDetailsItem struct { 103 // Code - This represents the error code 104 Code *string `json:"code,omitempty"` 105 // Message - This represents the error message 106 Message *string `json:"message,omitempty"` 107 // Target - This represents the target of the error message 108 Target *string `json:"target,omitempty"` 109 } 110 111 // InkPoint an object containing the properties of an point in the path of an ink stroke. The main 112 // properties are the x and y values. Other include tip pressure, x tilt etc. For the coordinate values, it 113 // is recommended to have a precision of 8 digits after the decimal to obtain most accurate recognition 114 // results. The origin (0,0) of the canvas is assumed to be at the top left corner of the canvas 115 type InkPoint struct { 116 // X - The x coordinate of the pen location on the writing surface. 117 X *float64 `json:"x,omitempty"` 118 // Y - The y coordinate of the pen location on the writing surface. 119 Y *float64 `json:"y,omitempty"` 120 // Z - The z coordinate of the pen location on the writing space. This may not be used for recognition. 121 Z *float64 `json:"z,omitempty"` 122 // TipPressure - The force exerted against the tablet surface by the transducer, typically a stylus. This may not be used for recognition. 123 TipPressure *float64 `json:"tipPressure,omitempty"` 124 // BarrelPressure - The force exerted directly by the user on a transducer sensor, such as a pressure-sensitive button on the barrel of a stylus. This may not be used for recognition. 125 BarrelPressure *float64 `json:"barrelPressure,omitempty"` 126 // Timestamp - The time relative to the absolute time the transducer last became active. This may not be used for recognition. 127 Timestamp *float64 `json:"timestamp,omitempty"` 128 // XTilt - The plane angle between the Y-Z plane and the plane containing the transducer axis and the Y axis. This may not be used for recognition. 129 XTilt *float64 `json:"xTilt,omitempty"` 130 // YTilt - The angle between the X-Z and transducer-X planes. A positive Y Tilt is toward the user. This may not be used for recognition. 131 YTilt *float64 `json:"yTilt,omitempty"` 132 // Width - The width of the tip of the writing instrument. This is used by touch screen devices to report the width of the finger contact on the writing surface. This may not be used for recognition. 133 Width *float64 `json:"width,omitempty"` 134 // Height - The height of the tip of the writing instrument. This is used by touch screen devices to report the height of the finger contact on the writing surface. This may not be used for recognition. 135 Height *float64 `json:"height,omitempty"` 136 // TipSwitch - A switch located on the tip of a stylus indicating contact of the stylus with a surface. This may not be used for recognition. 137 TipSwitch *bool `json:"tipSwitch,omitempty"` 138 // Inverted - A value that indicates that the currently sensed position originates from the end of a stylus opposite the tip switch. This may not be used for recognition. 139 Inverted *bool `json:"inverted,omitempty"` 140 // BarrelSwitch - A non-tip button located on the barrel of a stylus. Its function is typically mapped to a system secondary button. This may not be used for recognition. 141 BarrelSwitch *bool `json:"barrelSwitch,omitempty"` 142 // Eraser - The control is used for erasing objects. It is typically located opposite the writing end of a stylus. This may not be used for recognition. 143 Eraser *bool `json:"eraser,omitempty"` 144 // SecondaryTip - A secondary switch used in conjunction with the tip switch to indicate pressure above a certain threshold applied with the stylus. This may not be used for recognition. 145 SecondaryTip *bool `json:"secondaryTip,omitempty"` 146 } 147 148 // InkPointValueAttribute a container for the attributes of a value contained in the ink point object. 149 type InkPointValueAttribute struct { 150 // Name - The name of the point attribute. 151 Name *string `json:"name,omitempty"` 152 // LogicalMinimum - The minimum value for the attribute 153 LogicalMinimum *float64 `json:"logicalMinimum,omitempty"` 154 // LogicalMaximum - The maximum value for the attribute 155 LogicalMaximum *float64 `json:"logicalMaximum,omitempty"` 156 } 157 158 // PointDetailsPattern this holds all the properties of one point 159 type PointDetailsPattern struct { 160 // X - This represents the x coordinate of the point 161 X *float64 `json:"x,omitempty"` 162 // Y - This represents the y coordinate of the point 163 Y *float64 `json:"y,omitempty"` 164 } 165 166 // RecognitionUnitItem this identifies the recognized entity 167 type RecognitionUnitItem struct { 168 // ID - The identifier of the recognition unit. This id is used to indicate parent/child relationship between different recognition units. 169 ID *int32 `json:"id,omitempty"` 170 // Category - Possible values include: 'Root', 'WritingRegion', 'Paragraph', 'Line', 'InkBullet', 'InkDrawing', 'InkWord', 'Unknown' 171 Category Category `json:"category,omitempty"` 172 Alternates *[]AlternatePatternItem `json:"alternates,omitempty"` 173 // Center - The coordinates (x,y) of the center of the recognition unit. 174 Center *PointDetailsPattern `json:"center,omitempty"` 175 // Points - Array of point objects that represent points that are relevant to the type of recognition unit. For example, for a leaf node of inkDrawing category that represents a triangle, points would include the x, y coordinates of the vertices of the recognized triangle. The points represent the coordinates used to create the perfectly drawn shape that is closest to the original input. They may not exactly match. 176 Points *[]PointDetailsPattern `json:"points,omitempty"` 177 // ChildIds - An array of integers representing the identifier of each child of the current recognition unit. 178 ChildIds *[]int32 `json:"childIds,omitempty"` 179 // Class - Possible values include: 'ClassContainer', 'ClassLeaf' 180 Class Class `json:"class,omitempty"` 181 // ParentID - The id of the parent node in the tree structure of the recognition results. parent = 0 indicates that there is no dedicated parent node for this unit. 182 ParentID *int32 `json:"parentId,omitempty"` 183 // BoundingRectangle - The bounding rectangle of the recognition unit represented by the coordinates of the top left corner (topX,topY) along with width and height of the rectangle. Note that this rectangle is not rotated. So for rotated objects such as slanted handwriting, it will cover the entire object. The unit will be matched to the one specified in the original request (mm by default.) 184 BoundingRectangle *RecognitionUnitItemBoundingRectangle `json:"boundingRectangle,omitempty"` 185 // RotatedBoundingRectangle - This is the rotated bounding rectangle that covers the entire recognized object along the angle of rotation of the object. Note that this is NOT the same as rotating the boundingRectangle by the rotation angle. 186 RotatedBoundingRectangle *[]PointDetailsPattern `json:"rotatedBoundingRectangle,omitempty"` 187 // StrokeIds - This is an array of integers representing the list of stroke Identifiers from the input request body that belong to this recognition unit. 188 StrokeIds *[]int32 `json:"strokeIds,omitempty"` 189 // RecognizedText - The string contains the text that was recognized. It can be an empty string if the recognizer cannot determine the text. 190 RecognizedText *string `json:"recognizedText,omitempty"` 191 // Confidence - A number between 0 and 1 which indicates the confidence level in the result. 192 Confidence *float64 `json:"confidence,omitempty"` 193 // RotationAngle - This is the angle at which the unit is rotated in degrees with respect to the positive X axis. 194 RotationAngle *float64 `json:"rotationAngle,omitempty"` 195 // RecognizedObject - Possible values include: 'ShapeDrawing', 'ShapeSquare', 'ShapeRectangle', 'ShapeCircle', 'ShapeEllipse', 'ShapeTriangle', 'ShapeIsoscelesTriangle', 'ShapeEquilateralTriangle', 'ShapeRightTriangle', 'ShapeQuadrilateral', 'ShapeDiamond', 'ShapeTrapezoid', 'ShapeParallelogram', 'ShapePentagon', 'ShapeHexagon', 'ShapeBlockArrow', 'ShapeHeart', 'ShapeStarSimple', 'ShapeStarCrossed', 'ShapeCloud', 'ShapeLine', 'ShapeCurve', 'ShapePolyLine' 196 RecognizedObject Shape `json:"recognizedObject,omitempty"` 197 } 198 199 // RecognitionUnitItemBoundingRectangle the bounding rectangle of the recognition unit represented by the 200 // coordinates of the top left corner (topX,topY) along with width and height of the rectangle. Note that 201 // this rectangle is not rotated. So for rotated objects such as slanted handwriting, it will cover the 202 // entire object. The unit will be matched to the one specified in the original request (mm by default.) 203 type RecognitionUnitItemBoundingRectangle struct { 204 // TopX - This is the top left x coordinate 205 TopX *float64 `json:"topX,omitempty"` 206 // TopY - This is the top left y coordinate 207 TopY *float64 `json:"topY,omitempty"` 208 // Width - This is width of the bounding rectangle 209 Width *float64 `json:"width,omitempty"` 210 // Height - The is the height of the bounding rectangle 211 Height *float64 `json:"height,omitempty"` 212 } 213 214 // Stroke ... 215 type Stroke struct { 216 // ID - This is treated as a unique identifier for each stroke within a request. If the id is repeated within the same request, the service will return an error. 217 ID *int32 `json:"id,omitempty"` 218 // Language - The IETF BCP 47 language code (for ex. en-US, en-GB, hi-IN etc.) of the expected language for the handwritten content in this stroke. The response will include results from this language. 219 Language *string `json:"language,omitempty"` 220 Points *[]InkPoint `json:"points,omitempty"` 221 DrawingAttributes *DrawingAttributesPattern `json:"drawingAttributes,omitempty"` 222 // Kind - This is an optional property which influences the decision about what the stroke kind is between inkWriting and inkDrawing. This property should be set ONLY if the type of user content is known ahead of time. Not setting this value implies the kind is not known ahead of time. Kind represents the type of content the stroke is a part of. Possible values include: 'KindInkDrawing', 'KindInkWriting' 223 Kind Kind `json:"kind,omitempty"` 224 } 225