I want to use object detection and color detection in the same scene. when I attach both scripts to the quad gameobject and make the necessary settings it doesn't work together, I was following a youtube video where he combined object detection and color detection. It was working fine in the video but when I do the same it does not work.
moreover, can I train the model and add more classes for detection?
following is the error that I get when I try to combine both. I have tried color detection with all of the models but I get the same error.
NullReferenceException: Object reference not set to an instance of an object
OpenCVForUnityExample.DnnObjectDetectionWebCamTextureExample.OnWebCamTextureToMatHelperInitialized () (at Assets/OpenCVForUnity/Examples/MainModules/dnn/DnnObjectDetectionWebCamTextureExample.cs:228)
UnityEngine.Events.InvokableCall.Invoke () (at :0)
UnityEngine.Events.UnityEvent.Invoke () (at :0)
OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper+<_Initialize>d__68.MoveNext () (at Assets/OpenCVForUnity/org/opencv/unity/helper/WebCamTextureToMatHelper.cs:742)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at :0)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper:Initialize() (at Assets/OpenCVForUnity/org/opencv/unity/helper/WebCamTextureToMatHelper.cs:447)
OpenCVForUnityExample.MultiObjectTrackingBasedOnColorExample:Start() (at Assets/OpenCVForUnity/Examples/Advanced/MultiObjectTrackingBasedOnColorExample/MultiObjectTrackingBasedOnColorExample.cs:82)
Hi,
I want to use object detection and color detection in the same scene. when I attach both scripts to the quad gameobject and make the necessary settings it doesn't work together, I was following a youtube video where he combined object detection and color detection. It was working fine in the video but when I do the same it does not work. moreover, can I train the model and add more classes for detection?
following is the error that I get when I try to combine both. I have tried color detection with all of the models but I get the same error.
NullReferenceException: Object reference not set to an instance of an object OpenCVForUnityExample.DnnObjectDetectionWebCamTextureExample.OnWebCamTextureToMatHelperInitialized () (at Assets/OpenCVForUnity/Examples/MainModules/dnn/DnnObjectDetectionWebCamTextureExample.cs:228) UnityEngine.Events.InvokableCall.Invoke () (at:0)
UnityEngine.Events.UnityEvent.Invoke () (at :0)
OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper+<_Initialize>d__68.MoveNext () (at Assets/OpenCVForUnity/org/opencv/unity/helper/WebCamTextureToMatHelper.cs:742)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at :0)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
OpenCVForUnity.UnityUtils.Helper.WebCamTextureToMatHelper:Initialize() (at Assets/OpenCVForUnity/org/opencv/unity/helper/WebCamTextureToMatHelper.cs:447)
OpenCVForUnityExample.MultiObjectTrackingBasedOnColorExample:Start() (at Assets/OpenCVForUnity/Examples/Advanced/MultiObjectTrackingBasedOnColorExample/MultiObjectTrackingBasedOnColorExample.cs:82)
Thank You.
unity version: 2021.3.3 opencvforunity version: 2.5.4