我在android项目中使用opencv拼接。
public class MainActivity extends Activity implements OnClickListener {
private String mWarpType;
private String mMatchConf;
private String mConfThresh;
private SharedPreferences mSettings;
public static final String SETTINGS = "Pano_Settings";
private final String SETTINGS_WARP_TYPE = "warp";
private final String SETTINGS_MATCH_CONF = "match_conf";
private final String SETTINGS_CONF_THRESH = "conf_thresh";
private String mDefaultWarpType = "spherical";
private String mDefaultMatchConf = "0.5";
private String mDefaultConfThresh = "0.8";
...
public native int Stitch(Object[] args);
public void onClick(View v) {
switch (v.getId()) {
case R.id.GoButton:
List<String> s = new ArrayList<String>();
s.add("Stitch");
s.add("/sdcard/tesseract/images1.jpeg");
s.add("/sdcard/tesseract/images2.jpeg");
s.add("--warp");
s.add(mWarpType);
s.add("--conf_thresh");
s.add(mConfThresh);
s.add("--match_conf");
s.add(mMatchConf);
s.add("--work_megapix");
s.add("0.2");
s.add("--seam_megapix");
s.add("0.2");
s.add("--expos_comp");
s.add("gain");
s.add("--output");
s.add("/sdcard/tesseract/");
Integer i = Stitch(s.toArray());
Log.d("1",i.toString());
break;
default:
break;
}
}
}
应用程序已启动,但调用 Stitch(s.toArray()) 时出现错误:
W/dalvikvm(15392): No implementation found for native Lcom/prototype/MainActivity;.Stitch ([Ljava/lang/Object;)I
OpenCV成功添加到工作场所和我的项目->属性->安卓->库添加->OpenCV lib项目版本OpenCV 2.4.2。样本取自项目 android-opencv-panorama。