/// <summary> /// /// </summary> /// <param name="list"></param> /// <returns></returns> private PointsCoordSet CalcKalmanOpt(PointsCoordSet list, string strName, Kalc3Dim KallFil, bool iIsPredict, bool bNoA, bool bIsX) { var listKalman = new PointsCoordSet(strName); var Num = list[0].NumFrame - 1; for (var jc = 0; jc < list.Count; jc++) { var pt = new Point(list[jc].X, list[jc].Y); var ptC = list[jc] + pt; ptC.col = Color.Fuchsia; if (list[jc].X == -1) { ptC.col = Color.Yellow; } if (bIsX == true) { var x = KallFil.SetData(list[jc].X, list[jc].NumFrame, iIsPredict, bNoA); ptC.X = (int)x; } else { var y = KallFil.SetData(list[jc].Y, list[jc].NumFrame, iIsPredict, bNoA); ptC.Y = (int)y; } listKalman.Add(ptC); } //PointsCoordSet.AddList(listKalman); return(listKalman); }
/// <summary> /// Работаем со скоростью /// </summary> /// <param name="list"></param> /// <returns></returns> private void CalcKalmanV(List <PointCoords> list, string strName, bool iIsPredict, bool bNoA) { var listKalman = new PointsCoordSet(strName); if (list.Count <= 0) { return; } var KallFilX = new Kalc3Dim("X", true); var KallFilY = new Kalc3Dim("Y", false); var Num = list[0].NumFrame - 1; for (var jc = 0; jc < list.Count; jc++) { var pt = new Point(list[jc].X, list[jc].Y); var ptC = list[jc] + pt; ptC.col = Color.Fuchsia; if (list[jc].X == -1) { ptC.col = Color.Yellow; } var x = KallFilX.SetData(list[jc].X, list[jc].NumFrame, iIsPredict, bNoA); var y = KallFilY.SetData(list[jc].Y, list[jc].NumFrame, iIsPredict, bNoA); ptC.X = (int)x; ptC.Y = (int)y; //PointCoords ptC = KallFil.CalcEstimationPoint(pt, list[jc].NumFrame) + list[jc]; listKalman.Add(ptC); } PointsCoordSet.AddList(listKalman); }
private void optimToolStripMenuItem_Click(object sender, EventArgs e) { var fKM = new FormKalmanParms(); if (fKM.ShowDialog() != DialogResult.OK) { return; } var iBeg = fKM.dBeg; var iFin = fKM.dFin; var iStep = fKM.dStep; var iNums = (int)((iFin - iBeg) / iStep) + 1; var M1X = new double[iNums]; var SD1X = new double[iNums]; var i = 0; string sLog; sLog = "X: " + listSourcePC[0].NumFrame.ToString() + "-" + listSourcePC[listSourcePC.Count - 1].NumFrame.ToString(); LogFile.WriteLog(sLog); sLog = "Predict()"; LogFile.WriteLog(sLog); int MMax; for (var jc = iBeg; jc < iFin; jc += iStep) { var KallFilX = new Kalc3Dim("X", true); //KallFilX.SetInitParmsQ(jc); //KallFilX.SetInitParmsR(jc); KallFilX.SetInitParmsQ(jc); //private PointsCoordSet CalcKalmanOpt(PointsCoordSet list, string strName,Kalc3Dim KallFil, bool iIsPredict, bool bNoA) var listKalmanTemp = CalcKalmanOpt(listSourcePC, sLog, KallFilX, true, false, true); // PointsCoordSet listKalmanTemp = CalcKalmanOpt(listSourcePC, sLog, KallFilX, false, false); var iE1X = CalcCompareParams(listMarkedPC, listKalmanTemp, true, out M1X[i], out SD1X[i], out MMax); sLog = "Q[i,i] =" + jc.ToString() + " MX = " + M1X[i].ToString() + " SDX = " + SD1X[i].ToString() + " Max=" + MMax.ToString(); /*sLog = "Q[i,i] =" + jc.ToString() + " MX = " + M1X[i].ToString() + " SDX = " + SD1X[i].ToString();*/ //sLog = "" + jc.ToString() + " " + M1X[i].ToString() + " " + SD1X[i].ToString(); //sLog = "" + SD1X[i.ToString(); i++; LogFile.WriteLog(sLog); } }
private int FindOptim(bool bIsX) { var fKM = new FormKalmanParms(); if (fKM.ShowDialog() != DialogResult.OK) { return(-1); } var iBeg = fKM.dBeg; var iFin = fKM.dFin; var iStep = fKM.dStep; var iNums = (int)((iFin - iBeg) / iStep) + 1; double M1Min = 10000; double SD1Min = 10000; var NMaxMin = 10000; var iOpt = 0; var i = 0; var sLog = "Predict()"; LogFile.WriteLog(sLog); double M1; double SD1; int NMax; //List <int> lInt = new List<int>(); for (var jc = iBeg; jc < iFin; jc += iStep) { Kalc3Dim KallFil; if (bIsX == true) { KallFil = new Kalc3Dim("X", true); } else { KallFil = new Kalc3Dim("Y", false); } //KallFilX.SetInitParmsQ(jc); //KallFilX.SetInitParmsR(jc); KallFil.SetInitParmsQ(jc); //private PointsCoordSet CalcKalmanOpt(PointsCoordSet list, string strName,Kalc3Dim KallFil, bool iIsPredict, bool bNoA) var listKalmanTemp = CalcKalmanOpt(listSourcePC, sLog, KallFil, true, false, bIsX); // PointsCoordSet listKalmanTemp = CalcKalmanOpt(listSourcePC, sLog, KallFilX, false, false); var iE1 = CalcCompareParams(listMarkedPC, listKalmanTemp, true, out M1, out SD1, out NMax); i++; if (NMax > NMaxMin) { continue; } if (NMax == NMaxMin) { if (M1 > M1Min) { continue; } if (M1 == M1Min) { if (SD1 >= SD1Min) { continue; } } iOpt = i - 1; } //string sLog1 = "Q[i,i] =" + jc.ToString() + " MX = " + M1X[i].ToString() + " SDX = " + SD1X[i].ToString() + " Max=" + MMax.ToString(); //LogFile.WriteLog(sLog1); } return(iOpt); }