Camera Reference¶
Note
The Camera class has more public methods than are documented here.
You’re free to use these methods, although you should consider them a work-in-progress.
- class visca_over_ip.Camera(ip: str, port=52381)¶
Represents a camera that has a VISCA-over-IP interface. Provides methods to control a camera over that interface.
Only one camera can be connected on a given port at a time. If you wish to use multiple cameras, you will need to switch between them (use
close_connection()) or set them up to use different ports.- __init__(ip: str, port=52381)¶
- Parameters
ip – the IP address or hostname of the camera you want to talk to.
port – the port number to use. 52381 is the default for most cameras.
- close_connection()¶
Only one camera can be bound to a socket at once. If you want to connect to another camera which uses the same communication port, first call this method on the first camera.
- get_focus_mode() str¶
- Returns
either ‘auto’ or ‘manual’
- get_pantilt_position() Tuple[int, int]¶
- Returns
two signed integers representing the absolute pan and tilt positions respectively
- get_zoom_position() int¶
- Returns
an unsigned integer representing the absolute zoom position
- manual_focus(speed: int)¶
Focuses near or far at the given speed. Set the focus mode to manual before calling this method.
- Parameters
speed – -7 to 7 where positive integers focus near and negative integers focus far
- pantilt(pan_speed: int, tilt_speed: int, pan_position=None, tilt_position=None, relative=False)¶
Commands the camera to pan and/or tilt. You must specify both pan_position and tilt_position OR specify neither
- Parameters
pan_speed – -24 to 24 where negative numbers cause a left pan, 0 causes panning to stop, and positive numbers cause a right pan
tilt_speed – -24 to 24 where negative numbers cause a downward tilt, 0 causes tilting to stop, and positive numbers cause an upward tilt.
pan_position – if specified, the camera will move this distance or go to this absolute position depending on the value of relative. Valid values are integers by default between 0x2200 and 0xDE00. Camera users may set more restrictive pan limits for a camera.
tilt_position – if specified, the camera will move this distance or go to this absolute position depending on the value of relative. Valid values are integers 0x1200 to 0xFC00 if image flip is on or 0xEE00 to 0x400 if image flip is off. Camera users may set more restrictive tilt limits for a camera
relative – If set to True, the position will be relative instead of absolute.
- Raises
ViscaException – if invalid values are specified for positions
ValueError – if invalid values are specified for speeds
- pantilt_home()¶
Moves the camera to the home position
- pantilt_reset()¶
Moves the camera to the reset position
- recall_preset(preset_num: int)¶
Instructs the camera to recall one of the 16 saved presets
- save_preset(preset_num: int)¶
Saves many of the camera’s settings in one of 16 slots
- set_focus_mode(mode: str)¶
Sets the focus mode of the camera
- Parameters
mode – One of “auto”, “manual”, “auto/manual”, “one push trigger”, or “infinity”. See the manual for an explanation of these modes.
- set_power(power_state: bool)¶
Powers on or off the camera based on the value of power_state
- zoom(speed: int)¶
Zooms out or in at the given speed.
- Parameters
speed – -7 to 7 where positive numbers zoom in, zero stops the zooming, and negative numbers zoom out.
- zoom_to(position: float)¶
Zooms to an absolute position
- Parameters
position – 0-1, where 1 is zoomed all the way in