1

我收到错误cvLoadImage("/mnt/sdcard/images/"+name+".png");

我是安卓新手。

public class MainActivity extends Activity {
    File[] listOfFiles;
    IplImage[] iplimage;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        String path ="mnt/sdcard/photo";
        File folder = new File(path);
        listOfFiles = folder.listFiles();
        if(listOfFiles.length>0)
        {`enter code here`
            iplimage = new opencv_core.IplImage[listOfFiles.length];
            for (int j = 0; j < listOfFiles.length; j++) {
                String files="";       
                if (listOfFiles[j].isFile()) 
                {
                    files = listOfFiles[j].getName();
                }   
                String[] tokens = files.split("\\.(?=[^\\.]+$)");
                String name=tokens[0]; 
                System.out.println(" j " + name);
                   iplimage[j]=cvLoadImage("/mnt/sdcard/images/"+name+".png");
            }
        }
4

0 回答 0