Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在场景数组中添加“int”(可绘制的数组)_Android_Arrays - Fatal编程技术网

Android 如何在场景数组中添加“int”(可绘制的数组)

Android 如何在场景数组中添加“int”(可绘制的数组),android,arrays,Android,Arrays,}请您添加更多详细信息好吗?1.场景课,2。Logcat,我把场景课也包括进去了,先生,直截了当地说。我正在我的应用程序中实现open cv image matcher应用程序。我想比较一个由相机拍摄的图像与可绘制文件夹中的图像。可能吗? Mat last; //Mat last2; ArrayList<Scene> scenes = new ArrayList<Scene>(); //ArrayList<Scene> scenes23 = new Arra

}

请您添加更多详细信息好吗?1.场景课,2。Logcat,我把场景课也包括进去了,先生,直截了当地说。我正在我的应用程序中实现open cv image matcher应用程序。我想比较一个由相机拍摄的图像与可绘制文件夹中的图像。可能吗?
Mat last;
//Mat last2;

ArrayList<Scene> scenes = new ArrayList<Scene>();
//ArrayList<Scene> scenes23 = new ArrayList<Scene>();



ArrayList<Bitmap> myImageList2 = new ArrayList<Bitmap>();
int[] myImageList = new int[]{R.drawable.baldglassy,
                              R.drawable.baldglassy2,
                              R.drawable.bandedarcherfish,
                              R.drawable.bandedarcherfish2,
                              R.drawable.bluegill,
                              R.drawable.bluegill2,
                              R.drawable.bluespotmullet};

/*Bitmap[] images2 = { BitmapFactory.decodeResource(getResources(),R.drawable.baldglassy),
        BitmapFactory.decodeResource(getResources(),R.drawable.baldglassy2),
        BitmapFactory.decodeResource(getResources(),R.drawable.bandedarcherfish),
        BitmapFactory.decodeResource(getResources(),R.drawable.bluegill),
        BitmapFactory.decodeResource(getResources(),R.drawable.bluegill2),
        BitmapFactory.decodeResource(getResources(),R.drawable.bluespotmullet),
        };*/



Scene refScene;
ProgressDialog progress;
//Mat imgMAT;

public void takePic1(View w) {

    //Bitmap bmp32 = images[](Bitmap.Config.ARGB_8888, true);

    /*for(int i=0;i<=5;i++){
    Bitmap bmp32 = images[i].copy(Bitmap.Config.ARGB_8888, true);
    Utils.bitmapToMat(bmp32, imgMAT);
    }

    Scene scene2 = new Scene(imgMAT);
    scenes.add(scene2);*/


    Scene scene = new Scene(last);
    scenes.add(scene);
    addBtn.setText("Add (" + scenes.size() + ")");
}

public void takePic2(View w) {
    Mat im = last.clone();
    // Imgproc.cvtColor(im, im, Imgproc.COLOR_BGR2RGB);
    Bitmap bmp = Bitmap.createBitmap(im.cols(), im.rows(),
            Bitmap.Config.ARGB_8888);
    Utils.matToBitmap(im, bmp);
    matchDrawArea.setImageBitmap(bmp);
    refScene = new Scene(last);
}
final Mat image;
final Mat descriptors = new Mat();
final MatOfKeyPoint keypoints = new MatOfKeyPoint();
boolean firstTime = true;

public Scene(Mat image) {
    this.image = image.clone();
    // DetectUtility.analyze(image, keypoints, descriptors);
}

public void preCompute() {
    if (firstTime) {
        DetectUtility.analyze(image, keypoints, descriptors);
        firstTime = false;
    }
}

public SceneDetectData compare(Scene frame, boolean isHomogrpahy, boolean imageOnly) {
    // Info to store analysis stats
    SceneDetectData s = new SceneDetectData();

    // Detect key points and compute descriptors for inputFrame
    MatOfKeyPoint f_keypoints = frame.keypoints;
    Mat f_descriptors = frame.descriptors;

    this.preCompute();
    frame.preCompute();


    // Compute matches
    MatOfDMatch matches = DetectUtility.match(descriptors, f_descriptors);

    // Filter matches by distance

    MatOfDMatch filtered = DetectUtility.filterMatchesByDistance(matches);

    // If count of matches is OK, apply homography check

    s.original_key1 = (int) descriptors.size().height;
    s.original_key2 = (int) f_descriptors.size().height;

    s.original_matches = (int) matches.size().height;
    s.dist_matches = (int) filtered.size().height;

    if (isHomogrpahy) {
        MatOfDMatch homo = DetectUtility.filterMatchesByHomography(
                keypoints, f_keypoints, filtered);
        Bitmap bmp = DetectUtility.drawMatches(image, keypoints,
                frame.image, f_keypoints, homo, imageOnly);
        s.bmp = bmp;
        s.homo_matches = (int) homo.size().height;
        return s;
    } else {
        Bitmap bmp = DetectUtility.drawMatches(image, keypoints,
                frame.image, f_keypoints, filtered, imageOnly);
        s.bmp = bmp;
        s.homo_matches = -1;
        return s;

    }

}