更新 Vision/camera_coordinate_dete_test.py

This commit is contained in:
hjw
2024-09-06 03:42:32 +00:00
parent 538b52bb7f
commit 9fdf488674

View File

@ -1,23 +1,22 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' '''
# @Time : 2024/9/5 14:57 # @Time : 2024/9/5 14:57
# @Author : hjw # @Author : hjw
# @File : camera_coordinate_dete_test.py.py # @File : camera_coordinate_dete_test.py.py
''' '''
from camera_coordinate_dete import Detection from camera_coordinate_dete import Detection
import cv2 import cv2
model_path = './pt_model/last-0903.pt'
device = 'cpu' detection = Detection()
detection = Detection(model_path, device)
while True:
while True: ret, img, xyz, nx_ny_nz = detection.get_position()
ret, img, xyz, nx_ny_nz = detection.get_position() if ret==1:
if ret==1: print('xyz点云坐标', xyz)
print('xyz点云坐标', xyz) print('nx_ny_nz法向量', nx_ny_nz)
print('nx_ny_nz法向量', nx_ny_nz) img = cv2.resize(img,(720, 540))
img = cv2.resize(img,(720, 540)) cv2.imshow('img', img)
cv2.imshow('img', img) cv2.waitKey(1)
cv2.waitKey(1)