Skip to content

Commit b7ddb4c

Browse files
committed
move common code to the beginning of guide (instead of repeating it)
1 parent a39dbbd commit b7ddb4c

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

articles/cognitive-services/Face/QuickStarts/csharp-sdk.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,19 @@ You'll likely want to call this method in the `Main` method.
123123

124124
[!code-csharp[](~/cognitive-services-dotnet-sdk-samples/documentation-samples/quickstarts/Face/Program.cs?name=snippet_client)]
125125

126-
## Detect faces in an image
126+
### Declare helper fields
127127

128-
At the root of your class, define the following URL string. This URL points to a set of sample images.
128+
The following fields are needed for several of the Face operations you'll add later. At the root of your class, define the following URL string. This URL points to a folder of sample images.
129129

130130
[!code-csharp[](~/cognitive-services-dotnet-sdk-samples/documentation-samples/quickstarts/Face/Program.cs?name=snippet_image_url)]
131131

132-
Optionally, you can choose which AI model to use to extract data from the detected face(s). See [Specify a recognition model](../Face-API-How-to-Topics/specify-recognition-model.md) for information on these options.
132+
Define strings to point to the different recognition model types. Later on, you'll be able to specify which recognition model you want to use for face detection. See [Specify a recognition model](../Face-API-How-to-Topics/specify-recognition-model.md) for information on these options.
133133

134134
[!code-csharp[](~/cognitive-services-dotnet-sdk-samples/documentation-samples/quickstarts/Face/Program.cs?name=snippet_detect_models)]
135135

136-
The final Detect operation will take a **[FaceClient](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.vision.face.faceclient?view=azure-dotnet)** object, an image URL, and a recognition model.
136+
## Detect faces in an image
137+
138+
Add the following method call to your **main** method. You'll define the method next. The final Detect operation will take a **[FaceClient](https://docs.microsoft.com/dotnet/api/microsoft.azure.cognitiveservices.vision.face.faceclient?view=azure-dotnet)** object, an image URL, and a recognition model.
137139

138140
[!code-csharp[](~/cognitive-services-dotnet-sdk-samples/documentation-samples/quickstarts/Face/Program.cs?name=snippet_detect_call)]
139141

@@ -179,14 +181,6 @@ The Identify operation takes an image of a person (or multiple people) and looks
179181

180182
The following code creates a **PersonGroup** with six different **Person** objects. It associates each **Person** with a set of example images, and then it trains to recognize each person by their facial characteristics. **Person** and **PersonGroup** objects are used in the Verify, Identify, and Group operations.
181183

182-
If you haven't done so already, define the following URL string at the root of your class. This points to a set of sample images.
183-
184-
[!code-csharp[](~/cognitive-services-dotnet-sdk-samples/documentation-samples/quickstarts/Face/Program.cs?name=snippet_image_url)]
185-
186-
The code later in this section will specify a recognition model to extract data from faces, and the following snippet creates references to the available models. See [Specify a recognition model](../Face-API-How-to-Topics/specify-recognition-model.md) for information on recognition models.
187-
188-
[!code-csharp[](~/cognitive-services-dotnet-sdk-samples/documentation-samples/quickstarts/Face/Program.cs?name=snippet_detect_models)]
189-
190184
#### Create PersonGroup
191185

192186
Declare a string variable at the root of your class to represent the ID of the **PersonGroup** you'll create.

0 commit comments

Comments
 (0)