/// <summary> /// Overrides the standard GetIntrinsic method. /// </summary> /// <param name="channelName">The channel name.</param> /// <returns>The ProjectiveTransformationZhang</returns> /// <remarks>The method first searches for a pt file on disk. If this fails it is able to provide internal intrinsics for ZImage channel.</remarks> public override IProjectiveTransformation GetIntrinsics(string channelName) { IProjectiveTransformation result = null; log.Info("Trying to load projective transformation from file."); try { return(base.GetIntrinsics(channelName)); } catch { /* empty */ } if (result == null) { log.Info("Projective transformation file not found. Using R200 factory intrinsics as projective transformation."); switch (channelName) { case ChannelNames.ZImage: result = new ProjectiveTransformationZhang(widthZImage, heightZImage, calibDataDepth.focalLength.x, calibDataDepth.focalLength.y, calibDataDepth.principalPoint.x, calibDataDepth.principalPoint.y, calibDataDepth.radialDistortion[0], calibDataDepth.radialDistortion[1], calibDataDepth.radialDistortion[2], calibDataDepth.tangentialDistortion[0], calibDataDepth.tangentialDistortion[1]); break; case ChannelNames.Color: result = new ProjectiveTransformationZhang(widthColor, heightColor, calibDataColor.focalLength.x, calibDataColor.focalLength.y, calibDataColor.principalPoint.x, calibDataColor.principalPoint.y, calibDataColor.radialDistortion[0], calibDataColor.radialDistortion[1], calibDataColor.radialDistortion[2], calibDataColor.tangentialDistortion[0], calibDataColor.tangentialDistortion[1]); break; default: log.Error("Unsupported channel in GetIntrinsics()."); throw new ArgumentException("Unsupported channel " + channelName + " in GetIntrinsics()."); } } return(result); }
/// <summary> /// Overrides the standard GetIntrinsic method. /// </summary> /// <param name="channelName">The channel name.</param> /// <returns>The ProjectiveTransformationZhang</returns> /// <remarks>The method first searches for a pt file on disk. If this fails it is able to provide internal intrinsics for amplitude / depth channel.</remarks> public override IProjectiveTransformation GetIntrinsics(string channelName) { IProjectiveTransformation result = null; log.Info("Trying to load projective transformation from file."); try { result = base.GetIntrinsics(channelName); } catch { /* empty */ } if (result == null) { log.Info("Projective transformation file not found."); log.Info("Using Kinect factory intrinsics as projective transformation."); switch (channelName) { case ChannelNames.Amplitude: result = GetFactoryIRIntrinsics(); break; case ChannelNames.Distance: result = GetFactoryIRIntrinsics(); break; default: log.Error("Unsupported channel in GetIntrinsics()."); return(null); } } return(result); }