Camera

Camera class for evtech.

class evtech.camera.Camera(proj, bounds, cen, geo_bounds, elev, crs, image_path)[source]

This class represents camera information for a given image and allows for world<->camera interactions

Parameters
  • proj (class: numpy.array) – The 3x4 projection matrix for the camera

  • bounds (list) – The bounds of the image chip within the larger image [x_min, y_min, x_max, y_max]

  • cen (list) – The center of the camera [x, y, z]

  • geo_bounds (list) – The geographic bounds of the image in lat/lon [x_min, y_min, x_max, y_max]

  • elev (float) – The average elevation of the image

  • crs (class: pyproj.CRS) – The coordinate system for the projection matrix (Must be linear such as UTM)

  • image_path – The filepath to the image data

get_bounds()[source]

Get the bounds of the camera

Returns

The bounds of the image on the ground

Return type

class: shapely.Polygon

get_elevation()[source]

Get the average ground elevation of the image

Returns

The average elevation of the ground in the frame

Return type

float

height_between_points(base_point, peak_point, elev=None)[source]

Compute the height between two image points, given the elevation of the base point. If no elevation is passed the stored elevation will be used.

Parameters
  • base_point (list) – The image point at the given elevation

  • peak_point (list) – The image point to compute the height at

  • elev (float, optional) – The associated elevation of the base point, defaults to None

load_image(loader=<built-in function imread>)[source]

Load the image for this camera

Parameters

loader (function, optional) – A function to load the image, defaults to cv2.imread

Returns

image data

Return type

numpy.array

project_from_camera(col, row)[source]

Project a ray from the camera

Parameters
  • col (float) – The column index of the pixel to project

  • row (float) – The row index of the pixel to project

Returns

A ray from the camera

Return type

class: evtech.Ray

project_to_camera(lon, lat, elevation)[source]

Project a lat/lon/elevation point into the image

Parameters
  • lat (float) – The latitiude

  • lon (float) – The longitiude

  • elevation (float) – The elevation

Returns

The row, col value of the pixel

Return type

class: np.Array

set_path(image_path)[source]

Mutator to set path data member

Parameters

path (string) – Path to image data

to_full_image(col, row)[source]

Convert an image point from the subset image to the full image

Parameters
  • col (float) – The column to offset

  • row (float) – The row to offset

Returns

The offset row,col

Return type

tuple

evtech.camera.camera_from_json(json_data, image_path='')[source]

Generate a camera from the seralized JSON data

Parameters
  • json_data (dict) – The json data loaded from the serlized JSON

  • image_path (str, optional) – The path to the associated image data

Returns

A camera object

Return type

evtech.Camera