Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use ARCamera (Vuforia) with OpenCVForUnity? #173

Open
bumchikiboss opened this issue Oct 25, 2023 · 3 comments
Open

How to use ARCamera (Vuforia) with OpenCVForUnity? #173

bumchikiboss opened this issue Oct 25, 2023 · 3 comments

Comments

@bumchikiboss
Copy link

I want to implement Vuforia's ARCamera with TextRecognitionCRNNWebCamExample.
It uses default main camera and script - WebCamTextureToMatHelper.
It throws timeout error when using AR camera. What do I need to do in order to use AR Camera with Text Recognition.
Sorry I'm quite novice in this.

@EnoxSoftware
Copy link
Owner

WebCamTextureToMatHelper cannot be used because WebCamTexture is not used in Vuforia's ARCamera.
This repository is an example of how to convert from Vuforia's ARCamera to OpenCV's Mat.
https://github.com/EnoxSoftware/VuforiaWithOpenCVForUnityExample/

@bumchikiboss
Copy link
Author

Ok so I have used the PostRenderToMatExample.cs from the repo you mentioned and put elements from TextRecognitionCRNNWebCamExample script in it.
Its working with ARCamera but the thing is that its very slow.
the framerate I'm getting is like 5-6 fps.
is there any solution for this...maybe I can tinker with some values or something.

@EnoxSoftware
Copy link
Owner

There is a way to do an asynchronous conversion from Texture to Mat using the Rendering.AsyncGPUReadback class. Asynchronous conversion may improve FPS.
https://docs.unity3d.com/2021.2/Documentation/ScriptReference/Rendering.AsyncGPUReadback.html

The following code is an example of an asynchronous conversion using the Rendering.AsyncGPUReadback class in OnPostRender method.
https://github.com/EnoxSoftware/OpenCVForUnity/blob/2.5.7/Assets/OpenCVForUnity/Examples/MainModules/videoio/VideoWriterAsyncExample/VideoWriterAsyncExample.cs#L188-L271

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants