本文整理汇总了C#中DataContainer.Add方法的典型用法代码示例。如果您正苦于以下问题:C# DataContainer.Add方法的具体用法?C# DataContainer.Add怎么用?C# DataContainer.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataContainer
的用法示例。
在下文中一共展示了DataContainer.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoRendering
//.........这里部分代码省略.........
rgbOfDepthImage = Senz3DUtils.GetRgbOfDepthPixels(depthImage, colorImage, uvMapImage);
}
rgbOfDepthImageCopy = rgbOfDepthImage.Copy();
RgbOfDepthImageFrameTime = sw.ElapsedMilliseconds;
}
else
{
rgbOfDepthImage = null;
rgbOfDepthImageCopy = null;
RgbOfDepthImageFrameTime = -1;
}
/* Get DepthOfRGB */
Image<Gray, float> depthOfRgbImage, depthOfRgbImageCopy;
if (DepthOfRgbChecked && uvMapImage != null)
{
sw.Restart();
depthOfRgbImage = Senz3DUtils.GetDepthOfRGBPixels(depthImage, colorImage, uvMapImage);
depthOfRgbImageCopy = depthOfRgbImage.Copy();
DepthOfRgbImageFrameTime = sw.ElapsedMilliseconds;
}
else
{
depthOfRgbImage = null;
depthOfRgbImageCopy = null;
DepthOfRgbImageFrameTime = -1;
}
_pp.ReleaseFrame();
if (IsRenderContent)
{
Task.Factory.StartNew(() =>
{
var bitmap = colorImageCopy.ToBitmapSource(true);
colorImageCopy.Dispose();
return bitmap;
}).ContinueWith(s => ColorImageSource = s.Result);
Task.Factory.StartNew(() =>
{
var bitmap = depthImageCopy.ToGradientBitmapSource(true, EmguExtensions.LowConfidence, EmguExtensions.Saturation);
depthImageCopy.Dispose();
return bitmap;
}).ContinueWith(s => DepthImageSource = s.Result);
Task.Factory.StartNew(() =>
{
var bitmap = confidenceMapImageCopy.ToBitmapSource(true);
confidenceMapImageCopy.Dispose();
return bitmap;
}).ContinueWith(s => ConfidenceMapImageSource = s.Result);
/* draw uvmap */
if (uvMapImage != null)
Task.Factory.StartNew(() =>
{
var bitmap = uvMapImageCopy.ToBitmapSource(true);
uvMapImageCopy.Dispose();
return bitmap;
}).ContinueWith(s => UVMapImageSource = s.Result);
/* draw rgbofdepth */
if (rgbOfDepthImage != null)
{
Task.Factory.StartNew(() =>
{
var bitmap = rgbOfDepthImageCopy.ToBitmapSource(true);
rgbOfDepthImageCopy.Dispose();
return bitmap;
}).ContinueWith(s => RgbOfDepthImageSource = s.Result);
}
/* draw depthofrgb */
if (depthOfRgbImage != null)
Task.Factory.StartNew(() =>
{
var bitmap = depthOfRgbImageCopy.ToGradientBitmapSource(true, EmguExtensions.LowConfidence, EmguExtensions.Saturation);
depthOfRgbImageCopy.Dispose();
return bitmap;
}).ContinueWith(s => DepthOfRgbImageSource = s.Result);
}
var dc = new DataContainer(++_frameId, DateTime.Now)
{
new RgbImageData(this, "color", colorImage),
new GrayFloatImage(this, "depth", depthImage),
new RgbImageData(this, "confidence", confidenceMapImage),
};
if (uvMapImage != null) dc.Add(new RgbFloatImage(this, "uvmap", uvMapImage));
if (rgbOfDepthImage != null) dc.Add(new RgbImageData(this, "rgbofdepth", rgbOfDepthImage));
if (depthOfRgbImage != null) dc.Add(new GrayFloatImage(this, "depthofrgb", depthOfRgbImage));
Publish(dc);
}
_pp.Close();
_pp.Dispose();
}
示例2: Push
protected void Push()
{
// Do not publish if staged data is empty
lock (_stagedDataLock)
{
if (!StagedData.Any())
return;
}
var container = new DataContainer(++_frameId, DateTime.Now);
lock (_stagedDataLock)
{
foreach (var data in StagedData)
container.Add(data);
StagedData.Clear();
}
Publish(container);
}