MagicLeapWithOpenCVForUnityExample icon indicating copy to clipboard operation
MagicLeapWithOpenCVForUnityExample copied to clipboard

Webcam Texture & WebcamDevice: The type or namespace name `WebCamTexture' could not be found. Are you missing an assembly reference?

Open arlady opened this issue 6 years ago • 15 comments

"Enclose the code related to the WebCamTexture class with #if UNITY_EDITOR and #endif." - could you be more specific which scripts should be removed and which parts of scripts should be enclosed?

Currently have errors when attempting to build, tried removing all examples & scripts with "WebCamTexture" but it created even more errors. Thanks for your help in advance.

captureopencvml1

arlady avatar Feb 27 '19 23:02 arlady

Thank you for your inquiry.

Could you edit these files?

WebCamTextureToMat() method of Utils.cs 2019-02-28_19h27_17

WebCamTextureToMatHelper.cs 2019-02-28_19h32_34

Examples using the WebCamTextureToMatHelper under the Examples folder 2019-02-28_19h30_48

EnoxSoftware avatar Feb 28 '19 10:02 EnoxSoftware

Thank you for your inquiry.

Could you edit these files?

WebCamTextureToMat() method of Utils.cs 2019-02-28_19h27_17

WebCamTextureToMatHelper.cs 2019-02-28_19h32_34

Examples using the WebCamTextureToMatHelper under the Examples folder 2019-02-28_19h30_48

That worked, thank you!

arlady avatar Mar 08 '19 00:03 arlady

I would like to convert this example to real-time detection, for example using the YoloObjectDetectionExample- would that be possible? What would need to be added/changed?

arlady avatar Mar 08 '19 00:03 arlady

Could you change all "WebCamTextureToMatHelper" in the Example code to "MLCameraPreviewToMatHelper"? https://github.com/EnoxSoftware/OpenCVForUnity/blob/master/Assets/OpenCVForUnity/Examples/MainModules/objdetect/FaceDetectionExample/FaceDetectionWebCamTextureExample.cs#L19

EnoxSoftware avatar Mar 10 '19 08:03 EnoxSoftware

Tried it but didn't seem to work? I got all these errors - would you know how to resolve? Thanks so much for your help! EnoxOpenCVML

arlady avatar Mar 11 '19 22:03 arlady

Could you add the following line to example code?

using MagicLeapWithOpenCVForUnity.UnityUtils.Helper;
using UnityEngine.XR.MagicLeap;

EnoxSoftware avatar Mar 12 '19 11:03 EnoxSoftware

OK - did that and now I get this: WebCamTextureToMatHelper' is an ambiguous reference between OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper' and `MagicLeapWithOpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper'

Errors_Unity_MLOpenCV

arlady avatar Mar 12 '19 18:03 arlady

FaceDetectionWebCamTextureExample ( MLCameraPreviewToMatHelper version ) FaceDetectionWebCamTextureExample.cs.txt

2019-03-13_18h47_23

EnoxSoftware avatar Mar 13 '19 10:03 EnoxSoftware

still same errors. Just to be sure- I want to have the same scene as OpenCVImageCapture except that it'll detect objects based on video feed instead of the photo feed, I don't want to detect faces, just same object classes in Yolo. EnoxOpenCVML_FaceDetection

arlady avatar Mar 13 '19 13:03 arlady

I succeeded in building mpk with the script below. DnnObjectDetectionWebCamTextureExample.cs.txt

EnoxSoftware avatar Mar 14 '19 10:03 EnoxSoftware

I succeeded in building mpk with the script below. DnnObjectDetectionWebCamTextureExample.cs.txt

And that provided you with real time object detection using video? I updated the DnnObjectDetectionWebCamTextureExample.cs to the one you provided and I keep having that same error about the MLCameraPreviewToMatHelper:

Assets/OpenCVForUnity/Examples/MainModules/dnn/DnnObjectDetectionWebCamTextureExample.cs(251,62): error CS0246: The type or namespace name `MLCameraPreviewToMatHelper' could not be found. Are you missing an assembly reference?

Assets/OpenCVForUnity/Examples/MainModules/dnn/DnnObjectDetectionWebCamTextureExample.cs(70,9): error CS0246: The type or namespace name `MLCameraPreviewToMatHelper' could not be found. Are you missing an assembly reference?

Assets/OpenCVForUnity/Examples/MainModules/objdetect/FaceDetectionExample/FaceDetectionWebCamTextureExample.cs(50,9): error CS0246: The type or namespace name `MLCameraPreviewToMatHelper' could not be found. Are you missing an assembly reference?

Really appreciate all your help! Thank you!

arlady avatar Mar 22 '19 22:03 arlady

I'm trying to perform face detection on Magic Leap's live camera feed. Here are what I did. I attached the ML version of FaceDetectionWebCamTexture.cs and MLCameraPreviewToMatHelper.cs to the quad in this scene OpenCVForUnity/Examples/MainModules/objdetect/FaceDetectionExample/FaceDetectionWebCamTextureExample.unity. There's no error, but when I deployed to Magic Leap, the quad is simply white, I see no texture from the camera feed let alone any detection. Any idea what could go wrong? BTW, I deleted some of the folders in OpenCVForUnity/Examples/ since there are errors regarding the WebCamTexture stuff. Screen Shot 2019-04-15 at 13 13 55 Screen Shot 2019-04-15 at 13 14 35

JossSun avatar Apr 15 '19 17:04 JossSun

same problem here @JossSun, anyone got output?

gowtthi avatar Jun 14 '19 10:06 gowtthi

I couldn't able to find a camera capture option in publishing settings

gowtthi avatar Jun 14 '19 11:06 gowtthi

Please copy manifest.xml to add camera capture privileges. https://creator.magicleap.com/learn/guides/migrate-unity-editors NEW with 2019.x - Use a custom manifest to add privileges and modify your API level. A template manifest is located in Assets/MagicLeap/Examples/Plugins/Lumin/manifest.xml. Copy it to Assets/Plugins/Lumin/manifest.xml and modify it.

EnoxSoftware avatar Jun 18 '19 09:06 EnoxSoftware