anatools.annotations.convert_geococo module

convert_geococo(datadir, outdir, mapping)
create_bounding_box_geojson(min_x, min_y, max_x, max_y)

Create a GeoJSON object representing the bounding box with the given coordinates.

Parameters
  • min_x – Minimum x value (longitude)

  • min_y – Minimum y value (latitude)

  • max_x – Maximum x value (longitude)

  • max_y – Maximum y value (latitude)

Returns

GeoJSON object as a dictionary

create_cocodata()
generate_file_checksum(file_path, algorithm='sha256')

Generate a checksum hash for a given file.

Parameters: - file_path (str): The path to the file. - algorithm (str): The hashing algorithm to use (e.g., ‘md5’, ‘sha1’, ‘sha256’).

Returns: - str: The hexadecimal checksum hash of the file.

class geo_image(image_width, image_height, top_left_lat, top_left_lon, bottom_right_lat, bottom_right_lon)

Bases: object

pixel_to_geo(pixel_coords)

Converts a flattened list of pixel coordinates to geographic coordinates (latitude, longitude).

Parameters: - pixel_coords: A flattened list of pixel coordinates [x1, y1, x2, y2, …].

Returns: - A flattened list of geographic coordinates [lat1, lon1, lat2, lon2, …].

get_highest_classification(classifications)
get_image_bands(image_path)
get_rotated_bbox_coordinates(center_x, center_y, width, height, angle_degrees)

Calculates the pixel-space coordinates of a rotated bounding box.

Parameters: - center_x, center_y: The center of the bounding box in pixel space - width, height: The width and height of the bounding box - angle_degrees: The rotation angle of the bounding box in degrees

Returns: - A list of coordinates starting from the topmost point and proceeding anti-clockwise.