예제 #1
0
        public static WriteableBitmap FromUShort(ushort[] myDepthFrame)
        {
            byte[]          pixels      = ImageExtensions.ConvertUshortToByte(myDepthFrame);
            WriteableBitmap depthBitmap = WriteableBitmapUtils.FromByteArray_ToGray(pixels, DepthMetaData.XDepthMaxKinect, DepthMetaData.YDepthMaxKinect);

            return(depthBitmap);
        }
예제 #2
0
        public void SetDepthBitmap()
        {
            //for image viewing - rotate by 180 degrees
            //this.DepthMetaData.FrameData = DepthMetaData.RotateDepthFrame(this.DepthMetaData.FrameData, DepthMetaData.XResDefault, DepthMetaData.YResDefault);

            this.imageDepth.Source = WriteableBitmapUtils.FromByteArray_ToGray(this.DepthMetaData.Pixels, DepthMetaData.XDepthMaxKinect, DepthMetaData.YDepthMaxKinect);
        }
예제 #3
0
 public DepthMetaData(List <OpenTK.Vector3> vectors, bool createBitmap)
 {
     this.FrameData = FromVector3List(vectors);
     if (createBitmap)
     {
         this.pixels = ImageExtensions.ConvertUshortToByte(this.FrameData);
         depthBitmap = WriteableBitmapUtils.FromByteArray_ToGray(pixels, DepthMetaData.XDepthMaxKinect, DepthMetaData.YDepthMaxKinect);
     }
 }
예제 #4
0
        public static WriteableBitmap ToWriteableBitmap(List <Vector3> listOfPoints)
        {
            ushort[] myDepthFrame = FromVector3List(listOfPoints);

            byte[]          pixels      = ImageExtensions.ConvertUshortToByte(myDepthFrame);
            WriteableBitmap depthBitmap = WriteableBitmapUtils.FromByteArray_ToGray(pixels, DepthMetaData.XDepthMaxKinect, DepthMetaData.YDepthMaxKinect);

            return(depthBitmap);
        }
예제 #5
0
 private void SaveColorBitmap()
 {
     //write color Bitmap
     if (this.ColorMetaData != null)
     {
         //ImageSource imSource = ImageSourceUtils.CreateImageSource(ColorMetaData.Pixels, ColorMetaData.XResDefault, ColorMetaData.YResDefault);
         WriteableBitmap bitmap = WriteableBitmapUtils.FromByteArray_ToColor(ColorMetaData.Pixels, ColorMetaData.XColorMaxKinect, ColorMetaData.YColorMaxKinect);
         WriteableBitmapUtils.SaveImage(pathModels, "Color_", bitmap, true);
     }
 }
예제 #6
0
        public IRMetaData(InfraredFrame myframeIR, bool createBitmap)
        {
            this.frameInfrared = myframeIR;

            this.FrameData = AssignIRFrameData(myframeIR);


            if (createBitmap)
            {
                this.pixels = ImageExtensions.ConvertUshortToByte(this.FrameData);
                irBitmap    = WriteableBitmapUtils.FromByteArray_ToGray(pixels, MetaDataBase.XDepthMaxKinect, MetaDataBase.YDepthMaxKinect);
            }
        }
예제 #7
0
        private void ShowDepthScreenshot()
        {
            this.imageDepth.Source = null;

            if (this.DepthMetaData == null)
            {
                return;
            }

            WriteableBitmap depthBitmapTest = WriteableBitmapUtils.FromByteArray_ToGray(this.DepthMetaData.Pixels, DepthMetaData.XDepthMaxKinect, DepthMetaData.YDepthMaxKinect);

            this.ImageScreenshot   = depthBitmapTest;
            this.imageDepth.Source = depthBitmapTest;
        }
예제 #8
0
        private void SaveImageInterpolated()
        {
            if (listPointsInterpolated == null)
            {
                return;
            }
            //-----------------------------------------------
            //now interpolate last 10 frames to one frame and save


            //ushort[] rotatedPoints = DepthMetaData.RotateDepthFrame(this.DepthMetaData.DepthFrameData, DepthMetaData.XResDefault, DepthMetaData.YResDefault);

            WriteableBitmap depthInterpolated = DepthMetaData.ToWriteableBitmap(listPointsInterpolated);

            WriteableBitmapUtils.SaveImage(pathModels, "DepthInterpolated", depthInterpolated, true);
        }
예제 #9
0
        private bool ProcessDepthFrame(MultiSourceFrame multiSourceFrame)
        {
            // Depth
            using (var frame = multiSourceFrame.DepthFrameReference.AcquireFrame())
            {
                if (frame != null)
                {
                    DepthFrame frameDepth = frame;
                    if (PointCloudScannerSettings.ScannerMode == ScannerMode.Depth || PointCloudScannerSettings.ScannerMode == ScannerMode.Color_Depth || PointCloudScannerSettings.ScannerMode == ScannerMode.Color_Depth_3DDisplay)
                    {
                        this.DepthMetaData = new DepthMetaData(frameDepth, false);


                        if (PointCloudScannerSettings.BackgroundRemoved)
                        {
                            backgroundRemovalTool.DepthFrameData_RemoveBackground(this.DepthMetaData, this.BodyMetaData);
                            if (PointCloudScannerSettings.CutFrames)
                            {
                                this.DepthMetaData.FrameData = DepthMetaData.CutDepth(this.DepthMetaData.FrameData, PointCloudScannerSettings.CutFrameMaxDistance, PointCloudScannerSettings.CutFrameMinDistance, ref numberOfCutPoints);
                            }
                            if (PointCloudScannerSettings.ScannerMode != ScannerMode.Color_Depth_3DDisplay)
                            {
                                this.imageDepth.Source = WriteableBitmapUtils.FromByteArray_ToGray(this.DepthMetaData.Pixels, DepthMetaData.XDepthMaxKinect, DepthMetaData.YDepthMaxKinect);
                            }
                        }
                        else
                        {
                            if (PointCloudScannerSettings.CutFrames)
                            {
                                this.DepthMetaData.FrameData = DepthMetaData.CutDepth(this.DepthMetaData.FrameData, PointCloudScannerSettings.CutFrameMaxDistance, PointCloudScannerSettings.CutFrameMinDistance, ref numberOfCutPoints);
                            }
                            if (PointCloudScannerSettings.ScannerMode != ScannerMode.Color_Depth_3DDisplay)
                            {
                                this.imageDepth.Source = DepthMetaData.FromUShort(DepthMetaData.FrameData);
                            }
                        }
                        if (PointCloudScannerSettings.InterpolateFrames)
                        {
                            CalculateInterpolatedPixels();
                        }
                    }

                    return(true);
                }
            }
            return(false);
        }
예제 #10
0
 public RibbonGroupsPanel()
 {
     _phantomGroup = new RibbonGroup
     {
         Header         = "RibbonGroup",
         ItemCollection =
         {
             new RibbonButton
             {
                 LargeIcon       = WriteableBitmapUtils.Create(32, 32),
                 SmallIcon       = WriteableBitmapUtils.Create(16, 16),
                 Text            = "Ribbon Item",
                 ActualItemStyle = RibbonItemStyle.Large
             }
         }
     };
 }
예제 #11
0
        private void SaveDepthAndColor_DataAndImage()
        {
            try
            {
                //byte[] myColorPixels = MetaDataBase.CreateColorInfoForDepth(this.ColorMetaData, this.DepthMetaData, this.coordinateMapper);
                PointCloud pc = MetaDataBase.ToPointCloud(this.ColorMetaData, this.DepthMetaData, this.BodyMetaData, this.coordinateMapper);

                //List<Point3D> newList = DepthMetaData.CreateListPoint3D_Depth(this.DepthMetaData.FrameData, DepthMetaData.XResDefault, DepthMetaData.YResDefault);
                SavePointCloudColor(pc);

                WriteableBitmap bitmapCustom = WriteableBitmapUtils.FromPointCloud_ToColor(pc, DepthMetaData.XDepthMaxKinect, DepthMetaData.YDepthMaxKinect);
                WriteableBitmapUtils.SaveImage(pathModels, "ColorDepthSpace_", bitmapCustom, true);
            }
            catch (Exception err)
            {
                System.Diagnostics.Debug.WriteLine("Error " + err.Message);
            }
        }
예제 #12
0
        private void SaveDepthBitmap()
        {
            WriteableBitmap depthBitmap = WriteableBitmapUtils.FromByteArray_ToGray(DepthMetaData.Pixels, DepthMetaData.XDepthMaxKinect, DepthMetaData.YDepthMaxKinect);

            WriteableBitmapUtils.SaveImage(pathModels, "Depth", depthBitmap, true);
        }
예제 #13
0
 private void SHowInterpolatedFrame()
 {
     this.imageEntropy.Source = WriteableBitmapUtils.FromByteArray_ToGray(DepthMetaData.Pixels, DepthMetaData.XDepthMaxKinect, DepthMetaData.YDepthMaxKinect);
 }