![]() For this reason we define it as a member in our MainScript class: private WebCamTexture _webcam Now we need to use WeCamTexture class in Unity to access live frames read from the camera or webcam in our computer. Just drag and drop objects from the Hierarchy panel on the left and into the relevant fields in the Inspector panel, while Script object is selected. Let’s assume this Script is called MainScript.cs and it is added to an Empty Component called Script in our UI and initially it’s filled with the following code to handle the Exit Button and other necessary assignments of components in UI to members in our C# class: using Į(OnExitButtonClick) įor the Script to work, you must first assign the Image and Button components as seen in the following picture: Next, we’ll create a C# Script to bring our UI to life. It includes an Image and a Button to exit the application when clicked. To clarify, we’ll be creating a 2D Unity project with a simple UI seen above. Well, to begin, let’s assume we’ll create a simple user interface to view the camera feed and see the results of the OpenCV processed image in real time. Another thing you should note, is that you can use any other preferably recent version of OpenCV as well, such as OpenCV 3.4.6 and so on. You can adapt this tutorial to any other operating system and development environment if you understand what the differences are between libraries in macOS and Windows and so on, but if you still face issues making it work, you can post your questions in the comments section down below.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |