1

I would like to ask for some guidance on how to use StartInputFromImage method in Kudan plugin for Unity.

Let's say I want to use the image of a street (for example this: https://upload.wikimedia.org/wikipedia/commons/3/39/Downtown_Temple,_TX_at_Main_Street_IMG_2384.JPG) as a texture which will be processed by Kudan TrackingMethodMarkerless.


In KudanTracker class in Start() there is a following code: // Start the camera

#if UNITY_EDITOR
if (_trackerPlugin.StartInputFromCamera(_playModeWebcamID, DefaultCameraWidth, DefaultCameraHeight)) 
#else
if (_trackerPlugin.StartInputFromCamera(0, DefaultCameraWidth, DefaultCameraHeight)) 
#endif

I figured that I should just change the input method here, so I changed it like this:

#if UNITY_EDITOR
if (_trackerPlugin.StartInputFromImage(myImage))
#else
if (_trackerPlugin.StartInputFromImage(myImage))
#endif

BUT: when I run the app in Editor, the Unity crashes with an error. I suspect that it could be due to the TrackerWindows implementation of this method looking like this:

public override bool StartInputFromImage(Texture2D image)
{
    // First stop existing input
    bool wasTracking = _isTrackingRunning;
    StopInput();
    // Resume tracking
    if (wasTracking)
    {
        StartTracking();
    }
    return true;
}

...I mean, this literally does not do anything with image.

Implementation of the same method in TrackerAndroid looked way more promising so I went with it because I am developing the Android app after all.

However here the code gets stuck in ArbiTrackGetPose() method.

the process looks like this:

1)in KudanTracker.Update() - _currentTrackingMethod.ProcessFrame() is called

2)in TrackingMethodMarkerless.ProcessFrame() - _kudanTracker.ArbiTrackGetPose(out position, out orientation) is called

3)in TrackerAndroid.ArbiTrackGetPose() - m_KudanAR_Instance.Call ("updateArbi", _floorHeight) is called but is not executed properly the following code is not compiled. And since I can't fully examine "updateArbi" function, I don't know what is wrong.


Should I use some different approach? Do you see some mistake in mine? Thanks for any suggestions!

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
  • Using `StartInputFromImage` currently doesn't have any real effect. It also doesn't make much sense to do "tracking" on a single image that doesn't change. If you want to use the image as a marker you will need to load it up as a marker dataset. Otherwise if you just want to essentially have the Unity "trigger" your various scripts on something being tracked, simply execute the scripts themselves. – MultiColourPixel Dec 03 '16 at 19:19
  • I understand that it doesn't make sense to do it on 1 image, that was just an example. What I need is to apply filter on the camera input and then start tracking on the filtered video. So I thought that I would filter the camera input and then send it to StartInputFromImage method frame by frame. Or is there any other way to achieve this? Thanks. – Adam Vukmir Jurík Dec 06 '16 at 08:18

0 Answers0