List
Image Tracker not working when using SetNewFrame
Posted Date: 2019-10-07 15:47     Edited Date: 2019-10-21 0:38     Writer: inactive

I am currently trying to use SetNewFrame to be able to take an image input from a ZED camera and have image recognition work on that. It currently passes the image through and displays it via the CameraBackgroundBehaviour just fine, but it does not seem to return any tracking results while the exact same .2dmap works fine when using a webcam input. 

My update function looks like this:

 

        DisableAllTrackables();

        TextureScale.RenderToTexture(camRendTex, ref camTex);
        CameraDevice.GetInstance().SetNewFrame(camTex.GetRawTextureData(), camTex.GetRawTextureData().Length, camTex.width, camTex.height, ColorFormat.RGBA8888);

        TrackingState state = TrackerManager.GetInstance().UpdateTrackingState();

        if (state == null)
        {
            return;
        }

        cameraBackgroundBehaviour.UpdateCameraBackgroundImage(state);

        TrackingResult trackingResult = state.GetTrackingResult();
        for (int i = 0; i < trackingResult.GetCount(); i++)
        {
            Debug.Log(i);
            Trackable trackable = trackingResult.GetTrackable(i);
            imageTrackablesMap[trackable.GetName()].OnTrackSuccess(
                trackable.GetId(), trackable.GetName(), trackable.GetPose());
        }

 

 

I took most of this from ImageTrackerSample.cs and just put it in my own script.


1. SDK Version: 4.1.4
2. Development Environment: (eg. Unity-Android, Unity-iOS, Native Android, Native iOS) Unity targetting Windows
3. Tracker/Scanner: Trying to use Image Tracker with a ZED camera
4. License Type(Free / Pro-One Time Fee / Pro-Subscription / Enterprise): Free
5. Target Device(Optional): Windows

Posted Date: 2019-10-08 9:22     Edited Date: 2019-10-08 9:22     Writer: inactive

Hello ram.housn.

You have written 'Unity targetting Windows' in your development environment and I wonder if this means Windows Phone. If that's correct, unfortunately we don't support Windows Phone.

Thank you.

 

Leo

Maxst Support Team

Posted Date: 2019-10-08 9:23     Edited Date: 2019-10-08 9:23     Writer: inactive

Hi,

I am using Unity and want to deploy to a PC running Windows 10 for a demo

Posted Date: 2019-10-08 9:29     Edited Date: 2019-10-08 9:29     Writer: inactive

The camera buffer seems to have entered incorrectly. You may find it helpful to refer to the Video Tracker in the sample code we provide.

Thank you.

 

Leo

Maxst Support Team

Posted Date: 2019-10-08 9:50     Edited Date: 2019-10-08 9:50     Writer: inactive

Hi,


Looking at the VideoTrackerSample.cs code I can't see what I am doing wrong. Please find my entire script here: https://pastebin.com/dz2R9Fh2 and advise, really hoping to get this working.

Thanks,

Ram

Posted Date: 2019-10-09 10:01     Edited Date: 2019-10-09 10:01     Writer: inactive

Hi,

I was wondering if you had any ideas as to why it isn't working? I have noticed that it sometimes works very briefly and incredibly unreliably but it is also displaying the cube I have on it at a weird angle. I know MAXST works with this camera as when I use it as a webcam input it works fine, but I can't use that since I want the positional tracking capabilities of the camera.

Thanks,

Ram

Posted Date: 2019-10-15 9:02     Edited Date: 2019-10-15 9:02     Writer: inactive

For anyone that would need this, I have finally manage to get it working like this: https://pastebin.com/NXA1gxTs

Posted Date: 2019-10-15 9:30     Edited Date: 2019-10-15 9:30     Writer: inactive

I now do have the issue of I can't use the image tracker with a moving camera, any idea on how I could get that working?

Posted Date: 2019-10-16 0:49     Edited Date: 2019-10-16 0:49     Writer: slkim

I don't know what a moving camera is.

Please tell me more about the moving camera.

 

Keane.

Maxst Support Team

Posted Date: 2019-10-16 9:16     Edited Date: 2019-10-16 9:16     Writer: inactive

I am moving the actual ingame camera using positional tracking. I managed to get it working by going into Trackable.cs, changing line 84 to be like this:

                Matrix4x4 m = Matrix4x4.TRS(AbstractARManager.Instance.GetARCamera().transform.position, AbstractARManager.Instance.GetARCamera().transform.rotation, new Vector3(1, 1, 1));

and now it works great.

Posted Date: 2019-10-21 0:38     Edited Date: 2019-10-21 0:38     Writer: slkim

I think it's because the rotation value of the ARCamera GameObject has changed.

The code above is the code to change from opengl axis to unity axis.

I'm glad it's already been fixed. However, if you check the rotation value of the ARCamera GameObject, the x-axis may be at 0 degrees.

The x axis must be 90 degrees.

 

Keane.

Maxst Support Team