Log in or register to post comments

2D screen c-ordinates of a TrackableResult

June 14, 2016 - 5:41pm #1

Hi,

 

Is there an example for getting the 2D screen pixel coordinates and screen dimensions for a TrackableResult for Android?

 

Thanks 

2D screen c-ordinates of a TrackableResult

August 15, 2016 - 11:49pm #4

int screenWidth = FrameMarkers.screenWidth;

        int screenHeight = FrameMarkers.screenHeight;

        VideoMode videoMode = CameraDevice.getInstance().getVideoMode(CameraDevice.FOCUS_MODE.FOCUS_MODE_TRIGGERAUTO);

        VideoBackgroundConfig config = Renderer.getInstance().getVideoBackgroundConfig();

        int xOffset = (screenWidth - config.getSize().getData()[0]) / 2 + config.getPosition().getData()[0];

        int yOffset = (screenHeight - config.getSize().getData()[1]) / 2 + config.getPosition().getData()[1];

        for (int i = 0; i < ringCoordsArr.length; i += 2) {

            Log.e("Ring", "一个坐标");

            CameraCalibration calibration = CameraDevice.getInstance().getCameraCalibration();

            float temp[] = new float[]{ringCoordsArr[i], ringCoordsArr[i + 1], 0.0f};

            Vec2F vec2F = Tool.projectPoint(calibration, pose, new Vec3F(temp));

            float rotatedX = videoMode.getHeight() - vec2F.getData()[1];

            float rotatedY = vec2F.getData()[0];

            float screenCoordinateX = rotatedX * config.getSize().getData()[0] / videoMode.getHeight() + xOffset;

            float screenCoordinateY = rotatedY * config.getSize().getData()[1] / videoMode.getWidth() + yOffset;

            Log.e("Ring", "" + screenCoordinateX + "--" + screenCoordinateY);

        }

2D screen c-ordinates of a TrackableResult

August 14, 2016 - 9:21pm #3

Hello,hava you solve this problem? I also want to get the screen coordinates of my target in Android. 

Thanks!

2D screen c-ordinates of a TrackableResult

June 15, 2016 - 11:41am #2
Log in or register to post comments