我尝试使用opencv和unity3d来寻找和显示角点。我通过unity相机进行捕捉。我将Texture2D发送到使用opencv的C++代码中。我使用opencv(Harris角检测器)检测角点。然后,C++代码会将角点的x,y位置(在图像上)发送给Unity代码。
最终,我想要展示这些点。我试图在Unity中的Texture2D上画圆。我使用下面的代码。但是Unity报错,说“UnityEngine.Texture2D不包含DrawCircle的定义,也没有发现类型为UnityEngine.Texture2D的DrawCircle扩展方法”。
我该如何在Unity3D中绘制简单的形状?
Texture2D texture = new Texture2D(w, h,TextureFormat.RGB24 , false);
texture.DrawCircle(100, 100, 20, Color.green);
// Apply all SetPixel calls
texture.Apply();
mesh_renderer.material.mainTexture = texture;