Example #1
0
        /// <summary>
        /// Process all the batch data in one session.
        /// </summary>
        /// <param name="inputSessionFolder"></param>
        /// <param name="outputSessionFolder"></param>
        private static void ProcessBatches(String inputSessionFolder, String outputSessionFolder)
        {
            Log.DebugFormat("Process session {0}:", inputSessionFolder);

            var inputPattern = KinectPattern;
            var regex        = KinectRegex;

            if (type.Equals("gt"))
            {
                inputPattern = String.Format(GTPattern, gtSensor);
                regex        = String.Format(GTRegex, gtSensor);
            }

            String[] filePaths = Directory.GetFiles(inputSessionFolder, inputPattern);

            foreach (var inFile in filePaths)
            {
                var fileInfo = new FileInfo(inFile);
                var name     = fileInfo.Name;

                var match = Regex.Match(name, regex);
                if (match.Success)
                {
                    int batchNum = Int32.Parse(match.Groups[1].Value);
                    if (batchList.Contains(batchNum))
                    {
                        if (type.Equals("gt"))
                        {
                            var outputFile = Path.Combine(outputSessionFolder, name);
                            File.Copy(inFile, outputFile, true);
                        }
                        else
                        {
                            var outFile = Path.Combine(outputSessionFolder, Path.ChangeExtension(name, Ext));

                            if (File.Exists(outFile) && keep)
                            {
                                continue;
                            }

                            OfflineProcessor proc = new OfflineProcessor(inFile, outFile, readLock, writeLock,
                                                                         replayerType, handTrackerType, featureProcessorType, sampleRate, gtSensor,
                                                                         bufferSize);
                            try {
                                if (useParallel)
                                {
                                    pp.Spawn(proc.Process);
                                }
                                else
                                {
                                    proc.Process();
                                }
                            } catch (Exception ex) {
                                Log.Error(ex.Message);
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Process all the batch data in one session.
        /// </summary>
        /// <param name="inputSessionFolder"></param>
        /// <param name="outputSessionFolder"></param>
        private static void ProcessBatches(String inputSessionFolder, String outputSessionFolder)
        {
            Log.DebugFormat("Process session {0}:", inputSessionFolder);

              var inputPattern = KinectPattern;
              var regex = KinectRegex;
              if (type.Equals("gt")) {
            inputPattern = String.Format(GTPattern, gtSensor);
            regex = String.Format(GTRegex, gtSensor);
              }

              String[] filePaths = Directory.GetFiles(inputSessionFolder, inputPattern);

              foreach (var inFile in filePaths) {
            var fileInfo = new FileInfo(inFile);
            var name = fileInfo.Name;

            var match = Regex.Match(name, regex);
            if (match.Success) {
              int batchNum = Int32.Parse(match.Groups[1].Value);
              if (batchList.Contains(batchNum)) {
            if (type.Equals("gt")) {
              var outputFile = Path.Combine(outputSessionFolder, name);
              File.Copy(inFile, outputFile, true);
            } else {
              var outFile = Path.Combine(outputSessionFolder, Path.ChangeExtension(name, Ext));

              if (File.Exists(outFile) && keep)
                continue;

              OfflineProcessor proc = new OfflineProcessor(inFile, outFile, readLock, writeLock,
                  replayerType, handTrackerType, featureProcessorType, sampleRate, gtSensor,
                  bufferSize);
              try {
                if (useParallel)
                  pp.Spawn(proc.Process);
                else
                  proc.Process();
              } catch (Exception ex) {
                Log.Error(ex.Message);
              }
            }
              }
            }
              }
        }