Ask Your Question

sara1010's profile - activity

2013-09-28 08:43:51 -0600 asked a question use calib3.findhomography OR solvePnP for augmented reality?

hi,i use opencv for android.I want to implement the marker based augmented reality by using opencv.I have the bitmap of marker stored in sd card.my main part of code:

 List<DMatch> matches = new ArrayList<DMatch>();
    Log.d(TAG, "Match "+objectDesc.size()+" "+sceneDesc.size());
    matcher.match(objectDesc, sceneDesc, matches);

    Log.d(TAG, "Found "+matches.size()+" matches");

    double max_dist = 0;
    double min_dist = 100;


    for (int i = 0; i < objectDesc.rows(); i++) {
        double dist = matches.get(i).distance;
        if (dist < min_dist)
            min_dist = dist;
        if (dist > max_dist)
            max_dist = dist;
    }


    List<DMatch> matches_good = new ArrayList<DMatch>();

    for (int i = 0; i < objectDesc.rows(); i++) {
        if (matches.get(i).distance < 2 * min_dist) {
            matches_good.add(matches.get(i));
        }
    }

    List<Point> scene = new ArrayList<Point>();

     List<Point> objList = new LinkedList<Point>();
     List<Point> sceneList = new LinkedList<Point>();

    for (int i = 0; i < matches_good.size(); i++) {

        scene.add(sceneKeys.get(matches_good.get(i).trainIdx).pt);
        objList.add(sceneKeys.get(matches_good.get(i).queryIdx).pt);
        sceneList.add(sceneKeys.get(matches_good.get(i).trainIdx).pt);
    }




    Mat hg = Calib3d.findHomography(objList,sceneList);

now my question is what is hg matrix?can I use it in opengl to augment virtual object? I could calibrate my phone camera and get camera matrix and distortion coefficients.a person offer me use solvePNP function,this function takes as inputs the 3D coordinates, 2D coordinates, the camera matrix (focal distance and center of projection) and the distortion coefficients.but how can I get 2d and 3d coefficients?

2013-09-24 09:59:02 -0600 received badge  Supporter (source)
2013-09-24 08:58:37 -0600 commented question use camera calibration matrices in opengl to augment a virtual object on special marker

thanks alot daniil!! these can help me so much,but if I find a simple example of augmented reality in android by using opencv it was excellent

2013-09-18 05:34:59 -0600 asked a question use camera calibration matrices in opengl to augment a virtual object on special marker

I can calibrate my android device camera and get camera matrix and distortion coefficient . In my android project I want to augment a virtual object on a marker.I can generate the bitmap of marker in runtime and save it in sd card. I am a beginner in opencv. I have some question ,and I really be appreciate if you give me some example code in android as answer. How Can I detect the marker in video by using opencv in android ( with this attention that I have the stored bitmap of marker in sd card) How Can I augment virtual object on marker with OpenGl ?(with this attention that I have camera matrix and distortion coefficient.)