Android Wrapper for the Microsoft Project Oxford Emotion API.
compile 'com.pacioianu.david:emotion-analysis-api:1.1.0'
First, init EmotionAnalysis in your application
EmotionRestClient.init(context, <subscription_key>);
Asynchronous:
EmotionRestClient.getInstance().detect(<your uri/url/bitmap>, new ResponseCallback() {
@Override
public void onError(String errorMessage) {
Toast.makeText(context, errorMessage, Toast.LENGTH_LONG).show();
}
@Override
public void onSuccess(FaceAnalysis[] response) {
Toast.makeText(context, context.getString(R.string.successfully_analysed), Toast.LENGTH_LONG).show();
}
});
Synchronous:
EmotionRestClient.getInstance().detect(<your uri/url/bitmap>);
Sample response
[
{
"faceRectangle": {
"left": 523,
"top": 293,
"width": 522,
"height": 522
},
"scores": {
"anger": 0.231301255,
"contempt": 0.00228384347,
"disgust": 0.013675208,
"fear": 0.0000379959965,
"happiness": 0.000004979391,
"neutral": 0.582898065,
"sadness": 0.1897379,
"surprise": 0.0000607591355
}
}
]
(feel free to send me your project)
Icon | Application |
---|---|
Facelyse |
Looking for contributors, feel free to fork !
- Retrofit 2.0 from Square: https://github.com/square/retrofit
- GSON from Google: https://github.com/google/gson
Author: David Pacioianu www.david.pacioianu.com/
Copyright 2016 David Păcioianu
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.