add loading of sample Point Clouds
The files are from ETH-Apartment Dataset
This commit is contained in:
@@ -12,7 +12,7 @@ namespace PointCloudWeb.Server.ScanConverter
|
|||||||
{
|
{
|
||||||
private static void Main()
|
private static void Main()
|
||||||
{
|
{
|
||||||
var scanPoints = File.ReadAllLines("C:/Users/timwu/Desktop/Scans/0yGrad-scan-org.csv")
|
var scanPoints = File.ReadAllLines("C:/Users/timwu/Desktop/Scans/Esszimmer-scan.csv")
|
||||||
.Select(v => ScanDataPointFromCsv(v))
|
.Select(v => ScanDataPointFromCsv(v))
|
||||||
.Where(scan => scan.DistanceMM > 0)
|
.Where(scan => scan.DistanceMM > 0)
|
||||||
.ToList();
|
.ToList();
|
||||||
@@ -29,7 +29,7 @@ namespace PointCloudWeb.Server.ScanConverter
|
|||||||
|
|
||||||
var csv = "x,y,z\n" + string.Join("\n", result.Select(point => point.X + ", " + point.Y + ", " + point.Z).ToArray());
|
var csv = "x,y,z\n" + string.Join("\n", result.Select(point => point.X + ", " + point.Y + ", " + point.Z).ToArray());
|
||||||
|
|
||||||
File.WriteAllText("C:\\Users\\timwu\\Desktop\\Scans\\0yGrad-pc-org.csv", csv);
|
File.WriteAllText("C:\\Users\\timwu\\Desktop\\Scans\\Esszimmer-pc.csv", csv);
|
||||||
|
|
||||||
Console.WriteLine("Convert finished");
|
Console.WriteLine("Convert finished");
|
||||||
// Console.ReadLine();
|
// Console.ReadLine();
|
||||||
@@ -44,11 +44,8 @@ namespace PointCloudWeb.Server.ScanConverter
|
|||||||
distanceMM: (int)Convert.ToDouble(values[2], CultureInfo.InvariantCulture)
|
distanceMM: (int)Convert.ToDouble(values[2], CultureInfo.InvariantCulture)
|
||||||
);
|
);
|
||||||
|
|
||||||
//scan.RAX += 90;
|
//scan.RAX = (scan.RAX + 90) % 360;
|
||||||
// scan.RAY += 90;
|
//scan.RAY = (scan.RAY + 90) % 360;
|
||||||
|
|
||||||
//scan.RAX %= 360;
|
|
||||||
// scan.RAY %= 360;
|
|
||||||
|
|
||||||
return scan;
|
return scan;
|
||||||
if (scan.RAX == 1) return scan;
|
if (scan.RAX == 1) return scan;
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/SweaWarningsMode/@EntryValue">ShowAndRun</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/SweaWarningsMode/@EntryValue">ShowAndRun</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/PencilsConfiguration/ActualSeverity/@EntryValue">INFO</s:String>
|
<s:String x:Key="/Default/CodeInspection/PencilsConfiguration/ActualSeverity/@EntryValue">INFO</s:String>
|
||||||
<s:Boolean x:Key="/Default/Environment/InlayHints/GeneralInlayHintsOptions/EnableInlayHints/@EntryValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/Environment/InlayHints/GeneralInlayHintsOptions/EnableInlayHints/@EntryValue">True</s:Boolean>
|
||||||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=5420edfd_002D53ed_002D4360_002D91dc_002D622a0704440e/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from &lt;PointCloudWeb.Server.Tests&gt; #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=5420edfd_002D53ed_002D4360_002D91dc_002D622a0704440e/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" Name="All tests from &lt;PointCloudWeb.Server.Tests&gt; #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||||
<Project Location="C:\Users\timwu\source\repos\PointCloudWeb\PointCloudWeb.Server\PointCloudWeb.Server.Tests" Presentation="&lt;PointCloudWeb.Server.Tests&gt;" />
|
<Project Location="C:\Users\timwu\source\repos\PointCloudWeb\PointCloudWeb.Server\PointCloudWeb.Server.Tests" Presentation="&lt;PointCloudWeb.Server.Tests&gt;" />
|
||||||
</SessionState></s:String>
|
</SessionState></s:String>
|
||||||
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=6e4a2479_002Dacc5_002D40ad_002Dab6f_002Dff921657a24c/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" Name="All tests from &lt;PointCloudWeb.Server.Tests&gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=6e4a2479_002Dacc5_002D40ad_002Dab6f_002Dff921657a24c/@EntryIndexedValue"><SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from &lt;PointCloudWeb.Server.Tests&gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session">
|
||||||
<Project Location="C:\Users\timwu\source\repos\PointCloudWeb\PointCloudWeb.Server\PointCloudWeb.Server.Tests" Presentation="&lt;PointCloudWeb.Server.Tests&gt;" />
|
<Project Location="C:\Users\timwu\source\repos\PointCloudWeb\PointCloudWeb.Server\PointCloudWeb.Server.Tests" Presentation="&lt;PointCloudWeb.Server.Tests&gt;" />
|
||||||
</SessionState></s:String></wpf:ResourceDictionary>
|
</SessionState></s:String>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hokuyo/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Potree/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||||
370278
PointCloudWeb.Server/PointCloudWeb.Server/ETH-Data/Hokuyo_0.csv
Normal file
370278
PointCloudWeb.Server/PointCloudWeb.Server/ETH-Data/Hokuyo_0.csv
Normal file
File diff suppressed because it is too large
Load Diff
370261
PointCloudWeb.Server/PointCloudWeb.Server/ETH-Data/Hokuyo_1.csv
Normal file
370261
PointCloudWeb.Server/PointCloudWeb.Server/ETH-Data/Hokuyo_1.csv
Normal file
File diff suppressed because it is too large
Load Diff
12
PointCloudWeb.Server/PointCloudWeb.Server/Globals.cs
Normal file
12
PointCloudWeb.Server/PointCloudWeb.Server/Globals.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace PointCloudWeb.Server
|
||||||
|
{
|
||||||
|
public static class Globals
|
||||||
|
{
|
||||||
|
static Globals()
|
||||||
|
{
|
||||||
|
PotreeDataPath = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string PotreeDataPath { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,33 +1,64 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
using PointCloudWeb.Server.Models;
|
using PointCloudWeb.Server.Models;
|
||||||
|
|
||||||
namespace PointCloudWeb.Server.Services
|
namespace PointCloudWeb.Server.Services
|
||||||
{
|
{
|
||||||
public class PointCloudService
|
public class PointCloudService
|
||||||
{
|
{
|
||||||
//private readonly IPointCloudRegistationService pointCloudRegistation;
|
//private readonly IPointCloudRegistrationService pointCloudRegistration;
|
||||||
private readonly PointCloudCollection _pointClouds;
|
private readonly PointCloudCollection _pointClouds;
|
||||||
|
|
||||||
public PointCloudService(/*IPointCloudRegistationService pointCloudRegistation*/)
|
public PointCloudService(/*IPointCloudRegistrationService pointCloudRegistration*/)
|
||||||
{
|
{
|
||||||
_pointClouds = new PointCloudCollection();
|
_pointClouds = new PointCloudCollection();
|
||||||
//this.pointCloudRegistation = pointCloudRegistation;
|
//this.pointCloudRegistration = pointCloudRegistration;
|
||||||
InitSampleData();
|
InitSampleData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int TextToCoordinate(string text)
|
||||||
|
{
|
||||||
|
var dDecimal = Convert.ToDecimal(text, CultureInfo.InvariantCulture);
|
||||||
|
dDecimal *= 100_000_000; //convert decimal points to integer points
|
||||||
|
return (int)dDecimal;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void LoadPointCloudFromEthFile(PointCloud target, string path)
|
||||||
|
{
|
||||||
|
var lines = File.ReadLines(path );
|
||||||
|
foreach (var line in lines)
|
||||||
|
{
|
||||||
|
//skip header
|
||||||
|
if (line.Contains("x,y,z"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var values = line.Split(',');
|
||||||
|
|
||||||
|
var point = new Point(
|
||||||
|
TextToCoordinate(values[1]),
|
||||||
|
TextToCoordinate(values[2]),
|
||||||
|
TextToCoordinate(values[3])
|
||||||
|
);
|
||||||
|
target.Points.Add(point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConvertPointsToPotree()
|
||||||
|
{
|
||||||
|
var path = Globals.PotreeDataPath;
|
||||||
|
}
|
||||||
|
|
||||||
private void InitSampleData()
|
private void InitSampleData()
|
||||||
{
|
{
|
||||||
_pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 1"));
|
var pc = new PointCloud(Guid.NewGuid(), "Scan 1");
|
||||||
_pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 2"));
|
LoadPointCloudFromEthFile(pc, "ETH-Data/Hokuyo_0.csv");
|
||||||
_pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 3"));
|
_pointClouds.Add(pc);
|
||||||
_pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 4"));
|
|
||||||
_pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 5"));
|
pc = new PointCloud(Guid.NewGuid(), "Scan 2");
|
||||||
_pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 6"));
|
LoadPointCloudFromEthFile(pc, "ETH-Data/Hokuyo_1.csv");
|
||||||
_pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 7"));
|
_pointClouds.Add(pc);
|
||||||
_pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 8"));
|
|
||||||
_pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 9"));
|
|
||||||
_pointClouds.Add(new PointCloud(Guid.NewGuid(), "Scan 10"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RaiseIfNotExists(Guid id)
|
private void RaiseIfNotExists(Guid id)
|
||||||
@@ -65,7 +96,7 @@ namespace PointCloudWeb.Server.Services
|
|||||||
// if (_pointClouds.IndexOf(pointCloud) == 0)
|
// if (_pointClouds.IndexOf(pointCloud) == 0)
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
//var transformation = pointCloudRegistation.RegisterPointCloud(pointCloud, pointClouds[0]);
|
//var transformation = pointCloudRegistration.RegisterPointCloud(pointCloud, pointClouds[0]);
|
||||||
//pointCloud.Transformation = transformation;
|
//pointCloud.Transformation = transformation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,15 +11,15 @@ namespace PointCloudWeb.Server.Services
|
|||||||
// if (scan.RAX >= 90 || scan.RAY >= 90)
|
// if (scan.RAX >= 90 || scan.RAY >= 90)
|
||||||
// return new Point(0, 0, 0);
|
// return new Point(0, 0, 0);
|
||||||
|
|
||||||
var degreeXa = scan.RAX;
|
var degreeXa = (scan.RAX) % 360;
|
||||||
var degreeYa = scan.RAY;
|
var degreeYa = scan.RAY;
|
||||||
|
|
||||||
var factorY = 1;
|
var factorY = 1;
|
||||||
var factorZ = 1;
|
var factorZ = 1;
|
||||||
if (180 <= degreeXa && degreeXa <= 360)
|
if (180 <= degreeXa && degreeXa <= 360)
|
||||||
{
|
{
|
||||||
factorY = -1;
|
factorY = -1;
|
||||||
factorZ = -1;
|
factorZ = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var degreeXb = 180 - 90 - degreeXa;
|
var degreeXb = 180 - 90 - degreeXa;
|
||||||
@@ -40,6 +40,7 @@ namespace PointCloudWeb.Server.Services
|
|||||||
sinXa = 1;
|
sinXa = 1;
|
||||||
sinXb = 0;
|
sinXb = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sinYa == 0)
|
if (sinYa == 0)
|
||||||
{
|
{
|
||||||
sinYa = 1;
|
sinYa = 1;
|
||||||
@@ -53,14 +54,26 @@ namespace PointCloudWeb.Server.Services
|
|||||||
+ 1
|
+ 1
|
||||||
, -1)
|
, -1)
|
||||||
* Math.Pow(scan.DistanceMM, 2)
|
* Math.Pow(scan.DistanceMM, 2)
|
||||||
);
|
);
|
||||||
|
|
||||||
var p = new Point()
|
var p = new Point
|
||||||
{
|
{
|
||||||
X = NumericUtils.Round(z * sinYb / sinYa),
|
X = NumericUtils.Round(z * sinYb / sinYa),
|
||||||
Y = factorY * NumericUtils.Round(z * sinXb / sinXa),
|
Y = factorY * NumericUtils.Round(z * sinXb / sinXa),
|
||||||
Z = factorZ * NumericUtils.Round(z)
|
Z = factorZ * NumericUtils.Round(z)
|
||||||
};
|
};
|
||||||
|
return p;
|
||||||
|
|
||||||
|
//https://stackoverflow.com/questions/52781607/3d-point-from-two-angles-and-a-distance
|
||||||
|
var pitch = radYa;
|
||||||
|
var yaw = radXa;
|
||||||
|
|
||||||
|
p = new Point
|
||||||
|
{
|
||||||
|
X = (int) (scan.DistanceMM * Math.Sin(yaw) * Math.Cos(pitch)),
|
||||||
|
Y = (int) (scan.DistanceMM * Math.Sin(pitch)),
|
||||||
|
Z = (int) (scan.DistanceMM * Math.Cos(yaw) * Math.Cos(pitch))
|
||||||
|
};
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import modulePCI from './pointCloudInfo/store.js'
|
|||||||
|
|
||||||
export default createStore({
|
export default createStore({
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
strict: true,
|
|
||||||
state: {
|
state: {
|
||||||
dummy: "dummy"
|
dummy: "dummy"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user