2012-10-19 7 views
2

J'utilise la couture opencv dans le projet android.Aucune implémentation trouvée pour le point natif

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; 
     } 
    } 

} 
l'application

est commencé, mais quand point (s.toArray()) est appelée je reçois l'erreur:

W/dalvikvm(15392): No implementation found for native Lcom/prototype/MainActivity;.Stitch ([Ljava/lang/Object;)I 

OpenCV ajouté avec succès au travail et mon projet -> Propriétés -> Android - > Bibliothèque add -> Projet OpenCV lib version OpenCV 2.4.2. échantillon a été tiré du projet android-opencv-panorama.

+1

que votre fichier natif c ont un nom fonction de point qui accepte votre objet et retourne entier ?? –

+0

Il semble que vous n'ayez pas d'implémentation native de cette méthode. – ArtemStorozhuk

Répondre

4

Vous avez probablement copié le code natif "tel quel" à partir de l'exemple, mais votre classe Java a un package et un nom différents. Recherchez la fonction nommée Java_<some more>_Stitch() dans votre fichier cpp, et le renommer pour devenir:

Java_com_prototype_MainActivity_Stitch() 
Questions connexes