Permalink
Browse files

chatted with noah version of code

we have sillouette working, but are missing RGB image from the
colorImageFrame in this.colorPixels. We need to put RGB data from
colorPixels into the silouetted image (i.e. we need a cutout of people).

currently, there is a method in Draw() to force drawing of the RGB image
frame into the top left of the application if this.ColorPixels is mapped
into finalImage.
  • Loading branch information...
1 parent e154384 commit 7f98df1764c6665dbec9e5c95050c735bb0e155b @jadedoto jadedoto committed Feb 20, 2013
Showing with 36 additions and 12 deletions.
  1. +34 −10 HIVE_KinectGame/HIVE_KinectGame/HIVE_KinectGame/Game1.cs
  2. BIN HIVE_KinectGame/HIVE_KinectGame/HIVE_KinectGame/bin/x86/Debug/Content/screenshots/snapshot-0.png
  3. BIN HIVE_KinectGame/HIVE_KinectGame/HIVE_KinectGame/bin/x86/Debug/HIVE_KinectGame.exe
  4. BIN HIVE_KinectGame/HIVE_KinectGame/HIVE_KinectGame/bin/x86/Debug/HIVE_KinectGame.pdb
  5. BIN HIVE_KinectGame/HIVE_KinectGame/HIVE_KinectGame/bin/x86/Debug/SkinnedModel.dll
  6. BIN HIVE_KinectGame/HIVE_KinectGame/HIVE_KinectGame/bin/x86/Debug/SkinnedModel.pdb
  7. BIN HIVE_KinectGame/HIVE_KinectGame/HIVE_KinectGame/obj/x86/Debug/HIVE_KinectGame.exe
  8. BIN HIVE_KinectGame/HIVE_KinectGame/HIVE_KinectGame/obj/x86/Debug/HIVE_KinectGame.pdb
  9. BIN HIVE_KinectGame/HIVE_KinectGame/HIVE_KinectGame/obj/x86/Debug/ResolveAssemblyReference.cache
  10. +2 −2 HIVE_KinectGame/HIVE_KinectGame/HIVE_KinectGameContent/obj/x86/Debug/ContentPipeline.xml
  11. BIN HIVE_KinectGame/HIVE_KinectGame/HIVE_KinectGameContent/obj/x86/Debug/ResolveAssemblyReference.cache
  12. BIN HIVE_KinectGame/SkinnedModel/bin/x86/Debug/SkinnedModel.dll
  13. BIN HIVE_KinectGame/SkinnedModel/bin/x86/Debug/SkinnedModel.pdb
  14. BIN HIVE_KinectGame/SkinnedModel/obj/x86/Debug/ResolveAssemblyReference.cache
  15. BIN HIVE_KinectGame/SkinnedModel/obj/x86/Debug/SkinnedModel.dll
  16. BIN HIVE_KinectGame/SkinnedModel/obj/x86/Debug/SkinnedModel.pdb
  17. BIN HIVE_KinectGame/SkinnedModelPipeline/bin/x86/Debug/SkinnedModel.dll
  18. BIN HIVE_KinectGame/SkinnedModelPipeline/bin/x86/Debug/SkinnedModel.pdb
  19. BIN HIVE_KinectGame/SkinnedModelPipeline/bin/x86/Debug/SkinnedModelPipeline.dll
  20. BIN HIVE_KinectGame/SkinnedModelPipeline/bin/x86/Debug/SkinnedModelPipeline.pdb
  21. BIN HIVE_KinectGame/SkinnedModelPipeline/obj/x86/Debug/ResolveAssemblyReference.cache
  22. BIN HIVE_KinectGame/SkinnedModelPipeline/obj/x86/Debug/SkinnedModelPipeline.dll
  23. BIN HIVE_KinectGame/SkinnedModelPipeline/obj/x86/Debug/SkinnedModelPipeline.pdb
@@ -228,6 +228,11 @@ public class Game1 : Microsoft.Xna.Framework.Game
private Texture2D[] slideshowImages = null;
/// <summary>
+ /// The final rendered image with the screenscreen processed onto it.
+ /// </summary>
+ private Texture2D finalImage = null;
+
+ /// <summary>
/// The index of which slide in the slideshow we look at.
/// </summary>
private int whichSlide = 0;
@@ -271,7 +276,7 @@ public class Game1 : Microsoft.Xna.Framework.Game
/// <summary>
/// Intermediate storage for the color data received from the camera
/// </summary>
- private byte[] colorPixels = null;
+ private Byte[] colorPixels = null;
/// <summary>
/// Intermediate storage for the depth data received from the sensor
@@ -546,7 +551,7 @@ protected void kinect_AllFramesReady(object sender, AllFramesReadyEventArgs imag
this.colorPixels = new Byte[colorFrame.PixelDataLength];
this.depthFrame.CopyDepthImagePixelDataTo(this.depthPixels);
- //this.colorFrame.CopyPixelDataTo(this.colorPixels);
+ this.colorFrame.CopyPixelDataTo(this.colorPixels);
this.kinect.CoordinateMapper.MapDepthFrameToColorFrame(
DepthImageFormat.Resolution640x480Fps30,
@@ -600,16 +605,26 @@ protected void kinect_AllFramesReady(object sender, AllFramesReadyEventArgs imag
}
}
- if (this.foundPlayer)
+ // If we've found a player in the image, then run through the player mask
+ // and copy pixels from the RGB camera to a final image
+ // and save it as a screenshot.
+ if (true)//this.foundPlayer)
{
- // Do screenshot stuff.
- this.colorFrame.CopyPixelDataTo(this.colorPixels);
- Texture2D finalImage = new Texture2D(graphics.GraphicsDevice, this.kinect.ColorStream.FrameWidth, this.kinect.ColorStream.FrameHeight);
- //finalImage.SetData(this.colorPixels);
- finalImage.SetData(this.greenScreenPixelData);
+ // get the RGB color frame image
+ // this.colorFrame.CopyPixelDataTo(this.colorPixels);
+
+ // Create a new Texture2D in which we will store out final image (masked player image)
+ this.finalImage = new Texture2D(graphics.GraphicsDevice, this.kinect.ColorStream.FrameWidth, this.kinect.ColorStream.FrameHeight);
+
+ // TODO: Process the image and merge the player onto our background scene.
+
+ // Once we've completed processing the image, save it into the screenshots directory.
+ this.finalImage.SetData(this.colorPixels);
+
+ //finalImage.SetData(this.greenScreenPixelData);
Stream stream = File.OpenWrite(this.Content.RootDirectory + "\\screenshots\\" + "snapshot-" + this.snapNumber + ".png");
- finalImage.SaveAsPng(stream, 640, 480);
- //finalImage.SaveAsPng(stream, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
+ this.finalImage.SaveAsPng(stream, 640, 480);
+ this.finalImage.SaveAsPng(stream, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
this.snapNumber++;
stream.Close();
}
@@ -919,6 +934,15 @@ protected override void Draw(GameTime gameTime)
// If we are in the main 3D envrionment. This is the majority of the game.
if (this.gameState == 1)
{
+
+ if (this.finalImage != null)
+ {
+ // TEMPORARY FORCE DRAW RGB
+ spriteBatch.Begin();
+ spriteBatch.Draw(this.finalImage, new Rectangle(0, 0, 640, 480), Microsoft.Xna.Framework.Color.White);
+ spriteBatch.End();
+ }
+
// If we are changing the 3D environment, then ensure we load a different background image than we just had.
if (this.sceneJustChanged == true)
{
@@ -20,7 +20,7 @@
<Time>2013-02-15T13:09:32.2942805-05:00</Time>
<Dependency>
<Key>obj\x86\Debug\dude_0.xml</Key>
- <Value>2013-02-18T13:56:47.0590394-05:00</Value>
+ <Value>2013-02-20T11:26:01.3454526-05:00</Value>
</Dependency>
<Request>C:\Users\vtpu222\Documents\GitHub\A-S-Kinect-Digital-Signage\HIVE_KinectGame\HIVE_KinectGame\HIVE_KinectGame\bin\x86\Debug\Content\head_0.xnb</Request>
<Request>C:\Users\vtpu222\Documents\GitHub\A-S-Kinect-Digital-Signage\HIVE_KinectGame\HIVE_KinectGame\HIVE_KinectGame\bin\x86\Debug\Content\jacket_0.xnb</Request>
@@ -112,7 +112,7 @@
<Assemblies>
<Assembly>
<Key>C:\Users\vtpu222\Documents\GitHub\A-S-Kinect-Digital-Signage\HIVE_KinectGame\SkinnedModelPipeline\bin\x86\Debug\SkinnedModelPipeline.dll</Key>
- <Value>2013-02-18T13:56:42.7936129-05:00</Value>
+ <Value>2013-02-20T11:25:56.8684526-05:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.XImporter.dll</Key>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 7f98df1

Please sign in to comment.