28 lines
976 B
Python
28 lines
976 B
Python
def start_camera_server():
|
|
python_name = "{home}/../anaconda3/envs/py38/python.exe"
|
|
script_name = "{home}/script/cpython/VmbPyServer.py"
|
|
python_name = expand_path(python_name)
|
|
script_name = expand_path(script_name)
|
|
print("Starting camera Server")
|
|
r=exec_cpython(script_name, python_name = python_name)
|
|
fork(start_camera_server)
|
|
|
|
|
|
img_stream = Stream("img_stream","localhost:9000", SocketType.SUB)
|
|
img_stream.createMatrix = True
|
|
img_stream.initialize()
|
|
img_stream.start()
|
|
#show_panel(img_stream)
|
|
def add_img(img_stream):
|
|
img_stream.waitCacheChange(0)
|
|
if (img_stream.state == State.Busy) and (Context.getState().isActive()):
|
|
add_device(img_stream.getChild("image"), True)
|
|
img = RegisterMatrixSource("img", image)
|
|
#img = RegisterArraySource("img", image)
|
|
#img.config.imageWidth = image.shape[0]
|
|
#img.config.imageHeight = image.shape[1]
|
|
add_device(img, True)
|
|
|
|
|
|
fork((add_img, (img_stream,)))
|