Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit b469c42

Browse files
yungshinlintwProject Oxford SDK
authored andcommitted
Microsoft Cognitive Services SDK Release - June 2016
1 parent 3615923 commit b469c42

File tree

43 files changed

+581
-223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+581
-223
lines changed

Emotion/Android/.gitignore

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
.gradle
2-
local.properties
3-
.idea/
4-
.idea/libraries
5-
.DS_Store
1+
# Generated files
2+
bin/
3+
gen/
4+
out/
65
build/
6+
7+
# OS specific files
8+
.DS_Store
9+
10+
# IntelliJ / Android studio configuration files
11+
.idea/
712
*.iml
13+
14+
# Gradle generated files
15+
.gradle/
16+
17+
# Local config (e.g. sdk path)
18+
local.properties

Emotion/Android/ClientLibrary/lib/src/main/java/com/microsoft/projectoxford/emotion/contract/Scores.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ public class Scores {
4949
public double neutral;
5050
public double sadness;
5151
public double surprise;
52-
52+
5353
public List<Map.Entry<String, Double>> ToRankedList(Order order)
5454
{
55-
55+
5656
// create a Map to store each entry
5757
Map<String, Double> collection = new HashMap<String, Double>() ;
58-
58+
5959
// add each entry with its own key and value
6060
collection.put("ANGER",anger);
6161
collection.put("CONTEMPT",contempt);
@@ -68,9 +68,9 @@ public List<Map.Entry<String, Double>> ToRankedList(Order order)
6868

6969
// create a list with the entries
7070
List<Map.Entry<String, Double>> list = new ArrayList<Map.Entry<String, Double>>(collection.entrySet());
71-
71+
7272
// we are going to create a comparator according to the value of the enum order
73-
switch (order)
73+
switch (order)
7474
{
7575
case ASCENDING:
7676
Collections.sort(list, new Comparator<Map.Entry<String, Double>>() {
@@ -81,22 +81,22 @@ public int compare(Entry<String, Double> first, Entry<String, Double> second) {
8181
}
8282
});
8383
break;
84-
84+
8585
case DESCENDING:
86-
// for ordering descending we should create a reverse order comparator
86+
// for ordering descending we should create a reverse order comparator
8787
Collections.sort(list, Collections.reverseOrder(new Comparator<Map.Entry<String, Double>>() {
8888
@Override
8989
public int compare(Entry<String, Double> first, Entry<String, Double> second) {
9090
return first.getValue().compareTo(second.getValue());
9191
}
92-
}));
92+
}));
9393
break;
94-
94+
9595
default:
9696
break;
9797
}
9898

9999
return list;
100-
100+
101101
}
102102
}

Emotion/Android/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ The client library
22
==================
33

44
The Emotion API client library is a thin Java client wrapper for Microsoft Cognitive Services (formerly Project Oxford)
5-
Emotion REST APIs.
5+
Emotion REST APIs.
66

77
The easiest way to consume the client library is to add com.microsoft.projectoxford.emotion package from Maven Central Repository.
88

@@ -31,7 +31,7 @@ To do add the client library dependency from Android Studio:
3131
6. Type "com.microsoft.projectoxford" and hit the search icon from "Choose Library Dependency" dialog
3232
7. Pick the Project Oxford client library that you intend to use.
3333
8. Click "OK" to add the new dependency
34-
34+
3535
Order expressions
3636
============
3737

@@ -45,7 +45,7 @@ List<Map.Entry<String, Double>> collection = scores.ToRankedList(Order.ASCENDING
4545
DESCENDING
4646
```
4747
List<Map.Entry<String, Double>> collection = scores.ToRankedList(Order.DESCENDING);
48-
48+
4949
```
5050

5151
The sample

Emotion/Android/Sample/.gitignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

Emotion/Android/Sample/app/src/main/java/com/microsoft/projectoxford/emotionsample/RecognizeActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,9 @@ protected void onPostExecute(List<RecognizeResult> result) {
307307
mEditText.append("No emotion detected :(");
308308
} else {
309309
Integer count = 0;
310-
Canvas faceCanvas = new Canvas(mBitmap);
310+
// Covert bitmap to a mutable bitmap by copying it
311+
Bitmap bitmapCopy = mBitmap.copy(Bitmap.Config.ARGB_8888, true);
312+
Canvas faceCanvas = new Canvas(bitmapCopy);
311313
faceCanvas.drawBitmap(mBitmap, 0, 0, null);
312314
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
313315
paint.setStyle(Paint.Style.STROKE);

Emotion/Android/Sample/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:1.3.0'
8+
classpath 'com.android.tools.build:gradle:2.1.0'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Apr 10 15:27:10 PDT 2013
1+
#Fri Jun 03 14:18:22 PDT 2016
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

Emotion/Python/Jupyter Notebook/Emotion Analysis Example.ipynb

Lines changed: 28 additions & 43 deletions
Large diffs are not rendered by default.

Emotion/Windows/ClientLibrary/Contract/Scores.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public class Scores
7575
///
7676
/// </summary>
7777
public float Surprise { get; set; }
78-
78+
7979
/// <summary>
8080
/// Create a sorted key-value pair of emotions and the corresponding scores, sorted from highest score on down.
8181
/// To make the ordering stable, the score is the primary key, and the name is the secondary key.

Emotion/Windows/ClientLibrary/Microsoft.ProjectOxford.Emotion.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<Compile Include="Properties\AssemblyInfo.cs" />
4747
</ItemGroup>
4848
<ItemGroup>
49-
<Reference Include="Microsoft.ProjectOxford.Common, Version=1.0.250.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
49+
<Reference Include="Microsoft.ProjectOxford.Common, Version=1.0.250, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5050
<HintPath>packages\Microsoft.ProjectOxford.Common.1.0.250\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\Microsoft.ProjectOxford.Common.dll</HintPath>
5151
<Private>True</Private>
5252
</Reference>

0 commit comments

Comments
 (0)