public static CalibrationCorners FindChessboardCorners(StereoImage <Bgr, byte> stereoImage, Size patternSize) { var grayStereoImage = stereoImage.Convert <Gray, byte>(); var leftCorners = FindChessboardCorners(grayStereoImage.LeftImage, patternSize); var rightCorners = FindChessboardCorners(grayStereoImage.RightImage, patternSize); if (leftCorners != null && rightCorners != null) { return(new CalibrationCorners(leftCorners, rightCorners)); } return(null); }
public static StereoImage <Bgr, byte> DrawChessboardCorners(StereoImage <Bgr, byte> stereoImage, CalibrationCorners corners) { var colors = new Bgr[corners.LeftCorners.Length]; var random = new Random(); for (var i = 0; i < colors.Length; ++i) { colors[i] = new Bgr(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)); } DrawChessboardCorners(stereoImage.LeftImage, corners.LeftCorners, colors); DrawChessboardCorners(stereoImage.RightImage, corners.RightCorners, colors); return(stereoImage); }
public static void RemapStereoImage(StereoImage <Bgr, byte> image, CalibrationStereoResult calibrationStereoResult) { Matrix <float> mapX; Matrix <float> mapY; InitUndistortRectifyMap( calibrationStereoResult.Camera1Result, calibrationStereoResult.Settings.ImageSize, out mapX, out mapY); image.LeftImage = Remap(image.LeftImage, mapX, mapY); InitUndistortRectifyMap( calibrationStereoResult.Camera2Result, calibrationStereoResult.Settings.ImageSize, out mapX, out mapY); image.RightImage = Remap(image.RightImage, mapX, mapY); }
public StereoImageFileInfo(StereoImage <Bgr, byte> image) { Name = image.Name; LeftImagePath = string.Format("left_{0}.png", Name); RightImagePath = string.Format("right_{0}.png", Name); }