public StereoVisionEdges() { algorithm_type = EDGES; camera = new StereoVisionEdgesCam[2]; for (int cam = 0; cam < 2; cam++) { camera[cam] = new StereoVisionEdgesCam(); camera[cam].init(320, 240); } }
/// <summary> /// update stereo correspondence /// </summary> /// <param name="left_bmp_colour">rectified left image data</param> /// <param name="right_bmp_colour">rectified right_image_data</param> /// <param name="left_bmp">rectified left image data</param> /// <param name="right_bmp">rectified right_image_data</param> /// <param name="image_width">width of the image</param> /// <param name="image_height">height of the image</param> /// <param name="calibration_offset_x">offset calculated during camera calibration</param> /// <param name="calibration_offset_y">offset calculated during camera calibration</param> public override void Update( byte[] left_bmp_colour, byte[] right_bmp_colour, byte[] left_bmp, byte[] right_bmp, int image_width, int image_height, float calibration_offset_x, float calibration_offset_y) { byte[] rectified_frame_buf; StereoVisionEdgesCam stereocam = null; int calib_offset_x = (int)calibration_offset_x; int calib_offset_y = (int)calibration_offset_y; for (int cam = 1; cam >= 0; cam--) { int no_of_feats = 0; int no_of_feats_horizontal = 0; if (cam == 0) { rectified_frame_buf = left_bmp_colour; stereocam = camera[0]; } else { rectified_frame_buf = right_bmp_colour; stereocam = camera[1]; } stereocam.imgWidth = (uint)image_width; stereocam.imgHeight = (uint)image_height; no_of_feats = stereocam.svs_get_features_vertical( rectified_frame_buf, inhibition_radius, minimum_response, calib_offset_x, calib_offset_y); if (cam == 0) { no_of_feats_horizontal = stereocam.svs_get_features_horizontal( rectified_frame_buf, inhibition_radius, minimum_response, calib_offset_x, calib_offset_y); } calib_offset_x = 0; calib_offset_y = 0; } int matches = camera[0].svs_match( camera[1], ideal_no_of_matches, max_disparity_percent, learnDesc, learnLuma, learnDisp, learnPrior, use_priors); features.Clear(); for (int i = 0; i < matches; i++) { features.Add(new StereoFeature( (float)(camera[0].svs_matches[i * 4 + 1]), (float)(camera[0].svs_matches[i * 4 + 2]), (float)(camera[0].svs_matches[i * 4 + 3]))); } }