private void update() { // load calibration data stereointerface.loadCalibration(calibration_filename); // get image data from bitmaps int bytes_per_pixel = 3; // load images into the correspondence object stereointerface.loadImage(fullres_left, image_width, image_height, true, bytes_per_pixel); stereointerface.loadImage(fullres_right, image_width, image_height, false, bytes_per_pixel); // set the quality of the disparity map stereointerface.setDisparityMapCompression(horizontal_compression, vertical_compression); clock.Start(); // perform stereo matching stereointerface.stereoMatchRun(0, 8, correspondence_algorithm_type); long correspondence_time_mS = clock.Stop(); txtStereoCorrespondenceTime.Buffer.Text = correspondence_time_mS.ToString(); // make a bitmap byte[] depthmap = new byte[image_width * image_height * 3]; stereointerface.getDisparityMap(depthmap, image_width, image_height, 0); picDepthMap.Pixbuf = GtkBitmap.createPixbuf(image_width, image_height); GtkBitmap.setBitmap(depthmap, picDepthMap); }
private bool LoadStereoImages() { bool success = false; string left_image_filename = images_directory + "/test_left_" + stereo_image_index.ToString() + ".jpg"; string right_image_filename = images_directory + "/test_right_" + stereo_image_index.ToString() + ".jpg"; if (System.IO.File.Exists(left_image_filename)) { if (System.IO.File.Exists(right_image_filename)) { fullres_left = GtkBitmap.Load(left_image_filename, ref image_width, ref image_height); picLeftImage.Pixbuf = GtkBitmap.createPixbuf(image_width, image_height); GtkBitmap.setBitmap(fullres_left, picLeftImage); fullres_right = GtkBitmap.Load(right_image_filename, ref image_width, ref image_height); picRightImage.Pixbuf = GtkBitmap.createPixbuf(image_width, image_height); GtkBitmap.setBitmap(fullres_right, picRightImage); success = true; } else { //MessageBox.Show("Could not find image " + right_image_filename); } } else { //MessageBox.Show("Could not find image " + left_image_filename); } return(success); }
/// <summary> /// perform a test /// </summary> /// <param name="test_index">index number of the test to be performed</param> private void PerformTest(int test_index) { // initialise init(); switch (test_index) { case 0: // motion model { test_motion_model(true); break; } case 1: // stereo ray models { bool mirror = false; stereo_model.showProbabilities(grid_layer, grid_dimension, img_rays, standard_width, standard_height, false, true, mirror); break; } case 2: // gaussian distribution function { stereo_model.showDistribution(img_rays, standard_width, standard_height); break; } case 3: // a single stereo ray model { createSingleRayModel(false); break; } case 4: // sensor model lookups { createSensorModelLookup(); break; } case 5: // path planner { test_path_planner(200, 50); break; } } // make a larger image byte[] img_large = image.downSample(img_rays, standard_width, standard_height, standard_width * 2, standard_height * 2); // display the results imgOutput.Pixbuf = GtkBitmap.createPixbuf(standard_width * 2, standard_height * 2); GtkBitmap.setBitmap(img_large, imgOutput); }
/// <summary> /// initialise variables prior to performing test routines /// </summary> private void init() { grid_layer = new float[grid_dimension, grid_dimension, 3]; pos3D_x = new float[4]; pos3D_y = new float[4]; stereo_model = new stereoModel(); robot_head = new stereoHead(4); stereo_features = new float[900]; stereo_uncertainties = new float[900]; img_rays = new byte[standard_width * standard_height * 3]; imgOutput.Pixbuf = GtkBitmap.createPixbuf(standard_width, standard_height); GtkBitmap.setBitmap(img_rays, imgOutput); }