arskrald/AR-3/Assets/VideoBGScript.cs

37 lines
926 B
C#
Raw Normal View History

2019-03-04 17:07:53 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using OpenCVForUnity.CoreModule;
using OpenCVForUnity.ImgprocModule;
using Vuforia;
public class VideoBGScript : MonoBehaviour
{
Mat cameraImageMat;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
MatDisplay.SetCameraFoV(41.5f);
Image cameraImage = CameraDevice.Instance.GetCameraImage(Image.PIXEL_FORMAT.RGBA8888);
if (cameraImage != null) {
if (cameraImageMat == null) {
cameraImageMat = new Mat(cameraImage.Height, cameraImage.Width, CvType.CV_8UC4);
}
cameraImageMat.put(0,0, cameraImage.Pixels);
MatDisplay.DisplayMat(cameraImageMat, MatDisplaySettings.FULL_BACKGROUND);
}
}
}