Skip to content

Commit

Permalink
develop downsampling, reconstructure mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
uzumal committed Sep 12, 2022
1 parent 712cac7 commit 6558f52
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 198 deletions.
17 changes: 16 additions & 1 deletion AR-ROS/Assets/PointCloudStreaming/PointCloudSubscriber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ void PointCloudRendering()
// preview pointcloud
}
// pcl_color[n] = new Color(r, g, b);

}
DownSampling();
// positions = GetPCL();
// if (positions == null)
// {
Expand All @@ -163,6 +163,21 @@ void PointCloudRendering()
// }
}

void DownSampling()
{
int cnt = 0;
// Cubeの重なり判定
Vector3 halfExtents = new Vector3(1.0f, 1.0f, 1.0f);
for(int i = 0; i < pcl.Length; i++){
if (Physics.CheckBox(pcl[i], halfExtents, Quaternion.identity)){
pcl[cnt] = pcl[i];
cnt++;
}else{
// Debug.Log("noise");
}
}
}

public Vector3[] GetPCL()
{
return pcl;
Expand Down
7 changes: 3 additions & 4 deletions AR-ROS/Assets/PointCloudStreaming/PointCubeRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ void Start()
obj = (GameObject)Resources.Load ("Point");
myPositions.Add (new Vector3 (0.0f, 0.0f, 0.0f));
cnt = 0;
InvokeRepeating("ResetMesh", 10.0f, 10.0f);
GeneratePrefab();
}

// Update is called once per frame
void Update()
{
UpdateMesh();
Invoke("ResetMesh", 10);
}

void GeneratePrefab()
Expand Down Expand Up @@ -65,7 +65,6 @@ void ResetMesh()
// }
}


void UpdateMesh()
{
//positions = subscriber.pcl;
Expand All @@ -75,7 +74,7 @@ void UpdateMesh()
bool isPrefabEnough = false;

// Cubeの重なり判定
Vector3 halfExtents = new Vector3(0.05f, 0.05f, 0.05f);
Vector3 halfExtents = new Vector3(0.01f, 0.01f, 0.01f);

if (positions == null)
{
Expand All @@ -95,7 +94,7 @@ void UpdateMesh()
//prefabが足りているからtrueにする(追加)
isPrefabEnough = true;
cnt++;
break;
// break;
}
}else{
//もしもprefabが足りずbreakしなかった時の処理(追加)
Expand Down
198 changes: 5 additions & 193 deletions AR-ROS/Assets/Scenes/hololens-tello-orbslam2.unity
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!65 &624730053
BoxCollider:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -497,7 +497,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!65 &686055210
BoxCollider:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -572,99 +572,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &692795875
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 692795876}
- component: {fileID: 692795879}
- component: {fileID: 692795878}
- component: {fileID: 692795877}
m_Layer: 0
m_Name: Cube (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &692795876
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 692795875}
m_LocalRotation: {x: -0, y: -0.7071068, z: -0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
m_Children: []
m_Father: {fileID: 1977244193}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &692795877
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 692795875}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &692795878
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 692795875}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &692795879
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 692795875}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &830771621
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -769,7 +676,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 830771621}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 719af7c628bf04268872c83454c20970, type: 3}
m_Name:
Expand Down Expand Up @@ -914,99 +821,6 @@ Transform:
m_Father: {fileID: 2004171209}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1246664558
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1246664559}
- component: {fileID: 1246664562}
- component: {fileID: 1246664561}
- component: {fileID: 1246664560}
m_Layer: 0
m_Name: Cube (2)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1246664559
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1246664558}
m_LocalRotation: {x: -0, y: -0.7071068, z: -0, w: 0.7071068}
m_LocalPosition: {x: 0.18, y: 0, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
m_Children: []
m_Father: {fileID: 1977244193}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &1246664560
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1246664558}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1246664561
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1246664558}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &1246664562
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1246664558}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1317003634
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1148,7 +962,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!65 &1534119114
BoxCollider:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1249,9 +1063,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 692795876}
- {fileID: 1246664559}
m_Children: []
m_Father: {fileID: 180183870}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down

0 comments on commit 6558f52

Please sign in to comment.