diff --git a/KinectRecorder/.vs/KinectRecorder/v14/.suo b/KinectRecorder/.vs/KinectRecorder/v14/.suo
new file mode 100644
index 0000000..2d77ce7
Binary files /dev/null and b/KinectRecorder/.vs/KinectRecorder/v14/.suo differ
diff --git a/KinectRecorder/BodyIndexHandler.cs b/KinectRecorder/BodyIndexHandler.cs
index d45c804..c95ea17 100644
--- a/KinectRecorder/BodyIndexHandler.cs
+++ b/KinectRecorder/BodyIndexHandler.cs
@@ -139,10 +139,23 @@ public void BodyIndexFrameArrival(BodyIndexFrame bif, ref bool frameProcessed, d
ProcessBodyIndexFrameData(bodyIndexBuffer.UnderlyingBuffer, bodyIndexBuffer.Size);
frameProcessed = true;
}
-
+
if (bodyRecording)
{
- bBitmap = UtilityClass.ByteArrayToBitmap(bodyPixelBuffer, width, height, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
+ Bitmap bitmapFrame;
+ try
+ {
+ bitmapFrame = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
+ }
+ catch(Exception e)
+ {
+ Console.WriteLine("Body Exception");
+ Console.WriteLine(e);
+ System.GC.Collect();
+ bitmapFrame = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
+ }
+ UtilityClass.ByteArrayToBitmap(ref bitmapFrame, bodyPixelBuffer, width, height);
+ bBitmap = bitmapFrame;
bodyBitmapBuffer.Enqueue(bBitmap);
//System.GC.Collect();
frameCount++;
@@ -153,6 +166,8 @@ public void BodyIndexFrameArrival(BodyIndexFrame bif, ref bool frameProcessed, d
frameCount++;
}
}
+
+
}
}
diff --git a/KinectRecorder/ColorHandler.cs b/KinectRecorder/ColorHandler.cs
index 0d800c0..ee07784 100644
--- a/KinectRecorder/ColorHandler.cs
+++ b/KinectRecorder/ColorHandler.cs
@@ -83,8 +83,10 @@ public void Write()
//Console.WriteLine("color");
if (colorBitmapBuffer.Count > 0)
{
+ //Console.WriteLine("3");
//Console.WriteLine(colorBitmapBuffer.Count);
this.colorWriter.WriteVideoFrame(colorBitmapBuffer.Dequeue());
+ //Console.WriteLine("4");
}
else if (!colorRecording)
{
@@ -117,7 +119,6 @@ public void setRecordingState(bool state)
public void ColorFrameArrival(ColorFrame colorFrame, ref WriteableBitmap colorBitmap, double fps)
{
-
using (KinectBuffer colorBuffer = colorFrame.LockRawImageBuffer())
{
colorBitmap.Lock();
@@ -138,10 +139,27 @@ public void ColorFrameArrival(ColorFrame colorFrame, ref WriteableBitmap colorBi
colorFrame.CopyConvertedFrameDataToArray(colorPixelBuffer, ColorImageFormat.Bgra);
+
if (colorRecording)
{
- cBitmap = UtilityClass.ByteArrayToBitmap(colorPixelBuffer, width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+ //Console.WriteLine("1");
+ Bitmap bitmapFrame;
+ try
+ {
+ bitmapFrame = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+ }
+
+ catch (Exception e)
+ {
+ Console.WriteLine("Color Exception");
+ Console.WriteLine(e);
+ System.GC.Collect();
+ bitmapFrame = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
+ }
+ UtilityClass.ByteArrayToBitmap(ref bitmapFrame, colorPixelBuffer, width, height);
+ cBitmap = bitmapFrame;
colorBitmapBuffer.Enqueue(cBitmap);
+ //Console.WriteLine("2");
frameCount++;
//garbageCount++;
if (fps < 16.0)
@@ -149,20 +167,12 @@ public void ColorFrameArrival(ColorFrame colorFrame, ref WriteableBitmap colorBi
Console.WriteLine("fps droped");
colorBitmapBuffer.Enqueue(cBitmap);
frameCount++;
- //garbageCount++;
- }
- /*
- if (garbageCount > 100)
- {
- System.GC.Collect();
- garbageCount = 0;
}
- */
+
}
}
}
-
-
+ //Console.WriteLine("5");
}
diff --git a/KinectRecorder/DepthHandler.cs b/KinectRecorder/DepthHandler.cs
index 47e93fe..6457c32 100644
--- a/KinectRecorder/DepthHandler.cs
+++ b/KinectRecorder/DepthHandler.cs
@@ -238,6 +238,7 @@ public void DepthFrameArrival(DepthFrame df, ref bool frameProcessed, double fps
garbageCount++;
this.depthBinaryBuffer.Enqueue((byte[])(depthPixelBuffer.Clone()));
this.frameCount++;
+
if (fps < 16.0)
{
garbageCount++;
@@ -245,11 +246,11 @@ public void DepthFrameArrival(DepthFrame df, ref bool frameProcessed, double fps
this.depthBinaryBuffer.Enqueue((byte[])(depthPixelBuffer.Clone()));
this.frameCount++;
}
- if(garbageCount > 500)
+ /*if(garbageCount > 500)
{
System.GC.Collect();
garbageCount = 0;
- }
+ }*/
}
diff --git a/KinectRecorder/InfraredHandler.cs b/KinectRecorder/InfraredHandler.cs
index 9c96387..0d26d04 100644
--- a/KinectRecorder/InfraredHandler.cs
+++ b/KinectRecorder/InfraredHandler.cs
@@ -245,7 +245,7 @@ public void InfraredFrameArrival(InfraredFrame df, double fps, ref bool processe
}
}
}
- private Bitmap IRFrameToBitmap(InfraredFrame frame)
+ /*private Bitmap IRFrameToBitmap(InfraredFrame frame)
{
System.Drawing.Imaging.PixelFormat format = System.Drawing.Imaging.PixelFormat.Format24bppRgb;
@@ -264,7 +264,7 @@ private Bitmap IRFrameToBitmap(InfraredFrame frame)
}
return UtilityClass.ByteArrayToBitmap(pixelData, this.Width, this.Height, format);
- }
+ }*/
private unsafe void ProcessInfraredFrameData(IntPtr infraredFrameData, uint infraredFrameDataSize)
{
// infrared frame data is a 16 bit value
diff --git a/KinectRecorder/KinectRecorder.csproj b/KinectRecorder/KinectRecorder.csproj
index 4bed495..365deb1 100644
--- a/KinectRecorder/KinectRecorder.csproj
+++ b/KinectRecorder/KinectRecorder.csproj
@@ -13,7 +13,8 @@
512
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
4
- 262bc50c
+
+
AnyCPU
@@ -56,6 +57,7 @@
prompt
MinimumRecommendedRules.ruleset
true
+ true
true
@@ -88,8 +90,8 @@
..\packages\Accord.Video.3.8.0\lib\net45\Accord.Video.dll
True
-
- ..\packages\Accord.Video.FFMPEG.3.8.0\lib\net45\Accord.Video.FFMPEG.dll
+
+ ..\packages\Accord.Video.FFMPEG.x64.3.8.0\lib\net45\Accord.Video.FFMPEG.x64.dll
True
@@ -196,12 +198,12 @@
- This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
+
-
+