You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cognitive-services/Computer-vision/QuickStarts/CSharp-hand-text.md
+22-81Lines changed: 22 additions & 81 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Quickstart: Computer Vision 2.0 and 2.1 - Extract printed and handwritten text - REST, C#"
2
+
title: "Quickstart: Computer Vision 2.1, and 3.0 - Extract printed and handwritten text - REST, C#"
3
3
titleSuffix: "Azure Cognitive Services"
4
4
description: In this quickstart, you extract printed and handwritten text from an image using the Computer Vision API with C#.
5
5
services: cognitive-services
@@ -13,11 +13,11 @@ ms.date: 04/14/2020
13
13
ms.author: pafarley
14
14
ms.custom: seodec18
15
15
---
16
-
# Quickstart: Extract printed and handwritten text using the Computer Vision 2.0 and 2.1 REST API and C#
16
+
# Quickstart: Extract printed and handwritten text using the Computer Vision 2.1 and 3.0 REST API and C#
17
17
18
18
In this quickstart, you'll extract printed and/or handwritten text from an image using the Computer Vision REST API. With the [Batch Read](https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/2afb498089f74080d7ef85eb) and [Read Operation Result](https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/5be108e7498a4f9ed20bf96d) methods, you can detect text in an image and extract recognized characters into a machine-readable character stream. The API will determine which recognition model to use for each line of text, so it supports images with both printed and handwritten text.
19
19
20
-
Compared to Computer Vision 2.0 and 2.1, the Computer Vision 3.0 Public Preview provides:
20
+
Compared to Computer Vision 2.1 and 3.0, the Computer Vision 3.0 Public Preview provides:
21
21
22
22
* even better accuracy
23
23
* a changed output format
@@ -29,7 +29,7 @@ Compared to Computer Vision 2.0 and 2.1, the Computer Vision 3.0 Public Preview
29
29
> [!IMPORTANT]
30
30
> The [Batch Read](https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/2afb498089f74080d7ef85eb) method runs asynchronously. This method does not return any information in the body of a successful response. Instead, the Batch Read method returns a URI in the value of the `Operation-Location` response header field. You can then call this URI, which represents the [Read Operation Result](https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/5be108e7498a4f9ed20bf96d) API, to both check the status and return the results of the Batch Read method call.
31
31
32
-
#### [Version 3 (Public preview)](#tab/version-3)
32
+
#### [Version 3](#tab/version-3)
33
33
34
34
> [!IMPORTANT]
35
35
> The [Batch Read](https://westus2.dev.cognitive.microsoft.com/docs/services/5d98695995feb7853f67d6a6/operations/5d986960601faab4bf452005) method runs asynchronously. This method does not return any information in the body of a successful response. Instead, the Batch Read method returns a URI in the value of the `Operation-Location` response header field. You can then call this URI, which represents the [Read Operation Result](https://westus2.dev.cognitive.microsoft.com/docs/services/5d98695995feb7853f67d6a6/operations/5d9869604be85dee480c8750) API, to both check the status and return the results of the Batch Read method call.
// Add a local image with text here (png or jpg is OK)
249
+
staticstringimageFilePath=@"my-image.png";
250
+
// Add a language, either "en" or "es"
251
+
staticstringlanguage="en";
256
252
257
-
staticvoidPrintUsage()
258
-
{
259
-
// Get the path and filename to process from the user.
260
-
Console.WriteLine("Cognitive Service Batch Read File Sample");
261
-
Console.WriteLine("Usage: ");
262
-
Console.WriteLine(" From Azure Cogntivie Service, retrieve your endpoint and subscription key.");
263
-
Console.WriteLine(" Set environment variable COMPUTER_VISION_ENDPOINT, such as \"https://westus2.api.cognitive.microsoft.com\"");
264
-
Console.WriteLine(" Set environment variable COMPUTER_VISION_SUBSCRIPTION_KEY, such as \"1234567890abcdef1234567890abcdef\"\n");
265
-
Console.WriteLine(" Run the program without argument to enter a file name and a language manually.");
266
-
Console.WriteLine(" Or run the program with a file name for an image file (bmp/jpg/png/tiff) or a PDF file, plus the language. The language can be \"en\" or \"es\".");
267
-
Console.WriteLine(" For example: dotnet Program.dll sample.jpg en");
268
-
Console.WriteLine();
269
-
}
270
253
271
254
staticvoidMain(string[] args)
272
255
{
273
-
PrintUsage();
256
+
// Call the REST API method.
257
+
Console.WriteLine("\nExtracting text...\n");
258
+
ReadText(imageFilePath, language).Wait();
274
259
275
-
if (string.IsNullOrEmpty(subscriptionKey) ||string.IsNullOrEmpty(endpoint))
276
-
{
277
-
Console.Error.WriteLine("Please set environment variables COMPUTER_VISION_ENDPOINT and COMPUTER_VISION_SUBSCRIPTION_KEY.");
278
-
return;
279
-
}
280
-
281
-
stringimageFilePath;
282
-
stringlanguage;
283
-
if (args.Length==0)
284
-
{
285
-
Console.Write(
286
-
"Enter the path to an image (bmp/jpg/png/tiff) or PDF with text you wish to read: ");
287
-
imageFilePath=Console.ReadLine();
288
-
}
289
-
else
290
-
{
291
-
imageFilePath=args[0];
292
-
}
293
-
294
-
if (args.Length<=1)
295
-
{
296
-
Console.Write(
297
-
"Enter the language to read: \"en\" or \"es\": ");
Copy file name to clipboardExpand all lines: articles/cognitive-services/Computer-vision/QuickStarts/javascript-hand-text.md
+2-5Lines changed: 2 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,10 +68,7 @@ To create and run the sample, do the following steps:
68
68
69
69
<scripttype="text/javascript">
70
70
functionprocessImage() {
71
-
// **********************************************
72
-
// *** Update or verify the following values. ***
73
-
// **********************************************
74
-
71
+
// Fetch your Computer Vision key and endpoint for this sample.
75
72
var subscriptionKey =document.getElementById("subscriptionKey").value;
76
73
var endpoint =document.getElementById("endpointUrl").value;
77
74
@@ -786,4 +783,4 @@ Explore a JavaScript application that uses Computer Vision to perform optical ch
786
783
> [!div class="nextstepaction"]
787
784
> [Computer Vision API JavaScript Tutorial](../Tutorials/javascript-tutorial.md)
788
785
789
-
* To rapidly experiment with the Computer Vision API, try the [Open API testing console](https://westcentralus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa/console).
786
+
* To rapidly experiment with the Computer Vision API, try the [Open API testing console](https://westcentralus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fa/console).
0 commit comments