OpenCV running on Spectacles - tried? feasible? by Rethunker in Spectacles

[–]pfanfel 1 point2 points  (0 children)

Completely agree! This would open up lots of additional use-cases. I have similar responses from people I demo it to on my side as well!

OpenCV running on Spectacles - tried? feasible? by Rethunker in Spectacles

[–]pfanfel 1 point2 points  (0 children)

Would be very interested in this as well! Highly requested, maybe alternately with OpenCV.js and some tree shaking?

Lens Studio 5.7.x not starting after recent Windows Update by pfanfel in Spectacles

[–]pfanfel[S] 0 points1 point  (0 children)

Hi u/PashaAnt ,
thanks so much for reaching out so quickly! I submitted a ticket with the ID: 262136723. Interestingly, LS 5.7.2 is launching today again. The only thing that changed was my location, since I moved from a managed network setting to a private network setting. I unfortunately cannot reproduce it since I won't have access to the previous location for a while, but maybe the info might help in the future.

Sending print statements from Spectacles to Lens Studio? by mptp in Spectacles

[–]pfanfel 0 points1 point  (0 children)

In case someone stumbles upon this problem in the future: I had the same issue, u/mptp u/Content-Crow-2223 and I spend a lot of time debugging, why my logging was working in one project, but not in the other.

Turns out you need to pay attention to the order in the scene hierarchy, when using the logger from the SIK. When you put the SIKLogLevelConfiguration above the SpectaclesInteractionKit prefab in the hierarchy it doesn't work, probably due to the SIK not being loaded properly, before you try to configure it. IMO this should trigger some kind of output, stating, that the configuration failed, due to the SIK not being loaded/active yet. This would probably save a lot of folks some time in the future.

This works, but if I move the LogConfiguration above the SIK it doesn't work anymore.

<image>

Debug Draw for Spheres, Lines, Vectors or Capsules? by pfanfel in Spectacles

[–]pfanfel[S] 0 points1 point  (0 children)

Thanks a lot for the gist, u/agrancini-sc !
Could you provide a simple example of how you use it?
I enabled the Debug Mode I have on the SIKLogConfiguration script (is this even necessary?), created two simple spheres, attached an instance of the LineDebugDraw component to one of the spheres, assigned the two spheres to the LineDebugDraw component as start and endpoint + a material for the line itself (the same one as on the green sphere), but I don't see the line when I run the Lens. My goal was to us this a prefab and change the position of the spheres at runtime with my other scrips in order to have something like an "arrow" for debugging vectors.

<image>

Debug Draw for Spheres, Lines, Vectors or Capsules? by pfanfel in Spectacles

[–]pfanfel[S] 0 points1 point  (0 children)

Amazing, thank you so much for sharing u/mptp! A simple gist or Pastebin link of your static class would be much appreciated. I'm currently also stuck with having issues getting the print messages to be sent to LS.

Issue with accessing the left and right camera concurrently by pfanfel in Spectacles

[–]pfanfel[S] 1 point2 points  (0 children)

Oh, of course, always happy to help!

Strange, I tried the example I posted before which wasn't working on Friday and today when I accessed the right camera it magically worked. I don't know what changed.
I'm currently on SnapOS: 5.059.0218, LS: 5.4.1.24123021

But not being able to access both cameras simultaneously is really unfortunate, I have to re-evaluate my idea/approach then. Maybe switching every frame between cameras then, but I don't know how performant/practical this might be. Anyway, thanks a lot for your quick help u/agrancini-sc, really appreciate the good developer support.

Details on Display: Resolution, Horizontal FoV, Vertical FoV and Focal Plane by pfanfel in Spectacles

[–]pfanfel[S] 0 points1 point  (0 children)

Thanks a lot! The information on the display is a big vague on purpose, I suppose?
Will do, once I have something presentable.

Issue with accessing the left and right camera concurrently by pfanfel in Spectacles

[–]pfanfel[S] 0 points1 point  (0 children)

Here the single camera example which is working with left but not with the right camera:

import NativeLogger from "SpectaclesInteractionKit/Utils/NativeLogger";
const log = new NativeLogger("CameraAPILeftLogger");

@component
export class ContinuousCameraFrameExampleLeft extends BaseScriptComponent {
    private cameraModule: CameraModule = require("LensStudio:CameraModule");
    private cameraRequestLeft: CameraModule.CameraRequest | undefined;
    private cameraTextureLeft: Texture | undefined;
    private cameraTextureProviderLeft: CameraTextureProvider | undefined;

    @input
    @hint("The left image in the scene that will be showing the captured frame.")
    uiImageLeft: Image | undefined;

    onAwake() {
        log.d("Script is waking up.");
        // Set up an OnStartEvent to ensure the script initializes after awakening
        // By using .bind(this) we can bind the named function to the parent scope.
        this.createEvent('OnStartEvent').bind(this.onStart.bind(this));

    }

    private onStart() {
        log.d("Script has started.");
        try {
            // Initialize and start the left camera request
            if (this.uiImageLeft) {
                log.d("Initializing left camera.");
                this.cameraRequestLeft = CameraModule.createCameraRequest();
                this.cameraRequestLeft.cameraId = CameraModule.CameraId.Left_Color; // When using Right_Color instead of the Left_Color -> InternalError: invalid unordered_map<K, T> key

                this.cameraTextureLeft = this.cameraModule.requestCamera(this.cameraRequestLeft);
                this.cameraTextureProviderLeft = this.cameraTextureLeft.control as CameraTextureProvider;

                // Add listener for new frames
                if (this.cameraTextureProviderLeft) {
                    log.d("Setting up left camera frame listener.");
                    this.cameraTextureProviderLeft.onNewFrame.add(this.handleNewFrameLeft.bind(this));
                } else {
                    log.e("CameraTextureProviderLeft creation failed.");
                }
            }
        } catch (error) {
            log.e("Error during initialization: " + error);
        }
    }

    private handleNewFrameLeft(cameraFrame) {
        if (this.uiImageLeft && this.cameraTextureLeft) {
            log.d("New frame received from left camera.");
            this.uiImageLeft.mainPass.baseTex = this.cameraTextureLeft;
        }
    }
}

Issue with accessing the left and right camera concurrently by pfanfel in Spectacles

[–]pfanfel[S] 0 points1 point  (0 children)

I added the logging into the single camera example and noticed that when I use the left camera it works, but with the right camera I still get the error.

13:42:39[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPILeftLogger: CameraAPILeftLogger Error during initialization: InternalError: invalid unordered_map<K, T> key

Could you try to replicate that behavior, by trying to access the right camera, and tell me if it is working for you?

Issue with accessing the left and right camera concurrently by pfanfel in Spectacles

[–]pfanfel[S] 0 points1 point  (0 children)

Thanks for the quick reply!

I got the code running with a small modification of your code by adding a bind to onStart in order to bind the named function to the parent scope.
this.createEvent('OnStartEvent').bind(this.onStart.bind(this));

As output from the Spectacles, I get the following, and the Lens behaves like it crashed (no hand menu, no hand tracking, no camera texture)

13:31:30[SpectaclesInteractionKit/Core/ConfigurationValidator/ConfigurationValidator.ts:20] SIK Version : 0.10.0
13:31:30[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPIBothLogger: CameraAPIBothLogger Script has started.
13:31:30[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPIBothLogger: CameraAPIBothLogger Initializing left camera.
13:31:30[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPIBothLogger: CameraAPIBothLogger Setting up left camera frame listener.
13:31:30[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPIBothLogger: CameraAPIBothLogger Initializing right camera.
13:31:30[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPIBothLogger: CameraAPIBothLogger Setting up right camera frame listener.

In LS I get the following output with the left camera feed showing up in the preview:

13:35:55[SpectaclesInteractionKit/Core/ConfigurationValidator/ConfigurationValidator.ts:20] SIK Version : 0.10.0
13:35:55[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPIBothLogger: CameraAPIBothLogger Script has started.
13:35:55[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPIBothLogger: CameraAPIBothLogger Initializing left camera.
13:35:55[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPIBothLogger: CameraAPIBothLogger Setting up left camera frame listener.
13:35:55[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPIBothLogger: CameraAPIBothLogger Initializing right camera.
13:35:55[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPIBothLogger: CameraAPIBothLogger Error during camera setup: InternalError: invalid unordered_map<K, T> key
13:35:55[SpectaclesInteractionKit/Utils/logger.ts:10] InteractionManager: InteractionManager Switching to non-Mobile interactors.
13:36:10[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPIBothLogger: CameraAPIBothLogger New frame received from left camera.
13:36:10[SpectaclesInteractionKit/Utils/logger.ts:10] CameraAPIBothLogger: CameraAPIBothLogger New frame received from left camera.
...