public double Getthedistance() { double[] fittedvalue = new double[2000]; ydata = Fitter.Datapoints; Fitter.Position = Getthearray.CreateArray(0, ydata.GetLength(0)); xdata = Fitter.Position; fittedvalue = Fitter.Fittedvalues(); xdata = Getthearray.CreateArray(0, fittedvalue.GetLength(0)); window.addextradata(xdata, fittedvalue); double c1 = Fitter.center(); Fitter.datamassage(); fittedvalue = Fitter.Fittedvalues(); window.addmoredata(xdata, fittedvalue); double c2 = Fitter.center(); double tempdistance = c1 - c2; if (tempdistance < 0) { tempdistance = tempdistance * -1; } string text = tempdistance.ToString(); string path = @"C:\Users\Andy\Desktop\Report.txt"; // This text is added only once to the file. if (!File.Exists(path)) { // Create a file to write to. string[] createText = { "Width" }; File.WriteAllLines(path, createText, Encoding.UTF8); } // This text is always added, making the file longer over time // if it is not deleted. string appendText = text + Environment.NewLine; File.AppendAllText(path, appendText, Encoding.UTF8); // Open the file to read from. // string[] readText = File.ReadAllLines(path, Encoding.UTF8); //foreach (string s in readText) //{ // Console.WriteLine(s); // } return(tempdistance); }
public void CameraSnapshot() { try { byte[,] imageData = ImageController.SingleSnapshot(cameraAttributesPath); Fitter.Datapoints = Getthearray.convertTO1D(imageData); Fitter.Datapoints = Getthearray.smooth(Fitter.Datapoints); // SaveImageWithDialog(); } catch (Exception e) { MessageBox.Show(e.Message); } }
public void displyData() { ydata = Fitter.Datapoints; Fitter.Position = Getthearray.CreateArray(0, ydata.GetLength(0)); xdata = Fitter.Position; window.addDataToGraph(xdata, ydata); }