add 3D scatter plot
This commit is contained in:
parent
73962d26be
commit
7414fd0eba
|
@ -15,6 +15,8 @@
|
|||
poetry
|
||||
python3
|
||||
python310Packages.numpy
|
||||
tk
|
||||
python310Packages.matplotlib
|
||||
(python310Packages.opencv4.override {
|
||||
enableGtk2 = true;
|
||||
gtk2 = pkgs.gtk2;
|
||||
|
|
|
@ -11,6 +11,7 @@ python = ">=3.8.1,<4.0"
|
|||
rich = "^12.6.0"
|
||||
opencv-python = "^4.6.0.66"
|
||||
fake-bpy-module-latest = "^20230118"
|
||||
matplotlib = "^3.6.3"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
Flake8-pyproject = "^1.1.0"
|
||||
|
|
14
src/main.py
14
src/main.py
|
@ -2,6 +2,7 @@ import cv2
|
|||
import numpy as np
|
||||
from itertools import product
|
||||
import pickle
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
VOXEL_SIZE = 3e-2
|
||||
X_MIN, X_MAX = -1.5, 1.5
|
||||
|
@ -41,12 +42,6 @@ for k in range(nb_frame):
|
|||
# cv2.circle(frame, (cam_point[0], cam_point[1]), 2, (255*is_in[k], 0, 255*(not is_in[k])))
|
||||
cv2.circle(frame, (cam_point[0], cam_point[1]), 2, (255, 0, 255))
|
||||
|
||||
print(points.shape)
|
||||
cv2.imshow('Frame', frame)
|
||||
cv2.waitKey(0)
|
||||
|
||||
print("result")
|
||||
|
||||
for k in range(nb_frame):
|
||||
frame = cv2.imread(f'/tmp/masks/Image{k:04}.png')
|
||||
|
||||
|
@ -63,3 +58,10 @@ for k in range(nb_frame):
|
|||
|
||||
cv2.imshow('Frame', frame)
|
||||
cv2.waitKey(0)
|
||||
|
||||
# 3D plot the result
|
||||
fig = plt.figure()
|
||||
ax = fig.add_subplot(111, projection='3d')
|
||||
ax.scatter(points[:,0], points[:,1], points[:,2], c='r', marker='o')
|
||||
plt.axis("equal")
|
||||
plt.show()
|
||||
|
|
Loading…
Reference in a new issue