Camera¶
drone.camera
Copyright MIT GNU General Public License v3.0
MIT BWSI Autonomous Drone Racing Course - UAV Neo
File Name: camera.py File Description: Defines the interface of the Camera module of the drone_core library.
- class camera.Camera¶
Returns color images, depth images, and downward images captured by the drone’s cameras.
- get_color_image() NDArray¶
Returns a deep copy of the current forward color image captured by the camera.
- Returns:
- An array representing the pixels in the image, organized as follows
0th dimension: pixel rows, indexed from top to bottom. 1st dimension: pixel columns, indexed from left to right. 2nd dimension: pixel color channels, in the blue-green-red format.
Note
Each color value ranges from 0 to 255.
Example:
image = uav.camera.get_color_image() blue = image[3][5][0]
- abstractmethod get_color_image_async() NDArray¶
Returns the current forward color image without the drone in “go” mode.
Warning
This function breaks the start-update paradigm and should only be used in Jupyter Notebook.
- abstractmethod get_color_image_no_copy() NDArray¶
Returns a direct reference to the forward color image captured by the camera.
- Returns:
An array representing the pixels in the image.
Warning
Do not modify the returned image.
Example:
image = uav.camera.get_color_image_no_copy()
- abstractmethod get_depth_image() NDArray¶
Returns the current depth image captured by the forward camera.
- Returns:
A two-dimensional array storing the distance of each pixel from the drone in cm.
Example:
image = uav.camera.get_depth_image() distance = image[3][5]
- abstractmethod get_depth_image_async() NDArray¶
Returns the current depth image without the drone in “go” mode.
Warning
This function breaks the start-update paradigm and should only be used in Jupyter Notebook.
- abstractmethod get_downward_image() NDArray¶
Returns the current image from the downward-facing RGB camera.
- Returns:
- An array representing the pixels in the image, organized as follows
0th dimension: pixel rows, indexed from top to bottom. 1st dimension: pixel columns, indexed from left to right. 2nd dimension: pixel color channels, in the blue-green-red format.
Example:
down_image = uav.camera.get_downward_image()
- abstractmethod get_downward_image_async() NDArray¶
Returns the current downward image without the drone in “go” mode.
Warning
This function breaks the start-update paradigm and should only be used in Jupyter Notebook.
- get_height() int¶
Returns the pixel height of the color and depth images.
- get_max_range() float¶
Returns the maximum distance in cm which can be detected by the depth camera.
- get_width() int¶
Returns the pixel width of the color and depth images.