Compare commits
8 Commits
jiangyuwei
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92ee55ad2d | ||
|
|
b8507aa536 | ||
|
|
1c55b40f9e | ||
|
|
a5e5c526a9 | ||
|
|
f9ed1012f2 | ||
|
|
d140116e1f | ||
|
|
e86e8c4c4e | ||
|
|
be3abe90b1 |
169
NutritionMaster/.gitignore
vendored
Normal file
169
NutritionMaster/.gitignore
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
|
||||
# Created by https://www.gitignore.io/api/android,androidstudio
|
||||
|
||||
### Android ###
|
||||
# Built application files
|
||||
*.apk
|
||||
*.ap_
|
||||
|
||||
# Files for the ART/Dalvik VM
|
||||
*.dex
|
||||
|
||||
# Java class files
|
||||
*.class
|
||||
|
||||
# Generated files
|
||||
bin/
|
||||
gen/
|
||||
out/
|
||||
|
||||
# Gradle files
|
||||
.gradle/
|
||||
build/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
|
||||
# Proguard folder generated by Eclipse
|
||||
proguard/
|
||||
|
||||
# Log Files
|
||||
*.log
|
||||
|
||||
# Android Studio Navigation editor temp files
|
||||
.navigation/
|
||||
|
||||
# Android Studio captures folder
|
||||
captures/
|
||||
|
||||
# Intellij
|
||||
*.iml
|
||||
.idea/workspace.xml
|
||||
.idea/tasks.xml
|
||||
.idea/gradle.xml
|
||||
.idea/dictionaries
|
||||
.idea/libraries
|
||||
|
||||
# External native build folder generated in Android Studio 2.2 and later
|
||||
.externalNativeBuild
|
||||
|
||||
# Freeline
|
||||
freeline.py
|
||||
freeline/
|
||||
freeline_project_description.json
|
||||
|
||||
### Android Patch ###
|
||||
gen-external-apklibs
|
||||
|
||||
### AndroidStudio ###
|
||||
# Covers files to be ignored for android development using Android Studio.
|
||||
|
||||
# Built application files
|
||||
|
||||
# Files for the ART/Dalvik VM
|
||||
|
||||
# Java class files
|
||||
|
||||
# Generated files
|
||||
|
||||
# Gradle files
|
||||
.gradle
|
||||
|
||||
# Signing files
|
||||
.signing/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
|
||||
# Proguard folder generated by Eclipse
|
||||
|
||||
# Log Files
|
||||
|
||||
# Android Studio
|
||||
/*/build/
|
||||
/*/local.properties
|
||||
/*/out
|
||||
/*/*/build
|
||||
/*/*/production
|
||||
*.ipr
|
||||
*~
|
||||
*.swp
|
||||
|
||||
# Android Patch
|
||||
|
||||
# External native build folder generated in Android Studio 2.2 and later
|
||||
|
||||
# NDK
|
||||
obj/
|
||||
|
||||
# IntelliJ IDEA
|
||||
*.iws
|
||||
/out/
|
||||
|
||||
# User-specific configurations
|
||||
.idea/caches/
|
||||
.idea/libraries/
|
||||
.idea/shelf/
|
||||
.idea/.name
|
||||
.idea/compiler.xml
|
||||
.idea/copyright/profiles_settings.xml
|
||||
.idea/encodings.xml
|
||||
.idea/misc.xml
|
||||
.idea/modules.xml
|
||||
.idea/scopes/scope_settings.xml
|
||||
.idea/vcs.xml
|
||||
.idea/jsLibraryMappings.xml
|
||||
.idea/datasources.xml
|
||||
.idea/dataSources.ids
|
||||
.idea/sqlDataSources.xml
|
||||
.idea/dynamic.xml
|
||||
.idea/uiDesigner.xml
|
||||
|
||||
# OS-specific files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Legacy Eclipse project files
|
||||
.classpath
|
||||
.project
|
||||
.cproject
|
||||
.settings/
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml)
|
||||
hs_err_pid*
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/mongoSettings.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
### AndroidStudio Patch ###
|
||||
|
||||
!/gradle/wrapper/gradle-wrapper.jar
|
||||
app/src/main/java/.vscode
|
||||
.vscode
|
||||
|
||||
# End of https://www.gitignore.io/api/android,androidstudio
|
||||
@@ -212,38 +212,31 @@ public class ClassifierCamera extends AppCompatActivity {
|
||||
public void run() {
|
||||
String result = null;
|
||||
try {
|
||||
if (code == MATERAIL_CODE) {
|
||||
// MaterialClassifier materialClassifier = new MaterialClassifier();
|
||||
// JSONObject jsonObject = materialClassifier.plantDetect(data);
|
||||
// result = jsonObject.getJSONArray("objects")
|
||||
// .getJSONObject(0).getString("value");
|
||||
// translate(result);
|
||||
result = WebUtil.HttpPost(ConstantUtils.BD_MATERIAL_URL,
|
||||
ConstantUtils.BD_ACCESS_TOKEN, param);
|
||||
Logger.d(result);
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
JSONArray resultObject = jsonObject.getJSONArray("result");
|
||||
jsonObject = resultObject.getJSONObject(0);
|
||||
ClassifyResult classifyResult = new ClassifyResult(ClassifyResult.MATERIAL);
|
||||
classifyResult.setName(jsonObject.getString("name"));
|
||||
resultList.add(classifyResult);
|
||||
refreshUI();
|
||||
} else if (code == DISH_CODE) {
|
||||
result = WebUtil.HttpPost(ConstantUtils.BD_DISH_URL,
|
||||
ConstantUtils.BD_ACCESS_TOKEN, param);
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
ClassifyResult classifyResult = new ClassifyResult(ClassifyResult.DISH);
|
||||
JSONArray resultObject = jsonObject.getJSONArray("result");
|
||||
jsonObject = resultObject.getJSONObject(0);
|
||||
classifyResult.setCalorie(jsonObject.getInt("calorie"));
|
||||
Logger.d(jsonObject.getInt("calorie"));
|
||||
classifyResult.setHas_calorie(jsonObject.getBoolean("has_calorie"));
|
||||
classifyResult.setProbability(jsonObject.getDouble("probability"));
|
||||
classifyResult.setName(jsonObject.getString("name"));
|
||||
classifyResult.getMenu();
|
||||
classifyResult.setImgPath(picturePath);
|
||||
resultList.add(classifyResult);
|
||||
refreshUI();
|
||||
// if (code == MATERAIL_CODE) {
|
||||
// // MaterialClassifier materialClassifier = new MaterialClassifier();
|
||||
// // JSONObject jsonObject = materialClassifier.plantDetect(data);
|
||||
// //
|
||||
// Logger.d(result);
|
||||
// JSONObject jsonObject = new JSONObject(result);
|
||||
// JSONArray resultObject = jsonObject.getJSONArray("result");
|
||||
// jsonObject = resultObject.getJSONObject(0);
|
||||
// ClassifyResult classifyResult = new ClassifyResult(ClassifyResult.MATERIAL);
|
||||
// classifyResult.setName(jsonObject.getString("name"));
|
||||
// resultList.add(classifyResult);
|
||||
// refreshUI();
|
||||
// } else if (code == DISH_CODE) {
|
||||
// ClassifyResult classifyResult = new ClassifyResult(ClassifyResult.DISH);
|
||||
// JSONArray resultObject = jsonObject.getJSONArray("result");
|
||||
// jsonObject = resultObject.getJSONObject(0);
|
||||
// classifyResult.setCalorie(jsonObject.getInt("calorie"));
|
||||
// Logger.d(jsonObject.getInt("calorie"));
|
||||
// classifyResult.setHas_calorie(jsonObject.getBoolean("has_calorie"));
|
||||
// classifyResult.setProbability(jsonObject.getDouble("probability"));
|
||||
// classifyResult.setName(jsonObject.getString("name"));
|
||||
// classifyResult.getMenu();
|
||||
// classifyResult.setImgPath(picturePath);
|
||||
// resultList.add(classifyResult);
|
||||
// refreshUI();
|
||||
} else {
|
||||
Logger.e("拍照code为-1");
|
||||
}
|
||||
|
||||
@@ -277,9 +277,6 @@ public class ConstantUtils {
|
||||
public static String BD_SECRET_KEY = "EEXe6pG7QGVdrqDM8eR0S3RY2WPf4Gwn";
|
||||
public static String BD_ACCESS_TOKEN = "";
|
||||
|
||||
public static String BD_DISH_URL = "https://aip.baidubce.com/rest/2.0/image-classify/v2/dish";
|
||||
public static String BD_MATERIAL_URL = "https://aip.baidubce.com/rest/2.0/image-classify/v1/classify/ingredient";
|
||||
|
||||
// public static ArrayList<ClassifyResult> testData = new ArrayList<>();
|
||||
//
|
||||
// static {
|
||||
|
||||
Reference in New Issue
Block a user