none
save item in sequences without deleting the previous one RRS feed

  • Question

  • Hi ,


      private void Mesh_Click(object sender, RoutedEventArgs e)
            {

             
                int count = 1;
                while (count <= 8)
                {

                   var cursor = this.Cursor;

                  this.Cursor = Cursors.Wait; 

                _depthImage.ToMesh(nui, (int)Depths.Value).Save(@"C:\pcd\Mesh" + count + ".ply");

                    this.Cursor = cursor;

                }
                    count = count + 1;
                
             
            }

           }

    From the code , when i click the meshclick button , it will save the mesh in .ply form at the destination that i assigned where is the C drive and inside pcd folder with the name Mesh.ply  . Now i need to save the mesh in sequences when the button being clicked for second time and the result should be Mesh1.ply    and when i click again the name should be Mesh2.ply  . In summary , it would'nt delete the previous one when i click the meshclick button again. But when click for first time the application will jam and not responding , is it not suitable to do a loop for mesh?

    Thanks.




    Thursday, May 10, 2012 4:51 AM

All replies

  • I don't know that this applies to the Kinect SDK. What API is providing the .ToMesh function?

    Thursday, May 10, 2012 10:02 PM
  • Use a method to get the date and time and add that to your file name.

    for example: 

     BitmapSource image = BitmapSource.Create(colorFrame.Width, colorFrame.Height, 96, 96, PixelFormats.Bgr32, null, pixels, stride);
    
    
    string fileName = string.Format("kinect-{0:yyyy-MM-dd_hh-mm-ss-fff-tt}.jpg", DateTime.Now);
    
    fileName = @"C:\Users\Brendan\Desktop\KinectPhotos\" + fileName;
    
    FileStream stream = new FileStream(fileName, FileMode.Create);

    Friday, June 8, 2012 2:27 PM