1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| Camera.IntrinsicsCalibriton(_calibrationAgorithm.DotLeftTop, _calibrationAgorithm.DotRightTop, _calibrationAgorithm.DotLeftBottom, _calibrationAgorithm.DotRightBottom, _calibrationAgorithm.DotHorLength, _calibrationAgorithm.DotVerLength, _calibrationAgorithm.DotDistance);
public void IntrinsicsCalibriton(PointF LeftTop, PointF RightTop, PointF LeftBottom, PointF RightBottom, double LengthHor, double LengthVer, double Distance) { double L1 = Math.Sqrt((RightTop.X - LeftTop.X) * (RightTop.X - LeftTop.X) + (RightTop.Y - LeftTop.Y) * (RightTop.Y - LeftTop.Y)); double L2 = Math.Sqrt((LeftBottom.X - LeftTop.X) * (LeftBottom.X - LeftTop.X) + (LeftBottom.Y - LeftTop.Y) * (LeftBottom.Y - LeftTop.Y)); double L3 = Math.Sqrt((RightBottom.X - LeftBottom.X) * (RightBottom.X - LeftBottom.X) + (RightBottom.Y - LeftBottom.Y) * (RightBottom.Y - LeftBottom.Y)); double L4 = Math.Sqrt((RightBottom.X - RightTop.X) * (RightBottom.X - RightTop.X) + (RightBottom.Y - RightTop.Y) * (RightBottom.Y - RightTop.Y));
double diffPixelX = (L1 + L3) / 2; double diffPixelY = (L2 + L4) / 2;
if ((diffPixelX == 0) || (diffPixelY == 0)) throw new ArgumentOutOfRangeException("boardParam.RightTop , boardParam.LeftTop , boardParam.RightBottom , boardParam.LeftBottom");
double fx = (Distance * diffPixelX * PixelSize) / (LengthHor + diffPixelX * PixelSize); double fy = (Distance * diffPixelY * PixelSize) / (LengthVer + diffPixelY * PixelSize); Intrinsics_f = fx / 2 + fy / 2; Intrinsics_Fx = (fx / PixelSize).Round(4); Intrinsics_Fy = (fy / PixelSize).Round(4); Intrinsics_Cx = PixelWidth / 2; Intrinsics_Cy = PixelHeight / 2; }
|