I have a unity script in c# and a dll file written in c++, and I need to capture the live video from the web camera and use the video in both unity and dll. So now I have two options: 1) capture the video in unity by using WebCamTexture, and pass the data into the function in dll; or 2) capture the video using opencv in dll, and pass the data into unity, and convert it to Color32.
Could anybody tell me how to
(1) convert from Color32 to byte, pass to dll, and convert the received byte to a valid image format(eg. IplImage in OpenCV)?
(2) convert the image captured in dll to byte, pass it to unity, and interpret it as Color32,
AS FAST AS POSSIBLE please?
Thank you and wait for your suggestions!