★ 개요 ★

Texture2D <-> OpenCV.Mat 변환



★ OpenCV.Mat ★

-1. OpenCV 에서 제공하는 클래스

-2. Matrix 로 사용되며 값을 Matrix 로 저장하는데 사용된다.

-3. Matrix 로 계산하면 빠르기 때문에 사용하는 듯 하다



★ Texture2D 정보 -> OpenCV.Mat Class 저장하기 ★



- 코드 -

Texture2D imgTexture = Resources.Load ("lena") as Texture2D;


Mat imgMat = new Mat (imgTexture.height, imgTexture.width, CvType.CV_8UC4);


Utils.texture2DToMat (imgTexture, imgMat);




★ OpenCV.Mat 정보로 -> Texture2D 만들기 ★



- 코드 -

Texture2D texture = new Texture2D (imgMat.cols (), imgMat.rows (), TextureFormat.RGBA32, false);


Utils.matToTexture2D (imgMat, texture);


gameObject.GetComponent<Renderer> ().material.mainTexture = texture;





★ OpenCV.Mat 정보로 -> Texture2D 만들기 결과 ★ ( Texture2DToMatExample )









+ Recent posts