private void sessionOfflineModeGlyphDetectToolStripMenuItem_Click(object sender, EventArgs e) { IObjectRecogAlgo objectRecognizer = new GlyphBoxObjectRecognition(null, options.prototypeList, 5); var objectRecognizerIncluded = new Dictionary<IObjectRecogAlgo, bool>(); objectRecognizerIncluded[objectRecognizer] = true; if (mappingReader == null) { mappingReader = new DepthCoordinateMappingReader("coordinateMapping.dat"); } Task t = Task.Run(async () => { List<Object> detectedObjects = await Utils.DetectObjects("Progress on " + currentSession.sessionName, currentSession.getVideo(0), currentSession.getDepth(0), new List<IObjectRecogAlgo> { objectRecognizer }, objectRecognizerIncluded, (depthImage, result) => mappingReader.projectDepthImageToCameraSpacePoint(depthImage, currentSession.getDepth(0).depthWidth, currentSession.getDepth(0).depthHeight, currentSession.getVideo(0).frameWidth, currentSession.getVideo(0).frameHeight, result) ); // Run on UI thread this.Invoke((MethodInvoker)delegate { AddDetectedObjects(detectedObjects); }); }); }
private void projectOnlineModeGlyphDetectToolStripMenuItem_Click(object sender, EventArgs e) { IObjectRecogAlgo objectRecognizer = new GlyphBoxObjectRecognition(null, options.prototypeList, 5); var objectRecognizerIncluded = new Dictionary<IObjectRecogAlgo, bool>(); objectRecognizerIncluded[objectRecognizer] = true; setupKinectIfNeeded(); Task t = Task.Run(async () => { try { if (currentlySetupKinect) { Console.WriteLine("Await"); isAvailable.Wait(); currentlySetupKinect = false; } foreach (var session in currentProject.sessions) { currentSession = session; currentSession.loadIfNotLoaded(); List<Object> detectedObjects = await Utils.DetectObjects("Progress on " + currentSession.sessionName, currentSession.getVideo(0), currentSession.getDepth(0), new List<IObjectRecogAlgo> { objectRecognizer }, objectRecognizerIncluded, coordinateMapper.MapColorFrameToCameraSpace ); AddObjectsIntoSession(detectedObjects); currentSession.saveSession(); } } catch (Exception exc) { Console.WriteLine(exc); } }); }
private void sessionOnlineModeGlyphDetectToolStripMenuItem_Click(object sender, EventArgs e) { IObjectRecogAlgo objectRecognizer = new GlyphBoxObjectRecognition(null, options.prototypeList, 5); var objectRecognizerIncluded = new Dictionary<IObjectRecogAlgo, bool>(); objectRecognizerIncluded[objectRecognizer] = true; setupKinectIfNeeded(); Task t = Task.Run(async () => { if (currentlySetupKinect) { Console.WriteLine("Await"); isAvailable.Wait(); currentlySetupKinect = false; } List<Object> detectedObjects = await Utils.DetectObjects("Progress on " + currentSession.sessionName, currentSession.getVideo(0), currentSession.getDepth(0), new List<IObjectRecogAlgo> { objectRecognizer }, objectRecognizerIncluded, coordinateMapper.MapColorFrameToCameraSpace ); // Run on UI thread this.Invoke((MethodInvoker)delegate { AddDetectedObjects(detectedObjects); }); }); }