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/includes/curl-quickstart.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ ms.custom: seodec18
17
17
Use the Optical character recognition REST API to read printed and handwritten text.
18
18
19
19
> [!NOTE]
20
-
> This quickstart uses cURL commands to call the REST API. You can also call the REST API using a programming language. See the GitHub samples for examples in [C#](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/dotnet/ComputerVision/REST), [Python](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/python/ComputerVision/REST), [Java](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/java/ComputerVision/REST), [JavaScript](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/javascript/ComputerVision/REST), and [Go](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/go/ComputerVision/REST).
20
+
> This quickstart uses cURL commands to call the REST API. You can also call the REST API using a programming language. See the GitHub samples for examples in [C#](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/dotnet/ComputerVision/REST), [Python](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/python/ComputerVision/REST), [Java](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/java/ComputerVision/REST), and [JavaScript](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/javascript/ComputerVision/REST).
Go to the Azure portal. If the Computer Vision resource you created in the **Prerequisites** section deployed successfully, click the **Go to Resource** button under **Next Steps**. You can find your key and endpoint in the resource's **key and endpoint** page, under **resource management**.
Copy file name to clipboardExpand all lines: articles/cognitive-services/Computer-vision/includes/image-analysis-curl-quickstart.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,19 +20,19 @@ Use the Image Analysis REST API to:
20
20
* Generate a thumbnail with smart cropping
21
21
22
22
> [!NOTE]
23
-
> This quickstart uses cURL commands to call the REST API. You can also call the REST API using a programming language. See the GitHub samples for examples in [C#](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/dotnet/ComputerVision/REST), [Python](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/python/ComputerVision/REST), [Java](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/java/ComputerVision/REST), [JavaScript](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/javascript/ComputerVision/REST), and [Go](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/go/ComputerVision/REST).
23
+
> This quickstart uses cURL commands to call the REST API. You can also call the REST API using a programming language. See the GitHub samples for examples in [C#](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/dotnet/ComputerVision/REST), [Python](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/python/ComputerVision/REST), [Java](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/java/ComputerVision/REST), and [JavaScript](https://github.com/Azure-Samples/cognitive-services-quickstart-code/tree/master/javascript/ComputerVision/REST).
24
24
25
25
## Prerequisites
26
26
27
27
* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
28
-
* Once you have your Azure subscription, <ahref="https://portal.azure.com/#create/Microsoft.CognitiveServicesComputerVision"title="Create a Computer Vision resource"target="_blank">create a Computer Vision resource </a> in the Azure portal to get your key and endpoint. After it deploys, click**Go to resource**.
29
-
* You will need the key and endpoint from the resource you create to connect your application to the Computer Vision service. You'll paste your key and endpoint into the code below later in the quickstart.
28
+
* Once you have your Azure subscription, <ahref="https://portal.azure.com/#create/Microsoft.CognitiveServicesComputerVision"title="Create a Computer Vision resource"target="_blank">create a Computer Vision resource </a> in the Azure portal to get your key and endpoint. After it deploys, select**Go to resource**.
29
+
* You'll need the key and endpoint from the resource you create to connect your application to the Computer Vision service. You'll paste your key and endpoint into the code below later in the quickstart.
30
30
* You can use the free pricing tier (`F0`) to try the service, and upgrade later to a paid tier for production.
31
31
*[cURL](https://curl.haxx.se/) installed
32
32
33
33
## Analyze an image
34
34
35
-
To analyze an image for a variety of visual features, do the following steps:
35
+
To analyze an image for various visual features, do the following steps:
36
36
37
37
1. Copy the following command into a text editor.
38
38
1. Make the following changes in the command where needed:
@@ -131,12 +131,12 @@ To create and run the sample, do the following steps:
131
131
132
132
### Examine the response
133
133
134
-
A successful response writes the thumbnail image to the file specified in`<thumbnailFile>`. If the request fails, the response contains an error code and a message to help determine what went wrong. If the request seems to succeed but the created thumbnail is not a valid image file, it might be that your subscription key is not valid.
134
+
A successful response writes the thumbnail image to the file specified in`<thumbnailFile>`. If the request fails, the response contains an error code and a message to help determine what went wrong. If the request seems to succeed but the created thumbnail isn't a valid image file, it's possible that your subscription key is not valid.
135
135
136
136
137
137
## Next steps
138
138
139
-
In this quickstart, you learned how to install make basic image analysis calls using the REST API. Next, learn more about the Analyze API features.
139
+
In this quickstart, you learned how to make basic image analysis calls using the REST API. Next, learn more about the Analyze API features.
140
140
141
141
> [!div class="nextstepaction"]
142
142
>[Call the Analyze API](../Vision-API-How-to-Topics/HowToCallVisionAPI.md)
Copy file name to clipboardExpand all lines: articles/cognitive-services/Computer-vision/includes/quickstarts-sdk/csharp-sdk.md
+25-79Lines changed: 25 additions & 79 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,14 +7,17 @@ manager: nitinme
7
7
ms.service: cognitive-services
8
8
ms.subservice: computer-vision
9
9
ms.topic: include
10
-
ms.date: 12/15/2020
10
+
ms.date: 03/02/2022
11
11
ms.author: pafarley
12
12
ms.custom: devx-track-csharp
13
13
---
14
14
15
15
<aname="HOLTop"></a>
16
16
17
-
Use the OCR client library to read printed and handwritten text from an image.
17
+
Use the OCR client library to read printed and handwritten text from a remote image. The OCR service can read visible text in an image and convert it to a character stream. For more information on text recognition, see the [Optical character recognition (OCR)](../../overview-ocr.md) overview. The code in this section uses the latest [Computer Vision SDK release for Read 3.0](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Vision.ComputerVision/).
18
+
19
+
> [!TIP]
20
+
> You can also extract text from a local image. See the [ComputerVisionClient](/dotnet/api/microsoft.azure.cognitiveservices.vision.computervision.computervisionclient) methods, such as **ReadInStreamAsync**. Or, see the sample code on [GitHub](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/dotnet/ComputerVision/ComputerVisionQuickstart.cs#162) for scenarios involving local images.
> Want to view the whole quickstart code file at once? You can find it on [GitHub](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/dotnet/ComputerVision/ComputerVisionQuickstart.cs), which contains the code examples in this quickstart.
77
-
78
-
From the project directory, open the *Program.cs* file in your preferred editor or IDE.
79
-
80
78
### Find the subscription key and endpoint
81
79
82
-
Go to the Azure portal. If the Computer Vision resource you created in the **Prerequisites** section deployed successfully, click the **Go to Resource** button under **Next Steps**. You can find your subscription key and endpoint in the resource's **key and endpoint** page, under **resource management**.
83
-
84
-
In the application's **Program** class, create variables for your Computer Vision subscription key and endpoint. Paste your subscription key and endpoint into the following code where indicated. Your Computer Vision endpoint has the form `https://<your_computer_vision_resource_name>.cognitiveservices.azure.com/`.
> Remember to remove the subscription key from your code when you're done, and never post it publicly. For production, consider using a secure way of storing and accessing your credentials. For example, [Azure key vault](../../../../key-vault/general/overview.md).
90
-
91
-
In the application's `Main` method, add calls for the methods used in this quickstart. You will create these later.
The following classes and interfaces handle some of the major features of the OCR .NET SDK.
98
-
99
-
|Name|Description|
100
-
|---|---|
101
-
|[ComputerVisionClient](/dotnet/api/microsoft.azure.cognitiveservices.vision.computervision.computervisionclient)| This class is needed for all Computer Vision functionality. You instantiate it with your subscription information, and you use it to do most image operations.|
102
-
|[ComputerVisionClientExtensions](/dotnet/api/microsoft.azure.cognitiveservices.vision.computervision.computervisionclientextensions)| This class contains additional methods for the **ComputerVisionClient**.|
103
-
104
-
## Code examples
105
-
106
-
These code snippets show you how to do the following tasks with the OCR client library for .NET:
107
-
108
-
*[Authenticate the client](#authenticate-the-client)
109
-
*[Read printed and handwritten text](#read-printed-and-handwritten-text)
110
-
111
-
## Authenticate the client
80
+
[!INCLUDE [find key and endpoint](../find-key.md)]
112
81
113
-
In a new method in the **Program** class, instantiate a client with your endpoint and subscription key. Create a **[ApiKeyServiceClientCredentials](/dotnet/api/microsoft.azure.cognitiveservices.vision.computervision.apikeyserviceclientcredentials)** object with your subscription key, and use it with your endpoint to create a **[ComputerVisionClient](/dotnet/api/microsoft.azure.cognitiveservices.vision.computervision.computervisionclient)** object.
The OCR service can read visible text in an image and convert it to a character stream. For more information on text recognition, see the [Optical character recognition (OCR)](../../overview-ocr.md) overview. The code in this section uses the [Computer Vision SDK release](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Vision.ComputerVision/) and defines a method, `ReadFileUrl`, which uses the client object to detect and extract text in the image.
120
-
121
-
> [!TIP]
122
-
> You can also extract text from a local image. See the [ComputerVisionClient](/dotnet/api/microsoft.azure.cognitiveservices.vision.computervision.computervisionclient) methods, such as **ReadInStreamAsync**. Or, see the sample code on [GitHub](https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/dotnet/ComputerVision/ComputerVisionQuickstart.cs#162) for scenarios involving local images.
123
-
124
-
### Set up test image
125
-
126
-
In your **Program** class, save a reference to the URL of the image you want to extract text from. This snippet includes sample images for both printed and handwritten text.
Define the new method for reading text. Add the code below, which calls the **ReadAsync** method for the given image. This returns an operation ID and starts an asynchronous process to read the content of the image.
85
+
1. From the project directory, open the *Program.cs* file in your preferred editor or IDE. Replace the contents of *Program.cs* with the following code.
As an optional step, see [How to specify the model version](../../Vision-API-How-to-Topics/call-read-api.md#determine-how-to-process-the-data-optional) for the model version parameter values you can use. The most recent model includes any enhancements to the previous GA and preview models. For example, to use the model-version=`2022-01-30-preview` parameter, edit the ReadAsync call as shown:
89
+
1. Paste your subscription key and endpoint into the code where indicated. Your Computer Vision endpoint has the form `https://<your_computer_vision_resource_name>.cognitiveservices.azure.com/`.
137
90
138
-
```csharp
139
-
// Read text from URL with a specific model version
> Remember to remove the subscription key from your code when you're done, and never post it publicly. For production, consider using a secure way of storing and accessing your credentials. For example, [Azure key vault](../../../../key-vault/general/overview.md).
144
93
145
-
Next, get the operation ID returned from the **ReadAsync**call, and use it to query the service for operation results. The following code checks the operation until the results are returned. It then prints the extracted text data to the console.
94
+
1. As an optional step, see [How to specify the model version](../../Vision-API-How-to-Topics/call-read-api.md#determine-how-to-process-the-data-optional) for the model version parameter values you can use. The most recent model includes any enhancements to the previous GA and preview models. For example, to use the model-version=`2022-01-30-preview` parameter, edit the ReadAsync call as shown:
0 commit comments