Example #1
0
 /// <summary>
 /// Get single camera frame in OpenCV Mat format.
 /// Mat will have WebCamTexture's dimensions and MatType of CV_8UC4.
 /// </summary>
 /// <param name="webTex">WebCamTexture from which Texture2D will be created.</param>
 /// <param name="tex">Mat into which WebCamTexture contents will be copied. Will be resized to fit.</param>
 public static void GetWebCamMat(WebCamTexture webTex, ref Mat mat)
 {
     if (webTex.isPlaying)
     {
         CvConvert.WebCamTextureToMat(webTex, ref mat);
     }
 }
Example #2
0
 /// <summary>
 /// Get single camera frame in OpenCV Mat format.
 /// Mat will have WebCamTexture's dimensions and MatType of CV_8UC4.
 /// </summary>
 /// <param name="webTex">WebCamTexture from which Texture2D will be created.</param>
 /// <param name="tex">Mat into which WebCamTexture contents will be copied. Will be resized to fit.</param>
 public static void GetWebCamMat(WebCamTexture webTex, ref Mat mat)
 {
     if (webTex.isPlaying)
     {
         if (mat.Height != webTex.width || mat.Width != webTex.height || mat.Type() != MatType.CV_8UC4)
         {
             mat = new Mat(webTex.height, webTex.width, MatType.CV_8UC4);
         }
         CvConvert.WebCamTextureToMat(webTex, ref mat);
     }
 }