├── .gitattributes
├── .github
├── ISSUE_TEMPLATE.md
└── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── CHANGELOG.md
├── CONTRIBUTING.md
├── FaceTutorialCS
├── FaceTutorialCS.sln
└── FaceTutorialCS
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── FaceTutorialCS.csproj
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ └── packages.config
├── LICENSE.md
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
4 | > Please provide us with the following information:
5 | > ---------------------------------------------------------------
6 |
7 | ### This issue is for a: (mark with an `x`)
8 | ```
9 | - [ ] bug report -> please search issues before submitting
10 | - [ ] feature request
11 | - [ ] documentation issue or request
12 | - [ ] regression (a behavior that used to work and stopped in a new release)
13 | ```
14 |
15 | ### Minimal steps to reproduce
16 | >
17 |
18 | ### Any log messages given by the failure
19 | >
20 |
21 | ### Expected/desired behavior
22 | >
23 |
24 | ### OS and Version?
25 | > Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
26 |
27 | ### Versions
28 | >
29 |
30 | ### Mention any other details that might be useful
31 |
32 | > ---------------------------------------------------------------
33 | > Thanks! We'll be in touch soon.
34 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Purpose
2 |
3 | * ...
4 |
5 | ## Does this introduce a breaking change?
6 |
7 | ```
8 | [ ] Yes
9 | [ ] No
10 | ```
11 |
12 | ## Pull Request Type
13 | What kind of change does this Pull Request introduce?
14 |
15 |
16 | ```
17 | [ ] Bugfix
18 | [ ] Feature
19 | [ ] Code style update (formatting, local variables)
20 | [ ] Refactoring (no functional changes, no api changes)
21 | [ ] Documentation content changes
22 | [ ] Other... Please describe:
23 | ```
24 |
25 | ## How to Test
26 | * Get the code
27 |
28 | ```
29 | git clone [repo-address]
30 | cd [repo-name]
31 | git checkout [branch-name]
32 | npm install
33 | ```
34 |
35 | * Test the code
36 |
37 | ```
38 | ```
39 |
40 | ## What to Check
41 | Verify that the following are valid
42 | * ...
43 |
44 | ## Other Information
45 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015/2017 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # Visual Studio 2017 auto generated files
33 | Generated\ Files/
34 |
35 | # MSTest test Results
36 | [Tt]est[Rr]esult*/
37 | [Bb]uild[Ll]og.*
38 |
39 | # NUNIT
40 | *.VisualState.xml
41 | TestResult.xml
42 |
43 | # Build Results of an ATL Project
44 | [Dd]ebugPS/
45 | [Rr]eleasePS/
46 | dlldata.c
47 |
48 | # Benchmark Results
49 | BenchmarkDotNet.Artifacts/
50 |
51 | # .NET Core
52 | project.lock.json
53 | project.fragment.lock.json
54 | artifacts/
55 | **/Properties/launchSettings.json
56 |
57 | # StyleCop
58 | StyleCopReport.xml
59 |
60 | # Files built by Visual Studio
61 | *_i.c
62 | *_p.c
63 | *_i.h
64 | *.ilk
65 | *.meta
66 | *.obj
67 | *.iobj
68 | *.pch
69 | *.pdb
70 | *.ipdb
71 | *.pgc
72 | *.pgd
73 | *.rsp
74 | *.sbr
75 | *.tlb
76 | *.tli
77 | *.tlh
78 | *.tmp
79 | *.tmp_proj
80 | *.log
81 | *.vspscc
82 | *.vssscc
83 | .builds
84 | *.pidb
85 | *.svclog
86 | *.scc
87 |
88 | # Chutzpah Test files
89 | _Chutzpah*
90 |
91 | # Visual C++ cache files
92 | ipch/
93 | *.aps
94 | *.ncb
95 | *.opendb
96 | *.opensdf
97 | *.sdf
98 | *.cachefile
99 | *.VC.db
100 | *.VC.VC.opendb
101 |
102 | # Visual Studio profiler
103 | *.psess
104 | *.vsp
105 | *.vspx
106 | *.sap
107 |
108 | # Visual Studio Trace Files
109 | *.e2e
110 |
111 | # TFS 2012 Local Workspace
112 | $tf/
113 |
114 | # Guidance Automation Toolkit
115 | *.gpState
116 |
117 | # ReSharper is a .NET coding add-in
118 | _ReSharper*/
119 | *.[Rr]e[Ss]harper
120 | *.DotSettings.user
121 |
122 | # JustCode is a .NET coding add-in
123 | .JustCode
124 |
125 | # TeamCity is a build add-in
126 | _TeamCity*
127 |
128 | # DotCover is a Code Coverage Tool
129 | *.dotCover
130 |
131 | # AxoCover is a Code Coverage Tool
132 | .axoCover/*
133 | !.axoCover/settings.json
134 |
135 | # Visual Studio code coverage results
136 | *.coverage
137 | *.coveragexml
138 |
139 | # NCrunch
140 | _NCrunch_*
141 | .*crunch*.local.xml
142 | nCrunchTemp_*
143 |
144 | # MightyMoose
145 | *.mm.*
146 | AutoTest.Net/
147 |
148 | # Web workbench (sass)
149 | .sass-cache/
150 |
151 | # Installshield output folder
152 | [Ee]xpress/
153 |
154 | # DocProject is a documentation generator add-in
155 | DocProject/buildhelp/
156 | DocProject/Help/*.HxT
157 | DocProject/Help/*.HxC
158 | DocProject/Help/*.hhc
159 | DocProject/Help/*.hhk
160 | DocProject/Help/*.hhp
161 | DocProject/Help/Html2
162 | DocProject/Help/html
163 |
164 | # Click-Once directory
165 | publish/
166 |
167 | # Publish Web Output
168 | *.[Pp]ublish.xml
169 | *.azurePubxml
170 | # Note: Comment the next line if you want to checkin your web deploy settings,
171 | # but database connection strings (with potential passwords) will be unencrypted
172 | *.pubxml
173 | *.publishproj
174 |
175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
176 | # checkin your Azure Web App publish settings, but sensitive information contained
177 | # in these scripts will be unencrypted
178 | PublishScripts/
179 |
180 | # NuGet Packages
181 | *.nupkg
182 | # The packages folder can be ignored because of Package Restore
183 | **/[Pp]ackages/*
184 | # except build/, which is used as an MSBuild target.
185 | !**/[Pp]ackages/build/
186 | # Uncomment if necessary however generally it will be regenerated when needed
187 | #!**/[Pp]ackages/repositories.config
188 | # NuGet v3's project.json files produces more ignorable files
189 | *.nuget.props
190 | *.nuget.targets
191 |
192 | # Microsoft Azure Build Output
193 | csx/
194 | *.build.csdef
195 |
196 | # Microsoft Azure Emulator
197 | ecf/
198 | rcf/
199 |
200 | # Windows Store app package directories and files
201 | AppPackages/
202 | BundleArtifacts/
203 | Package.StoreAssociation.xml
204 | _pkginfo.txt
205 | *.appx
206 |
207 | # Visual Studio cache files
208 | # files ending in .cache can be ignored
209 | *.[Cc]ache
210 | # but keep track of directories ending in .cache
211 | !*.[Cc]ache/
212 |
213 | # Others
214 | ClientBin/
215 | ~$*
216 | *~
217 | *.dbmdl
218 | *.dbproj.schemaview
219 | *.jfm
220 | *.pfx
221 | *.publishsettings
222 | orleans.codegen.cs
223 |
224 | # Including strong name files can present a security risk
225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
226 | #*.snk
227 |
228 | # Since there are multiple workflows, uncomment next line to ignore bower_components
229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
230 | #bower_components/
231 |
232 | # RIA/Silverlight projects
233 | Generated_Code/
234 |
235 | # Backup & report files from converting an old project file
236 | # to a newer Visual Studio version. Backup files are not needed,
237 | # because we have git ;-)
238 | _UpgradeReport_Files/
239 | Backup*/
240 | UpgradeLog*.XML
241 | UpgradeLog*.htm
242 | ServiceFabricBackup/
243 | *.rptproj.bak
244 |
245 | # SQL Server files
246 | *.mdf
247 | *.ldf
248 | *.ndf
249 |
250 | # Business Intelligence projects
251 | *.rdl.data
252 | *.bim.layout
253 | *.bim_*.settings
254 | *.rptproj.rsuser
255 |
256 | # Microsoft Fakes
257 | FakesAssemblies/
258 |
259 | # GhostDoc plugin setting file
260 | *.GhostDoc.xml
261 |
262 | # Node.js Tools for Visual Studio
263 | .ntvs_analysis.dat
264 | node_modules/
265 |
266 | # Visual Studio 6 build log
267 | *.plg
268 |
269 | # Visual Studio 6 workspace options file
270 | *.opt
271 |
272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
273 | *.vbw
274 |
275 | # Visual Studio LightSwitch build output
276 | **/*.HTMLClient/GeneratedArtifacts
277 | **/*.DesktopClient/GeneratedArtifacts
278 | **/*.DesktopClient/ModelManifest.xml
279 | **/*.Server/GeneratedArtifacts
280 | **/*.Server/ModelManifest.xml
281 | _Pvt_Extensions
282 |
283 | # Paket dependency manager
284 | .paket/paket.exe
285 | paket-files/
286 |
287 | # FAKE - F# Make
288 | .fake/
289 |
290 | # JetBrains Rider
291 | .idea/
292 | *.sln.iml
293 |
294 | # CodeRush
295 | .cr/
296 |
297 | # Python Tools for Visual Studio (PTVS)
298 | __pycache__/
299 | *.pyc
300 |
301 | # Cake - Uncomment if you are using it
302 | # tools/**
303 | # !tools/packages.config
304 |
305 | # Tabs Studio
306 | *.tss
307 |
308 | # Telerik's JustMock configuration file
309 | *.jmconfig
310 |
311 | # BizTalk build output
312 | *.btp.cs
313 | *.btm.cs
314 | *.odx.cs
315 | *.xsd.cs
316 |
317 | # OpenCover UI analysis results
318 | OpenCover/
319 |
320 | # Azure Stream Analytics local run output
321 | ASALocalRun/
322 |
323 | # MSBuild Binary and Structured Log
324 | *.binlog
325 |
326 | # NVidia Nsight GPU debugger configuration file
327 | *.nvuser
328 |
329 | # MFractors (Xamarin productivity tool) working folder
330 | .mfractor/
331 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## Face service tutorial changelog
2 |
3 | # 2.2.0 (2018-08-03)
4 |
5 | *Features*
6 |
7 | * Updated to target [Microsoft.Azure.CognitiveServices.Vision.Face 2.2.0-preview](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Vision.Face/2.2.0-preview) client library.
8 |
9 | *Bug Fixes*
10 |
11 | * none
12 |
13 | *Breaking Changes*
14 |
15 | * faceClient.BaseUri = new Uri(baseUri) -> faceClient.Endpoint = faceEndpoint
16 |
17 | # 2.0.0 (2018-07-09)
18 |
19 | *Features*
20 |
21 | * Updated to target [Microsoft.Azure.CognitiveServices.Vision.Face 2.0.0-preview](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Vision.Face/2.0.0-preview) client library.
22 |
23 | *Bug Fixes*
24 |
25 | * none
26 |
27 | *Breaking Changes*
28 |
29 | * IFaceAPI -> IFaceClient
30 | * faceAPI.AzureRegion = AzureRegions.Westcentralus -> faceClient.BaseUri = new Uri(baseUri)
31 |
32 | # 1.0.2 (2018-07-02)
33 |
34 | *Features*
35 |
36 | * Updated to target [Microsoft.Azure.CognitiveServices.Vision.Face 1.0.2-preview](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Vision.Face/1.0.2-preview) client library.
37 |
38 | *Bug Fixes*
39 |
40 | * none
41 |
42 | *Breaking Changes*
43 |
44 | * IFaceServiceClient -> IFaceAPI
45 | * Face[] -> IList<DetectedFace>
46 | * IEnumerable<FaceAttributeType> -> IList<FaceAttributeType>
47 | * IFaceServiceClient.DetectAsync -> IFaceAPI.DetectWithStreamAsync
48 | * FaceAPIException -> APIErrorException
49 | * EmotionScores -> Emotion
50 | * HairColor[] -> IList<HairColor>
51 |
52 |
53 | # 1.3.0 (2018-07-01)
54 |
55 | *Features*
56 |
57 | * Import of sample code from [Getting Started with Face API in C# Tutorial](https://docs.microsoft.com/en-us/azure/cognitive-services/face/tutorials/faceapiincsharptutorial).
58 | * Targets [Microsoft.ProjectOxford.Face 1.3.0](https://www.nuget.org/packages/Microsoft.ProjectOxford.Face/) client library (works with v1.4.0).
59 |
60 | *Bug Fixes*
61 |
62 | * Set `resizeFactor` to 1 for images that don't contain `dpi` info.
63 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to Face service tutorial
2 |
3 | This project welcomes contributions and suggestions. Most contributions require you to agree to a
4 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
5 | the rights to use your contribution. For details, visit https://cla.microsoft.com.
6 |
7 | When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
8 | a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
9 | provided by the bot. You will only need to do this once across all repos using our CLA.
10 |
11 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
12 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
13 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
14 |
15 | - [Code of Conduct](#coc)
16 | - [Issues and Bugs](#issue)
17 | - [Feature Requests](#feature)
18 | - [Submission Guidelines](#submit)
19 |
20 | ## Code of Conduct
21 | Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
22 |
23 | ## Found an Issue?
24 | If you find a bug in the source code or a mistake in the documentation, you can help us by
25 | [submitting an issue](#submit-issue) to the GitHub Repository. Even better, you can
26 | [submit a Pull Request](#submit-pr) with a fix.
27 |
28 | ## Want a Feature?
29 | You can *request* a new feature by [submitting an issue](#submit-issue) to the GitHub
30 | Repository. If you would like to *implement* a new feature, please submit an issue with
31 | a proposal for your work first, to be sure that we can use it.
32 |
33 | * **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
34 |
35 | ## Submission Guidelines
36 |
37 | ### Submitting an Issue
38 | Before you submit an issue, search the archive, maybe your question was already answered.
39 |
40 | If your issue appears to be a bug, and hasn't been reported, open a new issue.
41 | Help us to maximize the effort we can spend fixing issues and adding new
42 | features, by not reporting duplicate issues. Providing the following information will increase the
43 | chances of your issue being dealt with quickly:
44 |
45 | * **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps
46 | * **Version** - what version is affected (e.g. 0.1.2)
47 | * **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you
48 | * **Browsers and Operating System** - is this a problem with all browsers?
49 | * **Reproduce the Error** - provide a live example or a unambiguous set of steps
50 | * **Related Issues** - has a similar issue been reported before?
51 | * **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
52 | causing the problem (line of code or commit)
53 |
54 | You can file new issues by providing the above information at the corresponding repository's issues link: https://github.com/[organization-name]/[repository-name]/issues/new].
55 |
56 | ### Submitting a Pull Request (PR)
57 | Before you submit your Pull Request (PR) consider the following guidelines:
58 |
59 | * Search the repository (https://github.com/[organization-name]/[repository-name]/pulls) for an open or closed PR
60 | that relates to your submission. You don't want to duplicate effort.
61 |
62 | * Make your changes in a new git fork:
63 |
64 | * Commit your changes using a descriptive commit message
65 | * Push your fork to GitHub:
66 | * In GitHub, create a pull request
67 | * If we suggest changes then:
68 | * Make the required updates.
69 | * Rebase your fork and force push to your GitHub repository (this will update your Pull Request):
70 |
71 | ```shell
72 | git rebase master -i
73 | git push -f
74 | ```
75 |
76 | That's it! Thank you for your contribution!
77 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27703.2026
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FaceTutorialCS", "FaceTutorialCS\FaceTutorialCS.csproj", "{E4D4BF66-7E51-4880-A028-D48A12E2F487}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {E4D4BF66-7E51-4880-A028-D48A12E2F487}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {E4D4BF66-7E51-4880-A028-D48A12E2F487}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {E4D4BF66-7E51-4880-A028-D48A12E2F487}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {E4D4BF66-7E51-4880-A028-D48A12E2F487}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {97E376D0-FB30-431C-B268-A31BDFDF62F5}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace FaceTutorialCS
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS/FaceTutorialCS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {E4D4BF66-7E51-4880-A028-D48A12E2F487}
8 | WinExe
9 | FaceTutorialCS
10 | FaceTutorialCS
11 | v4.6.1
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 | ..\packages\Microsoft.Azure.CognitiveServices.Vision.Face.2.6.0-preview.1\lib\net461\Microsoft.Azure.CognitiveServices.Vision.Face.dll
39 |
40 |
41 | ..\packages\Microsoft.Rest.ClientRuntime.2.3.12\lib\net452\Microsoft.Rest.ClientRuntime.dll
42 |
43 |
44 | ..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.13\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll
45 |
46 |
47 | ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | 4.0
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | MSBuild:Compile
71 | Designer
72 |
73 |
74 | MSBuild:Compile
75 | Designer
76 |
77 |
78 | App.xaml
79 | Code
80 |
81 |
82 | MainWindow.xaml
83 | Code
84 |
85 |
86 |
87 |
88 | Code
89 |
90 |
91 | True
92 | True
93 | Resources.resx
94 |
95 |
96 | True
97 | Settings.settings
98 | True
99 |
100 |
101 | ResXFileCodeGenerator
102 | Resources.Designer.cs
103 |
104 |
105 | Designer
106 |
107 |
108 | SettingsSingleFileGenerator
109 | Settings.Designer.cs
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | //
2 | using Microsoft.Azure.CognitiveServices.Vision.Face;
3 | using Microsoft.Azure.CognitiveServices.Vision.Face.Models;
4 |
5 | using System;
6 | using System.Collections.Generic;
7 | using System.IO;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | //
15 |
16 | namespace FaceTutorial
17 | {
18 | public partial class MainWindow : Window
19 | {
20 | //
21 | // Add your Face subscription key to your environment variables.
22 | private static string subscriptionKey = Environment.GetEnvironmentVariable("FACE_SUBSCRIPTION_KEY");
23 | // Add your Face endpoint to your environment variables.
24 | private static string faceEndpoint = Environment.GetEnvironmentVariable("FACE_ENDPOINT");
25 |
26 | private readonly IFaceClient faceClient = new FaceClient(
27 | new ApiKeyServiceClientCredentials(subscriptionKey),
28 | new System.Net.Http.DelegatingHandler[] { });
29 |
30 | // The list of detected faces.
31 | private IList faceList;
32 | // The list of descriptions for the detected faces.
33 | private string[] faceDescriptions;
34 | // The resize factor for the displayed image.
35 | private double resizeFactor;
36 |
37 | private const string defaultStatusBarText =
38 | "Place the mouse pointer over a face to see the face description.";
39 | //
40 |
41 | //
42 | public MainWindow()
43 | {
44 | InitializeComponent();
45 |
46 | if (Uri.IsWellFormedUriString(faceEndpoint, UriKind.Absolute))
47 | {
48 | faceClient.Endpoint = faceEndpoint;
49 | }
50 | else
51 | {
52 | MessageBox.Show(faceEndpoint,
53 | "Invalid URI", MessageBoxButton.OK, MessageBoxImage.Error);
54 | Environment.Exit(0);
55 | }
56 | }
57 | //
58 |
59 | //
60 | // Displays the image and calls UploadAndDetectFaces.
61 | private async void BrowseButton_Click(object sender, RoutedEventArgs e)
62 | {
63 | // Get the image file to scan from the user.
64 | var openDlg = new Microsoft.Win32.OpenFileDialog();
65 |
66 | openDlg.Filter = "JPEG Image(*.jpg)|*.jpg";
67 | bool? result = openDlg.ShowDialog(this);
68 |
69 | // Return if canceled.
70 | if (!(bool)result)
71 | {
72 | return;
73 | }
74 |
75 | // Display the image file.
76 | string filePath = openDlg.FileName;
77 |
78 | Uri fileUri = new Uri(filePath);
79 | BitmapImage bitmapSource = new BitmapImage();
80 |
81 | bitmapSource.BeginInit();
82 | bitmapSource.CacheOption = BitmapCacheOption.None;
83 | bitmapSource.UriSource = fileUri;
84 | bitmapSource.EndInit();
85 |
86 | FacePhoto.Source = bitmapSource;
87 | //
88 |
89 | //
90 | // Detect any faces in the image.
91 | Title = "Detecting...";
92 | faceList = await UploadAndDetectFaces(filePath);
93 | Title = String.Format(
94 | "Detection Finished. {0} face(s) detected", faceList.Count);
95 |
96 | if (faceList.Count > 0)
97 | {
98 | // Prepare to draw rectangles around the faces.
99 | DrawingVisual visual = new DrawingVisual();
100 | DrawingContext drawingContext = visual.RenderOpen();
101 | drawingContext.DrawImage(bitmapSource,
102 | new Rect(0, 0, bitmapSource.Width, bitmapSource.Height));
103 | double dpi = bitmapSource.DpiX;
104 | // Some images don't contain dpi info.
105 | resizeFactor = (dpi == 0) ? 1 : 96 / dpi;
106 | faceDescriptions = new String[faceList.Count];
107 |
108 | for (int i = 0; i < faceList.Count; ++i)
109 | {
110 | DetectedFace face = faceList[i];
111 |
112 | // Draw a rectangle on the face.
113 | drawingContext.DrawRectangle(
114 | Brushes.Transparent,
115 | new Pen(Brushes.Red, 2),
116 | new Rect(
117 | face.FaceRectangle.Left * resizeFactor,
118 | face.FaceRectangle.Top * resizeFactor,
119 | face.FaceRectangle.Width * resizeFactor,
120 | face.FaceRectangle.Height * resizeFactor
121 | )
122 | );
123 |
124 | // Store the face description.
125 | faceDescriptions[i] = FaceDescription(face);
126 | }
127 |
128 | drawingContext.Close();
129 |
130 | // Display the image with the rectangle around the face.
131 | RenderTargetBitmap faceWithRectBitmap = new RenderTargetBitmap(
132 | (int)(bitmapSource.PixelWidth * resizeFactor),
133 | (int)(bitmapSource.PixelHeight * resizeFactor),
134 | 96,
135 | 96,
136 | PixelFormats.Pbgra32);
137 |
138 | faceWithRectBitmap.Render(visual);
139 | FacePhoto.Source = faceWithRectBitmap;
140 |
141 | // Set the status bar text.
142 | faceDescriptionStatusBar.Text = defaultStatusBarText;
143 | }
144 | //
145 | //
146 | }
147 | //
148 |
149 | //
150 | // Displays the face description when the mouse is over a face rectangle.
151 | private void FacePhoto_MouseMove(object sender, MouseEventArgs e)
152 | {
153 | //
154 |
155 | //
156 | // If the REST call has not completed, return.
157 | if (faceList == null)
158 | return;
159 |
160 | // Find the mouse position relative to the image.
161 | Point mouseXY = e.GetPosition(FacePhoto);
162 |
163 | ImageSource imageSource = FacePhoto.Source;
164 | BitmapSource bitmapSource = (BitmapSource)imageSource;
165 |
166 | // Scale adjustment between the actual size and displayed size.
167 | var scale = FacePhoto.ActualWidth / (bitmapSource.PixelWidth / resizeFactor);
168 |
169 | // Check if this mouse position is over a face rectangle.
170 | bool mouseOverFace = false;
171 |
172 | for (int i = 0; i < faceList.Count; ++i)
173 | {
174 | FaceRectangle fr = faceList[i].FaceRectangle;
175 | double left = fr.Left * scale;
176 | double top = fr.Top * scale;
177 | double width = fr.Width * scale;
178 | double height = fr.Height * scale;
179 |
180 | // Display the face description if the mouse is over this face rectangle.
181 | if (mouseXY.X >= left && mouseXY.X <= left + width &&
182 | mouseXY.Y >= top && mouseXY.Y <= top + height)
183 | {
184 | faceDescriptionStatusBar.Text = faceDescriptions[i];
185 | mouseOverFace = true;
186 | break;
187 | }
188 | }
189 |
190 | // String to display when the mouse is not over a face rectangle.
191 | if (!mouseOverFace) faceDescriptionStatusBar.Text = defaultStatusBarText;
192 | //
193 | //
194 | }
195 | //
196 |
197 | //
198 | // Uploads the image file and calls DetectWithStreamAsync.
199 | private async Task> UploadAndDetectFaces(string imageFilePath)
200 | {
201 | // The list of Face attributes to return.
202 | IList faceAttributes =
203 | new FaceAttributeType?[]
204 | {
205 | FaceAttributeType.Gender, FaceAttributeType.Age,
206 | FaceAttributeType.Smile, FaceAttributeType.Emotion,
207 | FaceAttributeType.Glasses, FaceAttributeType.Hair
208 | };
209 |
210 | // Call the Face API.
211 | try
212 | {
213 | using (Stream imageFileStream = File.OpenRead(imageFilePath))
214 | {
215 | // The second argument specifies to return the faceId, while
216 | // the third argument specifies not to return face landmarks.
217 | IList faceList =
218 | await faceClient.Face.DetectWithStreamAsync(
219 | imageFileStream, true, false, faceAttributes);
220 | return faceList;
221 | }
222 | }
223 | // Catch and display Face API errors.
224 | catch (APIErrorException f)
225 | {
226 | MessageBox.Show(f.Message);
227 | return new List();
228 | }
229 | // Catch and display all other errors.
230 | catch (Exception e)
231 | {
232 | MessageBox.Show(e.Message, "Error");
233 | return new List();
234 | }
235 | }
236 | //
237 |
238 | //
239 | // Creates a string out of the attributes describing the face.
240 | private string FaceDescription(DetectedFace face)
241 | {
242 | StringBuilder sb = new StringBuilder();
243 |
244 | sb.Append("Face: ");
245 |
246 | // Add the gender, age, and smile.
247 | sb.Append(face.FaceAttributes.Gender);
248 | sb.Append(", ");
249 | sb.Append(face.FaceAttributes.Age);
250 | sb.Append(", ");
251 | sb.Append(String.Format("smile {0:F1}%, ", face.FaceAttributes.Smile * 100));
252 |
253 | // Add the emotions. Display all emotions over 10%.
254 | sb.Append("Emotion: ");
255 | Emotion emotionScores = face.FaceAttributes.Emotion;
256 | if (emotionScores.Anger >= 0.1f) sb.Append(
257 | String.Format("anger {0:F1}%, ", emotionScores.Anger * 100));
258 | if (emotionScores.Contempt >= 0.1f) sb.Append(
259 | String.Format("contempt {0:F1}%, ", emotionScores.Contempt * 100));
260 | if (emotionScores.Disgust >= 0.1f) sb.Append(
261 | String.Format("disgust {0:F1}%, ", emotionScores.Disgust * 100));
262 | if (emotionScores.Fear >= 0.1f) sb.Append(
263 | String.Format("fear {0:F1}%, ", emotionScores.Fear * 100));
264 | if (emotionScores.Happiness >= 0.1f) sb.Append(
265 | String.Format("happiness {0:F1}%, ", emotionScores.Happiness * 100));
266 | if (emotionScores.Neutral >= 0.1f) sb.Append(
267 | String.Format("neutral {0:F1}%, ", emotionScores.Neutral * 100));
268 | if (emotionScores.Sadness >= 0.1f) sb.Append(
269 | String.Format("sadness {0:F1}%, ", emotionScores.Sadness * 100));
270 | if (emotionScores.Surprise >= 0.1f) sb.Append(
271 | String.Format("surprise {0:F1}%, ", emotionScores.Surprise * 100));
272 |
273 | // Add glasses.
274 | sb.Append(face.FaceAttributes.Glasses);
275 | sb.Append(", ");
276 |
277 | // Add hair.
278 | sb.Append("Hair: ");
279 |
280 | // Display baldness confidence if over 1%.
281 | if (face.FaceAttributes.Hair.Bald >= 0.01f)
282 | sb.Append(String.Format("bald {0:F1}% ", face.FaceAttributes.Hair.Bald * 100));
283 |
284 | // Display all hair color attributes over 10%.
285 | IList hairColors = face.FaceAttributes.Hair.HairColor;
286 | foreach (HairColor hairColor in hairColors)
287 | {
288 | if (hairColor.Confidence >= 0.1f)
289 | {
290 | sb.Append(hairColor.Color.ToString());
291 | sb.Append(String.Format(" {0:F1}% ", hairColor.Confidence * 100));
292 | }
293 | }
294 |
295 | // Return the built string.
296 | return sb.ToString();
297 | }
298 | //
299 | }
300 | }
301 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft. All rights reserved.
3 | // Licensed under the MIT license.
4 | //
5 | // Microsoft Cognitive Services (formerly Project Oxford): https://www.microsoft.com/cognitive-services
6 | //
7 | // Microsoft Cognitive Services (formerly Project Oxford) GitHub:
8 | // https://github.com/Microsoft/Cognitive
9 | //
10 | // Copyright (c) Microsoft Corporation
11 | // All rights reserved.
12 | //
13 | // MIT License:
14 | // Permission is hereby granted, free of charge, to any person obtaining
15 | // a copy of this software and associated documentation files (the
16 | // "Software"), to deal in the Software without restriction, including
17 | // without limitation the rights to use, copy, modify, merge, publish,
18 | // distribute, sublicense, and/or sell copies of the Software, and to
19 | // permit persons to whom the Software is furnished to do so, subject to
20 | // the following conditions:
21 | //
22 | // The above copyright notice and this permission notice shall be
23 | // included in all copies or substantial portions of the Software.
24 | //
25 | // THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
26 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 | //
33 |
34 | using System.Reflection;
35 | using System.Runtime.InteropServices;
36 | using System.Windows;
37 |
38 | // General Information about an assembly is controlled through the following
39 | // set of attributes. Change these attribute values to modify the information
40 | // associated with an assembly.
41 | [assembly: AssemblyTitle("FaceTutorialCS")]
42 | [assembly: AssemblyDescription("")]
43 | [assembly: AssemblyConfiguration("")]
44 | [assembly: AssemblyCompany("Microsoft")]
45 | [assembly: AssemblyProduct("FaceTutorialCS")]
46 | [assembly: AssemblyCopyright("Copyright © 2017 Microsoft")]
47 | [assembly: AssemblyTrademark("Microsoft")]
48 | [assembly: AssemblyCulture("")]
49 |
50 | // Setting ComVisible to false makes the types in this assembly not visible
51 | // to COM components. If you need to access a type in this assembly from
52 | // COM, set the ComVisible attribute to true on that type.
53 | [assembly: ComVisible(false)]
54 |
55 | //In order to begin building localizable applications, set
56 | //CultureYouAreCodingWith in your .csproj file
57 | //inside a . For example, if you are using US english
58 | //in your source files, set the to en-US. Then uncomment
59 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
60 | //the line below to match the UICulture setting in the project file.
61 |
62 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
63 |
64 |
65 | [assembly: ThemeInfo(
66 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
67 | //(used if a resource is not found in the page,
68 | // or application resource dictionaries)
69 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
70 | //(used if a resource is not found in the page,
71 | // app, or any theme specific resource dictionaries)
72 | )]
73 |
74 |
75 | // Version information for an assembly consists of the following four values:
76 | //
77 | // Major Version
78 | // Minor Version
79 | // Build Number
80 | // Revision
81 | //
82 | // You can specify all the values or you can default the Build and Revision Numbers
83 | // by using the '*' as shown below:
84 | // [assembly: AssemblyVersion("1.0.*")]
85 | [assembly: AssemblyVersion("2.2.0.0")]
86 | [assembly: AssemblyFileVersion("2.2.0.0")]
87 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace FaceTutorialCS.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FaceTutorialCS.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace FaceTutorialCS.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/FaceTutorialCS/FaceTutorialCS/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Microsoft Corporation. All rights reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | page_type: sample
3 | languages:
4 | - csharp
5 | products:
6 | - azure
7 | description: "This repository contains the sample discussed in Create a WPF app to detect and frame faces in an image."
8 | urlFragment: Cognitive-Face-CSharp-sample
9 | ---
10 |
11 | # Detect and frame faces in an image on Windows
12 |
13 | > **Note:**
14 | > This repository has been archived. Please visit [aka.ms/FaceSamples](https://aka.ms/FaceSamples) to get started with the latest Face SDK samples.
15 |
16 | This repository contains the sample discussed in [Create a WPF app to detect and frame faces in an image](https://docs.microsoft.com/en-us/azure/cognitive-services/face/tutorials/faceapiincsharptutorial). The sample uses the Windows client library for the Cognitive Services Face service.
17 |
18 | ## Features
19 |
20 | This project provides the following features:
21 |
22 | * Detects faces in an image.
23 | * Draws a rectangle around each face.
24 | * Displays face attributes in the status bar when the mouse hovers over each face rectangle.
25 |
26 | 
27 |
28 | ## Getting Started
29 |
30 | ### Prerequisites
31 |
32 | - You need a subscription key to run the sample. [Create a new Azure account, and try Cognitive Services for free.](https://azure.microsoft.com/free/cognitive-services/)
33 | - Any edition of [Visual Studio 2015 or 2017](https://www.visualstudio.com/downloads/). For Visual Studio 2017, the .NET Desktop application development workload is required.
34 | - The [Microsoft.Azure.CognitiveServices.Vision.Face 2.2.0-preview](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Vision.Face/2.2.0-preview) client library NuGet package. Download not necessary.
35 |
36 | ### Quickstart
37 |
38 | 1. Clone or download the repository.
39 | 1. Open the *FaceTutorialCS* folder in the repository.
40 | 1. Double-click the *FaceTutorialCS.sln* file, which opens in Visual Studio.
41 | 1. Expand *MainWindow.xaml*, then open *MainWindow.xaml.cs*.
42 | 1. Replace `` with your valid subscription key.
43 | 1. Replace or verify the Azure region (`faceEndpoint`) associated with your key.
44 | 1. Build the project, which installs the Face service NuGet package.
45 | 1. Run the program.
46 | 1. Browse and select an image containing faces.
47 | 1. Wait a few seconds for the Face service to respond.
48 | 1. Move your mouse over a face rectangle to see a description of that face on the status bar.
49 |
50 | For more information, see [Getting Started with Face API in C# Tutorial](https://docs.microsoft.com/en-us/azure/cognitive-services/face/tutorials/faceapiincsharptutorial).
51 |
52 | ## Resources
53 |
54 | - [Face service documentation](https://docs.microsoft.com/en-us/azure/cognitive-services/face/)
55 | - [Face API](https://docs.microsoft.com/en-us/azure/cognitive-services/face/apireference)
56 |
--------------------------------------------------------------------------------