Ask Your Question

zoenightshade's profile - activity

2018-07-15 22:50:16 -0500 asked a question Stitching panorama images of blank walls

Stitching panorama images of blank walls Hi everyone! Im currently working on a stitching project for Unity. My code wo

2016-06-08 01:23:07 -0500 commented question OpenCV stitching chooses certain image to stitch

I am using the findHomography function instead of the built-in Stitcher. Sorry i forgot to mention it earlier

2016-06-07 22:07:26 -0500 asked a question OpenCV stitching chooses certain image to stitch

My code could stitch these certain 2 images just fine. But when i try to stitch other images, it gives distorted results. Any heads up why?

2016-06-05 19:41:48 -0500 asked a question Panorama stitching in OpenCV returns error.

For some reasons, i keep getting this error. I am able to compile my project successfully but i cant run it because of this error. Any idea why? Thanks in advance.

image description

2016-06-03 00:02:14 -0500 asked a question Native object address is NULL

I dont know where I went wrong with this one. My script doesnt show any errors but there's something wrong because it keeps returning "Native object address is NULL.

This is my code

Initialization:

public MatOfDMatch matches = new MatOfDMatch();
public MatOfDMatch gm = new MatOfDMatch();
public List <DMatch> good_matches = new List<DMatch>();
public List <Point> objList = new List<Point>();
public List <Point> sceneList = new List<Point>();
public MatOfKeyPoint keypoints_object = new MatOfKeyPoint();
public MatOfKeyPoint keypoints_scene = new MatOfKeyPoint();
public Mat descriptors_object = new Mat();
public Mat descriptors_scene = new Mat();
public Mat result, half;
public MatOfPoint2f obj = new MatOfPoint2f();
public MatOfPoint2f scene = new MatOfPoint2f();

Code:

        Mat Mat1 = Highgui.imread(_SavePath + _PreviousPhoto + ".png");
        Mat Mat2 = Highgui.imread(_SavePath + _CurrentPhoto + ".png");

        FeatureDetector fd = FeatureDetector.create(FeatureDetector.ORB);

        fd.detect(Mat1, keypoints_object);
        fd.detect(Mat2, keypoints_scene);
        int con = 3;

        DescriptorExtractor extractor = DescriptorExtractor.create(con);

        extractor.compute(Mat1, keypoints_object, descriptors_object);
        extractor.compute(Mat2, keypoints_scene, descriptors_scene);
        DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);

        matcher.match(descriptors_object, descriptors_scene, matches);

        //----------------------------------------------------------------------------------------//

        double max_dist = 0; double min_dist = 100;
        List<DMatch> matchesList = matches.toList();

        //– Quick calculation of max and min distances between keypoints

        for( int i = 0; i < descriptors_object.rows(); i++ )
        {
            double dist = (double) matchesList[i].distance;
            if( dist < min_dist ) min_dist = dist;
            if( dist > max_dist ) max_dist = dist;
        }

        for(int i = 0; i < descriptors_object.rows(); i++){
            if(matchesList[i].distance < 3*min_dist){
                good_matches.Add(matchesList[i]);
            }
        }

        gm.fromList(good_matches);

        List<KeyPoint> keypoints_objectList = keypoints_object.toList();
        List<KeyPoint> keypoints_sceneList = keypoints_scene.toList();

        for(int i = 0; i < good_matches.Count; i++){
            objList.Add(keypoints_objectList[(good_matches[i].queryIdx)].pt);
            sceneList.Add(keypoints_sceneList[(good_matches[i].trainIdx)].pt);
        }

        obj.fromList(objList);

        scene.fromList(sceneList);

        Mat H = Calib3d.findHomography(obj, scene);

        OpenCVForUnity.Size ims = new OpenCVForUnity.Size(Mat1.cols() + Mat2.cols(), Mat1.rows());
        OpenCVForUnity.Rect rect = new OpenCVForUnity.Rect(0, 0, Mat2.cols(), Mat2.rows());

        result = Mat1.clone();

        Imgproc.warpPerspective(Mat1,result,H, ims);
        half = new Mat(result, rect);
        Mat2.copyTo(half);
2016-06-02 23:58:55 -0500 commented question Script error for descriptors_1.rows

I fixed it by changing it to 'descriptors_1.rows()'

2016-06-02 19:23:49 -0500 answered a question import OpenCV inside UNITY3D

You have to download the OpenCVForUnity plugin in the Asset Store.

Then integrate it into your project.

using OpenCVForUnity;
2016-06-02 04:05:07 -0500 asked a question OpenCV for Unity doesn't have 'Stitcher'

I cant access the Stitcher. Any idea why?

2016-06-02 01:41:18 -0500 asked a question Script error for descriptors_1.rows

I'm getting an 'Operator "<" cannot be applied to operands of type "int" and "method group" for my line for (int i = 0; i < descriptors_1.rows; i++)

descriptors_1.rows is initialized as Mat.