35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
import requests
|
|
import numpy as np
|
|
|
|
class CommunicateUtil:
|
|
VIEW_HOST = "192.168.1.2:7999" #"10.7.250.52:7999" ##
|
|
INFERENCE_HOST = "127.0.0.1"
|
|
INFERENCE_PORT = 5000
|
|
|
|
def get_view_data(init = False) -> dict:
|
|
params = {}
|
|
params["create_scanner"] = init
|
|
response = requests.get(f"http://{CommunicateUtil.VIEW_HOST}/api/data", json=params)
|
|
data = response.json()
|
|
|
|
if not data["success"]:
|
|
print(f"Failed to get view data")
|
|
return None
|
|
|
|
image_id = data["image_id"]
|
|
depth_image = np.array(data["depth_image"], dtype=np.uint16)
|
|
depth_intrinsics = data["depth_intrinsics"]
|
|
depth_extrinsics = np.array(data["depth_extrinsics"])
|
|
view_data = {
|
|
"image_id": image_id,
|
|
"depth_image": depth_image,
|
|
"depth_intrinsics": depth_intrinsics,
|
|
"depth_extrinsics": depth_extrinsics
|
|
}
|
|
return view_data
|
|
|
|
def get_inference_data(view_data:dict) -> dict:
|
|
data = {}
|
|
return data
|
|
|
|
|