private void generateResultList() { //string format_string_images = "{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12}"; string format_string_images = "{0},{1},{2},{3},{4},{5},{6}"; //string path = Path.Combine(workingDir, sceneName + "_project", "undistorted"); string path = Path.Combine(@"D:\testGroundVU", "xmp"); string resultListFilePath = Path.Combine(ImgDir, sceneName + "List.csv"); string[] filePaths = Directory.GetFiles(path, "*.xmp"); CSVFile csv = new CSVFile(); csv.BuildFile(resultListFilePath, "ImageName,X,Y,Z,Yaw,Pitch,Roll"); for (int i = 0; i < filePaths.Length; i++) { /*XMPFile xmp = new XMPFile(); * xmp.LoadXML(filePaths[i]); * XMPGenerator xmpGen = new XMPGenerator(); * * * * * //string statement = Path.GetFileNameWithoutExtension(filePaths[2]) + " " + xmp.GetPosition() + " " + xmp.GetRotation(); * * string xmpPostions = xmp.GetPosition(); * string xmpRotations = xmp.GetRotation(); * * XMPGenerator.FRotator xmpYawPitchAndRoll = xmpGen.GroundVUYawPitchRow(xmpRotations); * * string[] Positions = xmpPostions.Split(' '); * string[] Rotations = xmpRotations.Split(' '); * * * //string statement = string.Format(format_string_images, Path.GetFileNameWithoutExtension(filePaths[i]), Positions[0], Positions[1], Positions[2], Rotations[0], Rotations[1], Rotations[2], Rotations[3], Rotations[4], Rotations[5], Rotations[6], Rotations[7], Rotations[8]); * string statement = string.Format(format_string_images, Path.GetFileNameWithoutExtension(filePaths[i]), Positions[0], Positions[1], Positions[2], xmpYawPitchAndRoll.Roll, xmpYawPitchAndRoll.Pitch, xmpYawPitchAndRoll.Yaw); * * csv.AddLineWithoutIdx(statement);*/ makeCSVFromXmpWithCertainFormat(filePaths[i], format_string_images, csv); Program.AddLog(filePaths[i]); } csv.Save(); }
public void BuildRoadInfoFromImageList(ImageList imgListFile, string[] keywords, string src_filename) { csv_file = new CSVFile(); csv_file.BuildFile(src_filename, head_string); foreach (var node in imgListFile.image_nodes) { if (node.keyword.Contains(keywords[0])) { if (keywords.Length == 4) { string newStr = string.Format(format_string_images, node.values[0], node.values[1], node.values[2], node.values[3]); csv_file.AddLine(newStr); } else { string newStr = FormatLineData(node.values[0], node.values[1], node.values[2], node.values[3]); csv_file.AddLine(newStr); } } } csv_file.Save(); }