The attached code consistently writes a 100x75 image instead of the expected 640x480. In the code I was writing when I discovered the bug, it sometimes returns the correct size and sometimes the wrong size, so it looks like a race condition. The tiny incorrect size also looks suspiciously similar to the size of the thumbnail I see in the camera preview window.
Relevant code is this:
virtual_camera = RDK.Cam2D_Add(item_object=station, cam_params="FOCAL_LENGTH=1.93 FOV=65.5 SIZE=640x480")
filename = "/tmp/bug.png"
RDK.Cam2D_Snapshot(file_save_img=filename)
I'm on Ubuntu 22.04, RoboDK v5.4.1 (64 bit)
Full code:
While we're on the topic, are all the misspelled "LENGHT"s in the API docs (eg., "FOCAL_LENGHT" instead of "FOCAL_LENGTH") for the camera setup string what we should actually use, or is the library actually expecting the correct spelling?
Relevant code is this:
virtual_camera = RDK.Cam2D_Add(item_object=station, cam_params="FOCAL_LENGTH=1.93 FOV=65.5 SIZE=640x480")
filename = "/tmp/bug.png"
RDK.Cam2D_Snapshot(file_save_img=filename)
I'm on Ubuntu 22.04, RoboDK v5.4.1 (64 bit)
Full code:
Code:
#!/usr/bin/python3
from robolink import * # API to communicate with RoboDK
from robodk import * # robodk robotics toolbox
RDK = Robolink()
def clear_station(rdk):
station_name = "Camera bug"
# If there was already a station for this script, delete it
station = rdk.Item(station_name)
try:
station.Delete()
except robolink.InputError as e:
pass
station = rdk.AddStation(station_name)
return station
station = clear_station(RDK)
virtual_camera = RDK.Cam2D_Add(item_object=station, cam_params="FOCAL_LENGTH=1.93 FOV=65.5 SIZE=640x480")
filename = "/tmp/bug.png"
RDK.Cam2D_Snapshot(file_save_img=filename)
While we're on the topic, are all the misspelled "LENGHT"s in the API docs (eg., "FOCAL_LENGHT" instead of "FOCAL_LENGTH") for the camera setup string what we should actually use, or is the library actually expecting the correct spelling?