public CalibPointToPoint(int count) : this() { for (int i = 0; i < count; i++) { CalibrateData.Add(new CalibDataPoint()); } }
public void ClearCalibrationData() { CalibrateData.Clear(); PixelToWorld = new HHomMat2D(); WorldToPixel = new HHomMat2D(); IsBuiltted = false; OnChangeCalibrateData(); }
public void RemoveAtCalibrationPoint(int index) { if (index < 0 || index >= CalibrateData.Count) { return; } CalibrateData.RemoveAt(index); IsBuiltted = false; OnChangeCalibrateData(); }
public void AddCalibratePoint(double pixelRow, double pixelCol, double x, double y) { CalibDataPoint point = new CalibDataPoint(); point.PixelRow = pixelRow; point.PixelCol = pixelCol; point.X = x; point.Y = y; CalibrateData.Add(point); IsBuiltted = false; OnChangeCalibrateData(); }
public void TestCalibrateDataSerialize() { CalibrateData a = new CalibrateData(); XmlSerializer.Save(@"d:/a.xml", a); XmlSerializer.Load(@"d:/a.xml", out a); CalibrateData b = new CalibrateData(); b.OutputValue = 100; XmlSerializer.Save(@"d:/b.xml", b); XmlSerializer.Load(@"d:/b.xml", out b); }
void IXmlSerializable.WriteXml(XmlWriter writer) { XmlSerializerNamespaces _namespaces = new XmlSerializerNamespaces(new XmlQualifiedName[] { new XmlQualifiedName(/*string.Empty*/) }); XmlSerializer xml = new XmlSerializer(CalibrateData.GetType()); writer.WriteStartElement("CalibrateData"); xml.Serialize(writer, CalibrateData, _namespaces); writer.WriteEndElement(); var temp = PixelToWorld.RawData.ToDArr(); xml = new XmlSerializer(temp.GetType()); writer.WriteStartElement("PixelToWorld"); xml.Serialize(writer, temp, _namespaces); writer.WriteEndElement(); temp = WorldToPixel.RawData.ToDArr(); xml = new XmlSerializer(temp.GetType()); writer.WriteStartElement("WorldToPixel"); xml.Serialize(writer, temp, _namespaces); writer.WriteEndElement(); }
void IXmlSerializable.ReadXml(XmlReader reader) { bool wasEmpty = reader.IsEmptyElement; reader.Read(); if (wasEmpty) { return; } while (reader.NodeType != XmlNodeType.EndElement) { XmlSerializer typeSer = new XmlSerializer(CalibrateData.GetType()); reader.ReadStartElement("CalibrateData"); CalibrateData = typeSer.Deserialize(reader) as List <CalibDataPoint>; reader.ReadEndElement(); typeSer = new XmlSerializer(typeof(double[])); reader.ReadStartElement("PixelToWorld"); double[] temp = typeSer.Deserialize(reader) as double[]; reader.ReadEndElement(); PixelToWorld = new HHomMat2D(new HTuple(temp)); typeSer = new XmlSerializer(typeof(double[])); reader.ReadStartElement("WorldToPixel"); temp = typeSer.Deserialize(reader) as double[]; reader.ReadEndElement(); WorldToPixel = new HHomMat2D(new HTuple(temp)); reader.MoveToContent(); } reader.ReadEndElement(); IsBuiltted = CalibrateData.Count > 2; }