cast
cast copied to clipboard
Receiving Images With newProcessedImage Function in pycaster.py Example
Dear Clarius Support,
After connecting to the Clarius probe using the pycaster.py
example with the correct IP address and port all commands seem to work, except the stream action.
# Output after successfully connecting to the Clarius probe
initialization succeeded
connected to 192.168.1.1 on port 37425
press (q)->quit (a)->action (s)->stream (p)->param change: s
The newProcessedImage
function is never called for reasons unknown to me.
How could I stream the images on the PC and save them as PNG?
def newProcessedImage(image, width, height, sz, micronsPerPixel, timestamp, angle, imu):
print(f'newProcessedImage called!') # <- this line is never printed
bpp = sz / (width * height)
if printStream:
print(
"image: {0}, {1}x{2} @ {3} bpp, {4:.2f} um/px, imu: {5} pts".format(
timestamp, width, height, bpp, micronsPerPixel, len(imu)
),
end="\r",
)
if bpp == 4:
img = Image.frombytes("RGBA", (width, height), image)
else:
img = Image.frombytes("L", (width, height), image)
img.save("processed_image.png")
return
Thanks in advance for any help!