"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

how to vuforia Matrix -> opencv x,y value

Hi!  

First I'm poor at English. sorry..

 

I want vuforia Matrix value -> Opencv X,Y value

 

My scenario is   use Four markers edge get modelviewMatrix -> Capture screen  and Make Bitmap.class -> Bitmap to Mat , Warping

                             ->  Mat to Bitmap , save Image -> lol !

 

but vuforia modelviewMatrix[12], [13]  (x,y) value It can not be used opencv 

 

Because opencv start Left top (0,0)  vuforia start center (0,0) and 

opencv read the resolution of bitmap to 1920x1080. but when vuforia recorded resolution, the resolution of bitmap constantly chainge by distance.

So i wonder to find both opencv and vuforia ratio and calibrate Matrix values. 

 

sorry my poor English T ㅁ T 

 

this is my code.   code base vuforia sample FrameMarkerRenderer.java

void renderFrame(){

.......

switch (marker.getMarkerId())  //Four markers edge get modelviewMatrix            {                case 0:                    vertices = qObject.getVertices();                    normals = qObject.getNormals();                    indices = qObject.getIndices();                    texCoords = qObject.getTexCoords();                    numIndices = qObject.getNumObjectIndex();

                    Matrix.translateM(modelViewMatrix, 0, kLetterTranslate,                            -kLetterTranslate, 0.f);

                   PQ=new Point((double)modelViewProjection[13],(double)modelViewProjection[12]); //AR object translate Maker edge. get matrix

                  Matrix.scaleM(modelViewMatrix, 0, kLetterScale/4, kLetterScale/4,                        kLetterScale/4);                  

                   Matrix.multiplyMM(modelViewProjection, 0, vuforiaAppSession                            .getProjectionMatrix().getData(), 0, modelViewMatrix, 0);

           

......

}

`.......

}

screen captrue code  Reference is

https://developer.vuforia.com/library//articles/Solution/How-To-Capture-the-AR-View-on-Android

 

public Bitmap warping(Bitmap bmp)// Warping

    {

        Mat input = new Mat(bmp.getWidth(),bmp.getHeight(),CvType.CV_32FC2);        Utils.bitmapToMat(bmp,input);

       //Bmp -> Mat

        SystemClock.sleep(3000); //wating           Point ocvin1= new Point(PA.x,PA.y); //Marker edge location        Point ocvin2= new Point(PQ.x,PQ.y);        Point ocvin3= new Point(PC.x,PC.y);        Point ocvin4= new Point(PR.x,PR.y);

        List<Point> source = new ArrayList<Point>();        source.add(ocvin1);        source.add(ocvin2);        source.add(ocvin3);        source.add(ocvin4);

        Mat startM = Converters.vector_Point2f_to_Mat(source);

        Point ocvout1= new Point(0,0);        Point ocvout2= new Point(1080,0);        Point ocvout3= new Point(1080,1920);        Point ocvout4= new Point(0,1920);

        List<Point> dest = new ArrayList<Point>();        dest.add(ocvout1);        dest.add(ocvout2);        dest.add(ocvout3);        dest.add(ocvout4);

        Mat endM = Converters.vector_Point2f_to_Mat(dest);

 

        try {            Mat perspectiveTransform = Imgproc.getPerspectiveTransform(startM, endM);            //perspectiveTransform

 

            Mat output = new Mat(1080, 1920, CvType.CV_32FC2);    

            Imgproc.warpPerspective(input, output, perspectiveTransform, new org.opencv.core.Size(1080, 1920));            //Warping

                    Bitmap out = Bitmap.createBitmap(1080,1920, Bitmap.Config.ARGB_8888);            Utils.matToBitmap(output, out);

            SystemClock.sleep(3000);//wating

            //crate Bitmap,  Mat -> Bitmap */

            return out;        }

 

 

Attachment