/** * @brief Event handler. Called by button7 for click events. * @param sender An object - Source of the event * @param e An EventArgs - Event Information */ private void button7_Click(object sender, EventArgs e) { SphereRecognition sr = new SphereRecognition(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { sr = new SphereRecognition(); hm = new HeightMap(RangeImage.Read(openFileDialog1.FileName)); hm.createMap(); heightMap = hm.bool_grid; detectedSpheres = sr.FindSpheres(RangeImage.Read(openFileDialog1.FileName), null, 35, 7, 0.2f, 70f); spherePositions.Clear(); sphereRadii.Clear(); detectedDrones.Clear(); prepareSpheres(); findDrones(); } }
/** * @brief Process the range image. */ public void processRangeImage() { //Are these two line crashing the program because we are trying to do the detection after each scan? //SphereRecognition sr = new SphereRecognition(); //detectedSpheres = sr.FindSpheres(m_Robot.LatestRangeImage, null, 35, 7, 0.2f, 65f); SphereRecognition2 sr = new SphereRecognition2(); detectedSpheres = sr.FindSpheres(m_Robot.LatestRangeImage); hm = new HeightMap(m_Robot.LatestRangeImage); hm.createMap(); heightMap = hm.bool_grid; UpdateMap(); MapCanvas.Invalidate(); if (m_RangeImageViewer != null) { if (m_Robot.LatestRangeImage.Height > 2) m_RangeImageViewer.RangeImage = m_Robot.LatestRangeImage; } spherePositions.Clear(); sphereRadii.Clear(); detectedDrones.Clear(); prepareSpheres(); findDrones(); }