/// <summary> /// 補正対象のテクスチャが初期化された際に補正用の設定を初期化する /// </summary> /// <param name="texture"></param> private void VideoCaptureController_ChangeTextureEvent(TextureHolderBase sender, Texture texture) { rgbMat = new Mat(texture.height, texture.width, CvType.CV_8UC3); if (this.texture != null) { if (this.texture.width != texture.width || this.texture.height != texture.height) { DestroyImmediate(this.texture); this.texture = null; } } if (this.texture == null) { this.texture = new Texture2D(texture.width, texture.height, TextureFormat.RGB24, false); } newCameraMatrix = Calib3d.getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, videoCaptureController.RGBMat.size(), 0, videoCaptureController.RGBMat.size()); if (isFisheye) { Calib3d.fisheye_initUndistortRectifyMap(this.cameraMatrix, this.distCoeffs, new Mat(), newCameraMatrix, videoCaptureController.RGBMat.size(), CvType.CV_32FC1, mapX, mapY); } else { Calib3d.initUndistortRectifyMap(this.cameraMatrix, this.distCoeffs, new Mat(), newCameraMatrix, videoCaptureController.RGBMat.size(), CvType.CV_32FC1, mapX, mapY); } // OnTextureInitialized(GetTexture()); }