Comments (1)
The following scripts extract the level set of the voxels. And the result shows that, the problem still occurs when setting value to be lower than 0.05
import time
import numpy as np
import matplotlib.pyplot as plt
from _voxbloxpy import EsdfMap, TsdfMap
import plotly.graph_objects as go
def create_esdf(sphere: bool = True, debug_view: bool = True):
quat_wxyz = [0.0, 1.0, 0.0, 0.0]
pos = [-1.0, 0.0, 0.0]
camera_pose = pos + quat_wxyz
r_sphere = 0.5
ylin = np.linspace(-1.0, 1.0, 100)
zlin = np.linspace(-1.0, 1.0, 100)
y_grid, z_grid = np.meshgrid(ylin, zlin)
if sphere:
pts_yz_plane = np.array(list(zip(y_grid.flatten(), z_grid.flatten())))
inside_circle = np.sum(pts_yz_plane ** 2, axis=1) < r_sphere - 0.02
pts_yz_plane_inner = pts_yz_plane[inside_circle]
pts_x = -np.sqrt(1.0 - np.sum(pts_yz_plane_inner ** 2, axis=1)) + 1.0 # 1.0 for camera
pts = np.zeros((len(pts_x), 3))
pts[:, 0] = pts_x
pts[:, 1:] = pts_yz_plane_inner
else:
pts_yz_plane = np.array(list(zip(y_grid.flatten(), z_grid.flatten())))
pts_x = np.zeros(len(pts_yz_plane))
pts = np.zeros((len(pts_x), 3))
pts[:, 0] = pts_x
pts[:, 1:] = pts_yz_plane
if debug_view:
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.scatter(pts[:, 0], pts[:, 1], pts[:, 2])
plt.show()
esdfmap = EsdfMap(0.05, 32)
esdfmap.update(camera_pose, pts, True)
n = esdfmap.get_num_alloc_block()
print("allocated block: {}".format(n))
return esdfmap
esdf = create_esdf(sphere=True, debug_view=False)
block_origins = esdf.get_block_origins()
pts, dists, observed = esdf.get_voxel_info();
dists = np.array(dists)
print(dists)
pts = np.array(pts)
pts1 = pts[np.logical_and(np.abs(dists) < 0.02, observed)]
pts2 = pts[np.logical_and(np.abs(dists - 0.1) < 0.02, observed)]
pts3 = pts[np.logical_and(np.abs(dists - 0.2) < 0.02, observed)]
pts4 = pts[np.logical_and(np.abs(dists - 0.3) < 0.02, observed)]
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.scatter(pts1[:, 0], pts1[:, 1], pts1[:, 2], c="yellow")
ax.scatter(pts2[:, 0], pts2[:, 1], pts2[:, 2], c="red")
ax.scatter(pts3[:, 0], pts3[:, 1], pts3[:, 2], c="blue")
ax.scatter(pts4[:, 0], pts4[:, 1], pts4[:, 2], c="green")
plt.show()
from voxbloxpy.
Related Issues (3)
- figure stock HOT 1
- bug: memory leak on ApproxHashSset HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from voxbloxpy.