本文整理汇总了C#中ImageFrameReadyEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ImageFrameReadyEventArgs类的具体用法?C# ImageFrameReadyEventArgs怎么用?C# ImageFrameReadyEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageFrameReadyEventArgs类属于命名空间,在下文中一共展示了ImageFrameReadyEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: nui_ColorFrameReady
void nui_ColorFrameReady(object sender, ImageFrameReadyEventArgs e)
{
// 32-bit per pixel, RGBA image
PlanarImage Image = e.ImageFrame.Image;
video.Source = BitmapSource.Create(
Image.Width, Image.Height, 96, 96, PixelFormats.Bgr32, null, Image.Bits, Image.Width * Image.BytesPerPixel);
}
开发者ID:lordjoe,项目名称:kinectlibrary,代码行数:7,代码来源:MainWindow.xaml.cs
示例2: DepthFrameReady
private void DepthFrameReady(object sender, ImageFrameReadyEventArgs e)
{
PlanarImage p = e.ImageFrame.Image;
Color[] DepthColor = new Color[p.Height * p.Width];
float maxDist = 4000;
float minDist = 850;
float distOffset = maxDist - minDist;
depthImg = new Texture2D(GraphicsDevice, p.Width, p.Height);
int index = 0;
for (int y = 0; y < p.Height; y++)
{
for (int x = 0; x < p.Width; x++, index += 2)
{
int n = (y * p.Width + x) * 2;
int distance = (p.Bits[n + 0] | p.Bits[n + 1] << 8);
if (y == 100)
Console.Write(distance + ", ");
byte intensity = (byte)(255 - (255 * Math.Max(distance - minDist, 0) / (distOffset)));
DepthColor[y * p.Width + x] = new Color(intensity, intensity, intensity);
}
}
depthImg.SetData(DepthColor);
}
开发者ID:ewencluley,项目名称:KinectTest1,代码行数:28,代码来源:KinectBACKUP.cs
示例3: nui_VideoFrameReady
//****************************//
void nui_VideoFrameReady(object sender, ImageFrameReadyEventArgs evt)
{
PlanarImage imgKinect = evt.ImageFrame.Image;
imageRGB.Source = BitmapSource.Create(imgKinect.Width, imgKinect.Height, 96, 96, PixelFormats.Bgr32,
null, imgKinect.Bits, imgKinect.Width * imgKinect.BytesPerPixel);
}
开发者ID:Psykoangel,项目名称:csharp_projects-repo,代码行数:8,代码来源:MainWindow.xaml.cs
示例4: nui_DepthFrameReady
/// <summary>Fires when a depth frame is ready.</summary>
protected void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e)
{
// Convert depth frame to video frame to render it
PlanarImage Image = e.ImageFrame.Image;
byte[] convertedDepthFrame = util.convertDepthFrame(Image.Bits, ref depthFrame32);
image2.Source = BitmapSource.Create(Image.Width, Image.Height, 96, 96, PixelFormats.Bgr32, null, convertedDepthFrame, Image.Width * 4);
// Clear extraneous canvas elements (bones)
if (canvas1.Children.Count > 9 && handler.JointHistory[(int)JointID.HandLeft].Count > 0 && handler.JointHistory[(int)JointID.HandRight].Count > 0)
canvas1.Children.RemoveRange(9, canvas1.Children.Count - 9);
// Draw hand tracking lines and circle
/*if (handler.JointHistory[(int)JointID.HandLeft].Count > 0)
DrawCircle(handler.JointHistory[(int)JointID.HandLeft].Last());
if (handler.JointHistory[(int)JointID.HandRight].Count > 0)
DrawCircle(handler.JointHistory[(int)JointID.HandRight].Last());
for (int i = 0; i < handler.JointHistory[(int)JointID.HandLeft].Count - 1; i++)
DrawLine(handler.JointHistory[(int)JointID.HandLeft][i], handler.JointHistory[(int)JointID.HandLeft][i + 1]);
for (int i = 0; i < handler.JointHistory[(int)JointID.HandRight].Count - 1; i++)
DrawLine(handler.JointHistory[(int)JointID.HandRight][i], handler.JointHistory[(int)JointID.HandRight][i + 1]);*/
// Calculate FPS
++totalFrames;
if (lastTime < DateTime.Now.AddSeconds(-1)) {
int frameDiff = totalFrames - lastFrames;
lastFrames = totalFrames;
lastTime = DateTime.Now;
Title = "KinectNUI - " + frameDiff.ToString() + " FPS"; }
}
开发者ID:rravisrinivas,项目名称:KNUI-Maps,代码行数:30,代码来源:MainWindow.xaml.cs
示例5: nui_VideoFrameReady
public void nui_VideoFrameReady(object sender, ImageFrameReadyEventArgs e)
{
// Dump video stream to the Image element
PlanarImage Image = e.ImageFrame.Image;
image.Source = BitmapSource.Create(Image.Width, Image.Height, 96, 96,
PixelFormats.Bgr32, null, Image.Bits, Image.Width * Image.BytesPerPixel);
}
开发者ID:igordcard,项目名称:igordcard,代码行数:7,代码来源:MainWindow.xaml.cs
示例6: Update
public void Update(ImageFrameReadyEventArgs e)
{
if (depthFrame32 == null)
{
depthFrame32 = new byte[e.ImageFrame.Image.Width * e.ImageFrame.Image.Height * 4];
}
ConvertDepthFrame(e.ImageFrame.Image.Bits);
if (DepthBitmap == null)
{
DepthBitmap = new WriteableBitmap(e.ImageFrame.Image.Width, e.ImageFrame.Image.Height, 96, 96, PixelFormats.Bgra32, null);
}
DepthBitmap.Lock();
int stride = DepthBitmap.PixelWidth * DepthBitmap.Format.BitsPerPixel / 8;
Int32Rect dirtyRect = new Int32Rect(0, 0, DepthBitmap.PixelWidth, DepthBitmap.PixelHeight);
DepthBitmap.WritePixels(dirtyRect, depthFrame32, stride, 0);
DepthBitmap.AddDirtyRect(dirtyRect);
DepthBitmap.Unlock();
RaisePropertyChanged(()=>DepthBitmap);
}
开发者ID:klosejiang,项目名称:Magic-Hands,代码行数:25,代码来源:DepthStreamManager.cs
示例7: kinect_DepthFrameReady
void kinect_DepthFrameReady( object sender, ImageFrameReadyEventArgs e )
{
var source = e.ImageFrame.Image;
image1.Source = BitmapSource.Create( source.Width, source.Height, 96, 96,
PixelFormats.Gray16, null, ConvertGrayScale( source ).Bits,
source.Width * source.BytesPerPixel );
}
开发者ID:kaorun55,项目名称:kinect_sdk_sandbox,代码行数:7,代码来源:MainWindow.xaml.cs
示例8: runtime_VideoFrameReady
void runtime_VideoFrameReady(object sender, ImageFrameReadyEventArgs e)
{
if (this.VideoFrameReady != null)
{
this.VideoFrameReady(this, e);
}
}
开发者ID:aabrohi,项目名称:kinect-kollage,代码行数:7,代码来源:NuiRuntimeAdapter.cs
示例9: runtime_DepthFrameReady
void runtime_DepthFrameReady(object sender, ImageFrameReadyEventArgs e)
{
PlanarImage image = e.ImageFrame.Image;
BitmapSource source = BitmapSource.Create(image.Width, image.Height, 96, 96,
PixelFormats.Gray16, null, image.Bits, image.Width * image.BytesPerPixel);
depthImage.Source = source;
}
开发者ID:softwareguru,项目名称:KinectVideoApplication1,代码行数:8,代码来源:MainWindow.xaml.cs
示例10: Update
public BitmapSource Update(ImageFrameReadyEventArgs e)
{
PlanarImage Image = e.ImageFrame.Image;
ColorBitmap = BitmapSource.Create(Image.Width, Image.Height, 96, 96, PixelFormats.Bgr32, null, Image.Bits, Image.Width * Image.BytesPerPixel);
RaisePropertyChanged(()=>ColorBitmap);
return ColorBitmap;
}
开发者ID:nhippenmeyer,项目名称:CS247,代码行数:10,代码来源:ColorStreamManager.cs
示例11: RuntimeColorFrameReady
void RuntimeColorFrameReady(object sender, ImageFrameReadyEventArgs e)
{
ColorImage.Source = e.ImageFrame.ToBitmapSource();
if (_saveColorFrame)
{
_saveColorFrame = false;
e.ImageFrame.ToBitmapSource().Save(DateTime.Now.ToString("yyyyMMddHHmmss") + "_color.jpg", ImageFormat.Jpeg);
}
}
开发者ID:Cocotus,项目名称:kinect,代码行数:11,代码来源:MainWindow.xaml.cs
示例12: kinect_VideoFrameReady
void kinect_VideoFrameReady( object sender, ImageFrameReadyEventArgs e )
{
// 抜かれた瞬間のKINECTは、InstanceIndex が -1 になる
Runtime kinect = sender as Runtime;
if ( (kinect != null) && (kinect.InstanceIndex >= 0) ) {
PlanarImage srouce = e.ImageFrame.Image;
Image dest = images[kinect.InstanceIndex];
dest.Source = BitmapSource.Create( srouce.Width, srouce.Height, 96, 96,
PixelFormats.Bgr32, null, srouce.Bits, srouce.Width * srouce.BytesPerPixel );
}
}
开发者ID:kaorun55,项目名称:kinect_sdk_sandbox,代码行数:11,代码来源:MainWindow.xaml.cs
示例13: nui_DepthFrameReady
void nui_DepthFrameReady(object sender, ImageFrameReadyEventArgs e)
{
//Convert depth information for a pixel into color information
byte[] ColoredBytes = GenerateColoredBytes(e.ImageFrame);
//create an image based on returned colors
PlanarImage image = e.ImageFrame.Image;
image1.Source = BitmapSource.Create(image.Width, image.Height, 96, 96, PixelFormats.Bgr32, null,
ColoredBytes, image.Width * PixelFormats.Bgr32.BitsPerPixel / 8);
}
开发者ID:lalafang,项目名称:air-drums,代码行数:11,代码来源:KinectHandler.cs
示例14: nui_VideoFrameReady
/// <summary>
/// Event handler code for when the RGB camerastream is ready.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void nui_VideoFrameReady(object sender, ImageFrameReadyEventArgs e)
{
try
{
PlanarImage image = e.ImageFrame.Image;
rgbImage.Source = BitmapSource.Create(image.Width, image.Height, 6, 6,
PixelFormats.Bgr32, null, image.Bits, image.Width * image.BytesPerPixel);
}
catch (Exception ex)
{
rgbImage = null;
MessageBox.Show(ex.Message);
}
}
开发者ID:jonathan-w,项目名称:Gesture-Detector,代码行数:19,代码来源:RGBCamera.cs
示例15: ColorImageReady
void ColorImageReady(object sender, ImageFrameReadyEventArgs e)
{
PlanarImage planarImage = e.ImageFrame.Image;
//An interopBitmap is a WPF construct that enables resetting the Bits of the image.
//This is more efficient than doing a BitmapSource.Create call every frame.
if (imageHelper == null)
{
imageHelper = new InteropBitmapHelper(planarImage.Width, planarImage.Height, planarImage.Bits);
kinectColorImage.Source = imageHelper.InteropBitmap;
}
else
{
imageHelper.UpdateBits(planarImage.Bits);
}
}
开发者ID:guozanhua,项目名称:Kinect-Tracking-Project,代码行数:16,代码来源:KinectColorViewer.xaml.cs
示例16: OnDepthFrameReady
public void OnDepthFrameReady(ImageFrameReadyEventArgs e)
{
lock (this)
{
if (GraphicsDevice == null)
return;
if (depthTexture == null)
{
depthTexture = new Texture2D(GraphicsDevice, e.ImageFrame.Image.Width, e.ImageFrame.Image.Height);
}
PlanarImage Image = e.ImageFrame.Image;
ConvertDepthFrame(Image.Bits);
GraphicsDevice.Textures[0] = null;
depthTexture.SetData(depthFrame32);
}
}
开发者ID:ProjPossibility,项目名称:USC-AccessibleKinect,代码行数:17,代码来源:Game1.cs
示例17: DepthImageReady
private void DepthImageReady(object sender, ImageFrameReadyEventArgs e)
{
PlanarImage planarImage = e.ImageFrame.Image;
byte[] convertedDepthBits = convertDepthFrame(planarImage.Bits);
//An interopBitmap is a WPF construct that enables resetting the Bits of the image.
//This is more efficient than doing a BitmapSource.Create call every frame.
if (imageHelper == null)
{
imageHelper = new InteropBitmapHelper(planarImage.Width, planarImage.Height, convertedDepthBits);
kinectDepthImage.Source = imageHelper.InteropBitmap;
}
else
{
imageHelper.UpdateBits(convertedDepthBits);
}
calculateFrameRate();
}
开发者ID:guozanhua,项目名称:KINECT,代码行数:19,代码来源:KinectDepthViewer.xaml.cs
示例18: nuiRuntime_DepthFrameReady
unsafe void nuiRuntime_DepthFrameReady(object sender, ImageFrameReadyEventArgs e)
{
var image = e.ImageFrame.Image;
BitmapData bitmapData = this.CurrentValue.LockBits(new System.Drawing.Rectangle(0, 0, this.Width, this.Height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
int pointer = 0;
for (int y = 0; y < this.Height; y++)
{
byte* pDest = (byte*)bitmapData.Scan0.ToPointer() + y * bitmapData.Stride + bitmapData.Stride - 3;
for (int x = 0; x < this.Width; x++, pointer += 2, pDest -= 3)
{
int realDepth = image.Bits[pointer] | (image.Bits[pointer + 1] << 8);
byte intensity = (byte)(255 - (255 * realDepth / 0x0fff));
pDest[0] = intensity;
pDest[1] = intensity;
pDest[2] = intensity;
}
}
this.CurrentValue.UnlockBits(bitmapData);
this.OnNewDataAvailable();
}
开发者ID:aabrohi,项目名称:kinect-kollage,代码行数:21,代码来源:SDKDepthBitmapDataSource.cs
示例19: nui_VideoFrameReady
void nui_VideoFrameReady(object sender, ImageFrameReadyEventArgs e)
{
//Manually create BitmapSource for Video
PlanarImage imageData = e.ImageFrame.Image;
image1.Source = BitmapSource.Create(imageData.Width, imageData.Height, 96, 96, PixelFormats.Bgr32, null, imageData.Bits, imageData.Width * imageData.BytesPerPixel);
}
开发者ID:adr2370,项目名称:Kinect-Target-Game,代码行数:6,代码来源:MainWindow.xaml.cs
示例20: kinectDevice_VideoFrameReady
void kinectDevice_VideoFrameReady(object sender, ImageFrameReadyEventArgs e)
{
PlanarImage p = e.ImageFrame.Image;
Color[] color = new Color[p.Height * p.Width];
kinectRGBVideo = new Texture2D(mDevice, p.Width, p.Height);
int index = 0;
for (int y = 0; y < p.Height; y++)
{
for (int x = 0; x < p.Width; x++, index += 4)
{
color[y * p.Width + x] = new Color(p.Bits[index + 2], p.Bits[index + 1], p.Bits[index + 0]);
}
}
kinectRGBVideo.SetData<Color>(color);
}
开发者ID:guozanhua,项目名称:FruitNinjaKinect,代码行数:17,代码来源:NinjaGame.cs
注:本文中的ImageFrameReadyEventArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论