Permalink
Browse files

Make image timestamps consistent (#171)

  • Loading branch information...
f00f authored and mischastik committed Dec 3, 2018
1 parent c388c1f commit 40089a0476eda174f048703a7432ea7e3091d21d
@@ -722,8 +722,6 @@ protected virtual FloatCameraImage CalcDistances()
img[y, x] = depthFrameData[idx] * distanceMap[y, depthWidthMinusOne - x] * 0.001f;
}
}
img.TimeStamp = timestampDepth;
}
return img;
}
@@ -745,9 +743,7 @@ protected virtual unsafe ColorCameraImage CalcColor()
bmp.UnlockBits(bData);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipX); //Kinect images are flipped in x-direction
ColorCameraImage img = new ColorCameraImage(bmp);
img.TimeStamp = timestampColor;
return img;
return new ColorCameraImage(bmp);
}
}
@@ -766,8 +762,6 @@ protected virtual FloatCameraImage CalcAmplitudes()
img[y, x] = (float)this.irFrameData[idx];
}
}
img.TimeStamp = timestampIR;
}
return img;
}
@@ -870,8 +864,6 @@ private Point3fCameraImage Calc3DCoordinates()
img[y, x] = new Point3f(worldPoints[idx].X * -1, worldPoints[idx].Y * -1, worldPoints[idx].Z);
}
}
img.TimeStamp = timestampDepth;
}
return img;
}
@@ -2004,7 +2004,6 @@ unsafe private FloatCameraImage CalcZImage()
int width = _currentDepthFrame.Width;
FloatCameraImage depthData = new FloatCameraImage(width, height);
depthData.TimeStamp = _currentFrameTimestamp;
short* source = (short*)_currentDepthFrame.Data;
for (int y = 0; y < height; y++)
@@ -2033,7 +2032,6 @@ unsafe private FloatCameraImage CalcIRImage(VideoFrame frame)
int width = frame.Width;
FloatCameraImage IRData = new FloatCameraImage(width, height);
IRData.TimeStamp = _currentFrameTimestamp;
byte* source = (byte*)frame.Data;
for (int y = 0; y < height; y++)
@@ -2072,10 +2070,7 @@ unsafe private ColorCameraImage CalcColor()
}
bitmap.UnlockBits(bmpData);
ColorCameraImage image = new ColorCameraImage(bitmap);
image.TimeStamp = _currentFrameTimestamp;
return image;
return new ColorCameraImage(bitmap);
}
#endregion
@@ -292,7 +292,6 @@ private FloatCameraImage CalcDistance()
{
ChannelName = _channelName,
FrameNumber = _scanCounter,
TimeStamp = _timeStamp
};
for (int x = 0; x < _radii.Length; ++x)
@@ -323,7 +322,6 @@ private Point3fCameraImage CalcPoint3DImage()
{
ChannelName = _channelName,
FrameNumber = _scanCounter,
TimeStamp = _timeStamp
};
for (int x = 0; x < _radii.Length; ++x)
@@ -326,7 +326,6 @@ private FloatCameraImage CalcIntensity()
lock (_frontLock)
{
result = new FloatCameraImage(_frontFrameData.Width, _frontFrameData.Height);
result.TimeStamp = (long)_frontFrameData.TimeStamp;
int start = _frontFrameData.IntensityStartOffset;
for (int i = 0; i < _frontFrameData.Height; ++i)
{
@@ -353,7 +352,6 @@ private FloatCameraImage CalcDistance()
lock (_frontLock)
{
result = new FloatCameraImage(_frontFrameData.Width, _frontFrameData.Height);
result.TimeStamp = (long)_frontFrameData.TimeStamp;
int start = _frontFrameData.DistanceStartOffset;
for (int i = 0; i < _frontFrameData.Height; ++i)
{
@@ -379,7 +377,6 @@ private UShortCameraImage CalcRawConfidenceMap()
lock (_frontLock)
{
result = new UShortCameraImage(_frontFrameData.Width, _frontFrameData.Height);
result.TimeStamp = (long)_frontFrameData.TimeStamp;
int start = _frontFrameData.ConfidenceStartOffset;
for (int i = 0; i < _frontFrameData.Height; ++i)
{
@@ -428,7 +425,6 @@ private Point3fCameraImage Calc3D()
lock (_frontLock)
{
result = new Point3fCameraImage(_frontFrameData.Width, _frontFrameData.Height);
result.TimeStamp = (long)_frontFrameData.TimeStamp;
float cx = _frontFrameData.CX;
float cy = _frontFrameData.CY;
@@ -1124,7 +1124,7 @@ private ParamDesc<long> TimeStampDesc
/// By default the TimeStamp is set to DateTime.UtcNow.Ticks at the beginning of <see cref="Update"/>.
/// Individual cameras may override this behaviour and e.g. use a timestamp delivered by the camera itself.
/// </remarks>
public long TimeStamp { get; protected set; }
public long TimeStamp { get; private set; }
#if !NETSTANDARD2_0
/// <summary>
@@ -1212,8 +1212,8 @@ public void Connect()
throw ExceptionBuilder.Build(typeof(InvalidOperationException), Name, "error_connectionFailed");
}
this.FrameNumber = -1;
this.TimeStamp = -1;
FrameNumber = -1;
TimeStamp = -1;
if (OnConnecting != null)
{
@@ -1318,9 +1318,8 @@ public void Update()
{
this.hasUpdateBeenCalled = true;
this.FrameNumber++;
this.TimeStamp = DateTime.UtcNow.Ticks;
UpdateImpl();
this.TimeStamp = DateTime.UtcNow.Ticks;
}
}
@@ -1587,12 +1586,9 @@ public CameraImage CalcChannel(string channelName)
{
if (img.FrameNumber < 1)
{
img.FrameNumber = this.FrameNumber;
}
if (img.TimeStamp < 1)
{
img.TimeStamp = this.TimeStamp;
img.FrameNumber = FrameNumber;
}
img.TimeStamp = TimeStamp;
if (string.IsNullOrWhiteSpace(img.ChannelName))
{
img.ChannelName = channelName;

0 comments on commit 40089a0

Please sign in to comment.