Skip to content
Permalink
Browse files

[k4a] fix extrinsics from color to depth/z/amplitude (#200)

  • Loading branch information...
sisiplac authored and jangernert committed Aug 8, 2019
1 parent 888e324 commit b89a6205c1d9936bdd53b84a8b566cb510521fcb
Showing with 5 additions and 11 deletions.
  1. +5 −11 BetaCameras/Kinect4Azure/Kinect4Azure.cs
@@ -529,33 +529,27 @@ public override RigidBodyTransformation GetExtrinsics(string channelFromName, st
}

Calibration calibration = _device.GetCalibration();
RotationMatrix rotMat;
Point3f translation;
RigidBodyTransformation rbt = null;

if (channelFromName == ChannelNames.Color && (channelToName == ChannelNames.Distance || channelToName == ChannelNames.ZImage || channelToName == ChannelNames.Intensity))
{
rotMat = new RotationMatrix(calibration.depth_camera_calibration.extrinsics.rotation);
translation = new Point3f(
calibration.depth_camera_calibration.extrinsics.translation[0] / 1000f,
calibration.depth_camera_calibration.extrinsics.translation[1] / 1000f,
calibration.depth_camera_calibration.extrinsics.translation[2] / 1000f);
rbt = GetExtrinsics(channelToName, channelFromName).GetInverted();
}
else if ((channelFromName == ChannelNames.Distance || channelFromName == ChannelNames.ZImage || channelFromName == ChannelNames.Intensity) && channelToName == ChannelNames.Color)
{
rotMat = new RotationMatrix(calibration.color_camera_calibration.extrinsics.rotation);
translation = new Point3f(
RotationMatrix rotMat = new RotationMatrix(calibration.color_camera_calibration.extrinsics.rotation);
Point3f translation = new Point3f(
calibration.color_camera_calibration.extrinsics.translation[0] / 1000f,
calibration.color_camera_calibration.extrinsics.translation[1] / 1000f,
calibration.color_camera_calibration.extrinsics.translation[2] / 1000f);
rbt = new RigidBodyTransformation(rotMat, translation);
}
else
{
string msg = string.Format("{0}: no valid extrinsics from channel {1} to {2}", Name, channelFromName, channelToName);
log.Error(msg);
throw new System.Exception(msg);
}

RigidBodyTransformation rbt = new RigidBodyTransformation(rotMat, translation);
_extrinsicsCache[keyName] = rbt;
return rbt;
}

0 comments on commit b89a620

Please sign in to comment.
You can’t perform that action at this time.