Hi everyone,
So basically in my final project me and my friends trying to do Traffic Simulation with Python Object Detection. Our goal is simulating traffic environment, detecting cars with drone (gameobject) camera and calculating traffic light times with number of cars in different road. At this point of project we are ready to test our both Python script and Unity project but I couldn’t find how can I live stream my drone camera (display 1,2 etc.) to Python code. I found some solutions at Stack Overflow(link below) but they streaming live from computer camera and I couldn’t find how can i change it to one of the camera display in game. I hope there is a way to do it. Sorry for my bad grammar. Thank you for helps.
Video streaming involves compressing the video, then transporting it to your Python script in some kind of continuous stream, then decompressing it and doing your object detection.
I recommend instead you just pass individual frames over. It is trivially easy to pin the array of colors associated with a Texture2D and send it to a native plugin, and there are tons of Unity tutorials for native code integration.
If the Python script isn’t running as part of your Unity project (the actual running process that Unity is within), well, that’s a whole different can of worms involving some kind of operating system specific interprocess communication, and I’ve never done that from Unity, so Google is going to be your friend here.