Coder Social home page Coder Social logo

Comments (8)

qian256 avatar qian256 commented on May 30, 2024 2

is it possible to do the same when using HoloLensARToolkit?

Yes, in the ARUWPMarker script, the function getMarkerTransformationMatrix returns the current transformation from the marker to the camera, in Matrix4x4 format. You can use it with the function getMarkerVisibility to check if the marker is currently visible.

the frame rate is dropping down to 7-9 fps, is that expected?

It is not normal, for me, it is at least 20fps. When you build the app from Visual Studio to HoloLens, did you choose the release version? or choose "start without debugging". When it is being debugged using VS, the frame rate is low.

Is there a way to control the lifecycle of video capture / marker tracking so that it can be triggered based on user input

Yes, in the ARUWPController script, there is a parameter enable. I think you can tune this to enable/disable tracking.

from hololensartoolkit.

thezelus avatar thezelus commented on May 30, 2024

Hello @qian256 ,

Thank you for the response and apologies for late reply. I tried using the enable parameter and stopRunning() and startRunning() methods. They seem to be working as expected, though there seems to be a different issue that might be related to the life cycle.

The web camera on HoloLens doesn't turn off (white LED indicating camera being active is on) even when ARUWPController is disabled as and all related gameObjects (webcam plane, display HUDs for FPS and AR etc.) are deactivated. Is there a way to explicitly turn off the web camera on HoloLens after ARUWPController has been disabled?

from hololensartoolkit.

qian256 avatar qian256 commented on May 30, 2024

The functions stopRunning() and startRunning() controls the native libraries, not the behavior of the hololens camera. If you want to shut down the camera, you can try use Unity functions of WebCamTexture.Stop(), and you need to code a little bit to achieve it.

from hololensartoolkit.

thezelus avatar thezelus commented on May 30, 2024

Hello,

Thanks for the response and the suggestion. Yes I am already using WebCamTexture to shut down the camera but shouldn't the controller do this automatically specially when it explicitly starts the camera.

 void Start () {
        ARUWPUtils.aruwpRegisterLogCallback(Log);
        ARUWPUtils.aruwpSetLogLevel((int)currentLogLevel);
        lastTick = Time.time;
        deltaTime = 0;
        startWebcam();
        startARUWP();
    } 

  private void startWebcam() {
        // init Webcam
        WebCamDevice[] cam_devices = WebCamTexture.devices;
        webcamTexture = new WebCamTexture(cam_devices[0].name, frameWidth, frameHeight, 15);
        if (displayWebcam) {
            webcamMaterial.mainTexture = webcamTexture;
            webcamPlane.SetActive(true);
        }
        else {
            webcamPlane.SetActive(false);
        }
        webcamTexture.Play();
}

What is your opinion about stopping the webcamTexture in either stopRunning() or OnDestroy() or shutDownAR()? I can create a pull request if you think this is something that should be implemented.

from hololensartoolkit.

qian256 avatar qian256 commented on May 30, 2024

Thank you for the proposal of adding the function to properly shut down the webcam.
I suggest adding a new function called stopWebcam() disable it. What is your opinion? I would definitely merge your implementation if it works.

from hololensartoolkit.

thezelus avatar thezelus commented on May 30, 2024

Hello @qian256

I have already been experimenting with this and have added two methods to my local clone of the repository

 public void stopWebcam()
    {
        if(webcamTexture != null)
        {
            webcamTexture.Stop();
        }
    }

    public void restartWebcam()
    {
        if(webcamTexture == null)
        {
            startWebcam();
        } else
        {
            webcamTexture.Stop();
            webcamTexture.Play();
        }
    }

Below are my observations:

  • Calling stopWebcam() does stop the web camera and this works fine the first time.

  • When trying to start the camera after stopping it from the code results in no video feed, which I suspect is due to this issue: Unity/Linux - Unity does not free webcam when stopped

  • I also tried to destroy the object that has ARController and ARMarker scripts attached, this does solve the issue but is a hack and is a finicky solution.

(by the way, should we move this to a separate issue?)

from hololensartoolkit.

qian256 avatar qian256 commented on May 30, 2024

Thank you for the update! Yes please go ahead and open another issue regarding the control of camera feed, and the control of tracking functionality.

from hololensartoolkit.

dtoceaneering avatar dtoceaneering commented on May 30, 2024

is it possible to put an Object at few distance from cube marker in scene (HoloLensARToolKitCube)?

from hololensartoolkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.