嗨我目前正在研究android中的口腔检测, 但是,每次我将继续工作,它总是粉碎,请帮助我
package com.example.chuba;
import static com.googlecode.javacv.cpp.opencv_core.cvClearMemStorage;
import static com.googlecode.javacv.cpp.opencv_core.cvLoad;
import static com.googlecode.javacv.cpp.opencv_highgui.cvLoadImage;
import static com.googlecode.javacv.cpp.opencv_objdetect.CV_HAAR_DO_CANNY_PRUNING;
import static com.googlecode.javacv.cpp.opencv_objdetect.cvHaarDetectObjects;
import com.googlecode.javacv.cpp.opencv_core.CvMemStorage;
import com.googlecode.javacv.cpp.opencv_core.CvSeq;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
import com.googlecode.javacv.cpp.opencv_objdetect.CvHaarClassifierCascade;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
open();
}
public void open(){
TextView v = (TextView)findViewById(R.id.detect);
final String XML_FILE =
"C://Users//Michelle//adt-bundle-windows-x86-20140702//Chuba//src//com//example//chuba//haarcascade_mcs_mouth.xml";
IplImage img = cvLoadImage("C://Users//Michelle//adt-bundle-windows-x86-20140702//Chuba//src//com//example//chuba//michelle.jpg");
try{
CvHaarClassifierCascade cascade = new
CvHaarClassifierCascade(cvLoad(XML_FILE));
CvMemStorage storage = CvMemStorage.create();
CvSeq sign = cvHaarDetectObjects(
img,
cascade,
storage,
1.5,
25,
CV_HAAR_DO_CANNY_PRUNING);
cvClearMemStorage(storage);
int total_Faces = sign.total();
v.setText(total_Faces+"");
}catch(Exception e){
v.setText("sorry failed");
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
以下是来自eclipse控制台的错误
[2014-07-31 17:08:04 - Chuba] Android Launch!
[2014-07-31 17:08:04 - Chuba] adb is running normally.
[2014-07-31 17:08:04 - Chuba] Performing com.example.chuba.MainActivity activity launch
[2014-07-31 17:08:04 - Chuba] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2014-07-31 17:08:05 - Chuba] Installing Chuba.apk...
[2014-07-31 17:08:08 - Chuba] Uploading Chuba.apk onto device '0123456789ABCDEF'
[2014-07-31 17:08:15 - Chuba] Success!
[2014-07-31 17:08:15 - Chuba] Starting activity com.example.chuba.MainActivity on device 0123456789ABCDEF
[2014-07-31 17:08:16 - Chuba] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.chuba/.MainActivity }
[2014-07-31 17:08:19 - Chuba] Installing Chuba.apk...
[2014-07-31 17:08:25 - Chuba] Installation failed due to invalid URI!
[2014-07-31 17:08:25 - Chuba] Please check logcat output for more details.
[2014-07-31 17:08:25 - Chuba] Launch canceled!
请帮助我
答案 0 :(得分:0)
这个错误可以指向许多不同的东西,并且有许多不同的修复。总结我收集的那些:
Eclipse问题:清理项目,重建项目,重启eclipse。
无效字符:删除Eclipse项目名称中的所有特殊字符。仅使用[a-z]和[0-9]而不是[](空格)
包含jar中的错误:尝试不使用jar并查看它是否运行,是否以某种方式修复。
清单包设置中的错误:右键单击项目中的eclipse - > Android工具 - >重命名应用程序包(重命名为类似的东西,您可以随时重命名)。
设备问题:从设备中删除应用并尝试重新安装。
Rom问题:如果您使用自定义ROM尝试重新刷新到新ROM。
调试未启用:在手机上转到设置 - >应用程序 - >允许未知来源/启用调试(此路径因不同设备而异)