Skip to content

Commit c77eb2e

Browse files
committed
v1.0.4 Changed the HoloLensCameraStream plugin to the camnewnham's repository. (Improve camera update FPS, hide recording icon, extract camera intrinsic)
Hololens 10.0.17763.914 (RS5) Windows 10 SDK 10.0.18362.0 Visual Studio 2017 or 2019 Unity 2018.4.28f1+ Microsoft Mixed Reality Toolkit v2.2.0 OpenCVForUnity 2.4.1+
1 parent ca25664 commit c77eb2e

34 files changed

+4304
-1391
lines changed

Assets/HoloLensWithOpenCVForUnityExample/HoloLensArUcoExample/HoloLensArUcoCameraCalibrationExample.cs

+3-15
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,6 @@ public class HoloLensArUcoCameraCalibrationExample : MonoBehaviour
111111
/// </summary>
112112
HololensCameraStreamToMatHelper webCamTextureToMatHelper;
113113

114-
/// <summary>
115-
/// The gray mat.
116-
/// </summary>
117-
Mat grayMat;
118-
119114
/// <summary>
120115
/// The bgr mat.
121116
/// </summary>
@@ -204,6 +199,7 @@ public class HoloLensArUcoCameraCalibrationExample : MonoBehaviour
204199
IEnumerator Start()
205200
{
206201
webCamTextureToMatHelper = gameObject.GetComponent<HololensCameraStreamToMatHelper>();
202+
webCamTextureToMatHelper.outputColorFormat = WebCamTextureToMatHelper.ColorFormat.GRAY;
207203

208204
// fix the screen orientation.
209205
Screen.orientation = ScreenOrientation.LandscapeLeft;
@@ -246,10 +242,7 @@ public void OnWebCamTextureToMatHelperInitialized()
246242
InitializeCalibraton(webCamTextureMat);
247243

248244
// if WebCamera is frontFaceing, flip Mat.
249-
if (webCamTextureToMatHelper.GetWebCamDevice().isFrontFacing)
250-
{
251-
webCamTextureToMatHelper.flipHorizontal = true;
252-
}
245+
webCamTextureToMatHelper.flipHorizontal = webCamTextureToMatHelper.IsFrontFacing();
253246
}
254247

255248
/// <summary>
@@ -280,9 +273,7 @@ void Update()
280273
if (webCamTextureToMatHelper.IsPlaying() && webCamTextureToMatHelper.DidUpdateThisFrame())
281274
{
282275

283-
Mat rgbaMat = webCamTextureToMatHelper.GetMat();
284-
285-
Imgproc.cvtColor(rgbaMat, grayMat, Imgproc.COLOR_RGBA2GRAY);
276+
Mat grayMat = webCamTextureToMatHelper.GetMat();
286277

287278
if (shouldCaptureFrame)
288279
{
@@ -344,7 +335,6 @@ private void InitializeCalibraton(Mat frameMat)
344335
Debug.Log("aspectratio " + aspectratio[0]);
345336

346337

347-
grayMat = new Mat(frameMat.rows(), frameMat.cols(), CvType.CV_8UC1);
348338
bgrMat = new Mat(frameMat.rows(), frameMat.cols(), CvType.CV_8UC3);
349339
rgbaMat = new Mat(frameMat.rows(), frameMat.cols(), CvType.CV_8UC4);
350340
ids = new Mat();
@@ -377,8 +367,6 @@ private void DisposeCalibraton()
377367
{
378368
ResetCalibration();
379369

380-
if (grayMat != null)
381-
grayMat.Dispose();
382370
if (bgrMat != null)
383371
bgrMat.Dispose();
384372
if (rgbaMat != null)

0 commit comments

Comments
 (0)