Tag Reader's API Reference
Reader
CropValues
dataclass
Cropped equirectangular pictures metadata
Attributes:
Name | Type | Description |
---|---|---|
fullWidth |
int
|
Full panorama width |
fullHeight |
int
|
Full panorama height |
width |
int
|
Cropped area width |
height |
int
|
Cropped area height |
left |
int
|
Cropped area left offset |
top |
int
|
Cropped area top offset |
Source code in geopic_tag_reader/reader.py
GeoPicTags
dataclass
Tags associated to a geolocated picture
Attributes:
Name | Type | Description |
---|---|---|
lat |
float
|
GPS Latitude (in WGS84) |
lon |
float
|
GPS Longitude (in WGS84) |
ts |
datetime
|
The capture date (date & time with timezone) |
heading |
int
|
Picture GPS heading (in degrees, North = 0°, East = 90°, South = 180°, West = 270°). Value is computed based on image center (if yaw=0°) |
type |
str
|
The kind of picture (flat, equirectangular) |
make |
str
|
The camera manufacturer name |
model |
str
|
The camera model name |
focal_length |
float
|
The camera focal length (in mm) |
crop |
CropValues
|
The picture cropped area metadata (optional) |
exif |
dict[str, str]
|
Raw EXIF tags from picture (following Exiv2 naming scheme, see https://exiv2.org/metadata.html) |
tagreader_warnings |
list[str]
|
List of thrown warnings during metadata reading |
altitude |
float
|
altitude (in m) (optional) |
pitch |
float
|
Picture pitch angle, compared to horizon (in degrees, bottom = -90°, horizon = 0°, top = 90°) |
roll |
float
|
Picture roll angle, on a right/left axis (in degrees, left-arm down = -90°, flat = 0°, right-arm down = 90°) |
yaw |
float
|
Picture yaw angle, on a vertical axis (in degrees, front = 0°, right = 90°, rear = 180°, left = 270°). This offsets the center image from GPS direction for a correct 360° sphere correction |
ts_by_source |
TimeBySource
|
all read timestamps from image, for finer processing. |
Implementation note: this needs to be sync with the PartialGeoPicTags structure
Source code in geopic_tag_reader/reader.py
InvalidExifException
InvalidFractionException
PartialExifException
Bases: Exception
Exception for partial / missing EXIF information from image
Contains a PartialGeoPicTags with all tags that have been read and the list of missing tags
Source code in geopic_tag_reader/reader.py
PartialGeoPicTags
dataclass
Tags associated to a geolocated picture when not all tags have been found
Implementation note: this needs to be sync with the GeoPicTags structure
Source code in geopic_tag_reader/reader.py
TimeBySource
dataclass
All datetimes read from available sources
Attributes:
Name | Type | Description |
---|---|---|
gps |
datetime
|
Time read from GPS clock |
camera |
datetime
|
Time read from camera clock (DateTimeOriginal) |
Source code in geopic_tag_reader/reader.py
getBest()
Get the best available datetime to use
Source code in geopic_tag_reader/reader.py
decodeLatLon(data, group, _)
Reads GPS info from given group to get latitude/longitude as float coordinates
Source code in geopic_tag_reader/reader.py
decodeMakeModel(value)
Python 2/3 compatible decoding of make/model field.
Source code in geopic_tag_reader/reader.py
decodeManyFractions(value)
Try to decode a list of fractions, separated by spaces
Source code in geopic_tag_reader/reader.py
isExifTagUsable(exif, tag, expectedType=str)
Is a given EXIF tag usable (not null and not an empty string)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exif |
dict
|
The EXIF tags |
required |
tag |
str
|
The tag to check |
required |
expectedType |
class
|
The expected data type |
str
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if not empty |
Source code in geopic_tag_reader/reader.py
readPictureMetadata(picture, lang_code='en')
Extracts metadata from picture file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
picture |
bytes
|
Picture file |
required |
lang_code |
str
|
Language code for translating error labels |
'en'
|
Returns:
Name | Type | Description |
---|---|---|
GeoPicTags |
GeoPicTags
|
Extracted metadata from picture |
Source code in geopic_tag_reader/reader.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
|
Writer
Warning
To use this module, you need to install the write-exif
dependency:
DirectionRef
Bases: str
, Enum
Indicates the reference for giving the direction of the image when it is captured.
Source code in geopic_tag_reader/writer.py
UnsupportedExifTagException
format_offset(offset)
Format offset for OffsetTimeOriginal. Format is like "+02:00" for paris offset
format_offset(timedelta(hours=5, minutes=45)) '+05:45' format_offset(timedelta(hours=-3)) '-03:00'
Source code in geopic_tag_reader/writer.py
localize_capture_time(metadata, img_metadata)
Localize a datetime in the timezone of the picture If the picture does not contains GPS position, the datetime will not be modified.
Source code in geopic_tag_reader/writer.py
writePictureMetadata(picture, metadata, lang_code='en')
Override exif metadata on raw picture and return updated bytes
Source code in geopic_tag_reader/writer.py
Sequence
Picture
dataclass
Source code in geopic_tag_reader/sequence.py
distance_to(other)
Computes distance in meters based on Haversine formula
Source code in geopic_tag_reader/sequence.py
Sequence
dataclass
Source code in geopic_tag_reader/sequence.py
delta_with(otherSeq)
Delta between the end of this sequence and the start of the other one. Returns a tuple (timedelta, distance in meters)
Source code in geopic_tag_reader/sequence.py
from_ts()
dispatch_pictures(pictures, sortMethod=None, mergeParams=None, splitParams=None)
Dispatches a set of pictures into many sequences. This function both sorts, de-duplicates and splits in sequences all your pictures.
Parameters
pictures : set of pictures to dispatch sortMethod : strategy for sorting pictures mergeParams : conditions for considering two pictures as duplicates splitParams : conditions for considering two sequences as distinct
Returns
DispatchReport : clean sequences, duplicates pictures and split reasons
Source code in geopic_tag_reader/sequence.py
find_duplicates(pictures, params=None)
Finds too similar pictures. Note that input list should be properly sorted.
Parameters
pictures : list of sorted pictures to check params : parameters used to consider two pictures as a duplicate
Returns
(Non-duplicates pictures, Duplicates pictures)
Source code in geopic_tag_reader/sequence.py
sort_pictures(pictures, method=SortMethod.time_asc)
Sorts pictures according to given strategy
Parameters
pictures : Picture[] List of pictures to sort method : SortMethod Sort logic to adopt (time-asc, time-desc, filename-asc, filename-desc)
Returns
Picture[] List of pictures, sorted
Source code in geopic_tag_reader/sequence.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
split_in_sequences(pictures, splitParams=SplitParams())
Split a list of pictures into many sequences. Note that this function expect pictures to be sorted and have their metadata set.
Parameters
pictures : Picture[] List of pictures to check, sorted and with metadata defined splitParams : SplitParams The parameters to define deltas between two pictures
Returns
List[Sequence] List of pictures splitted into smaller sequences
Source code in geopic_tag_reader/sequence.py
Camera
is_360(make=None, model=None, width=None, height=None)
Checks if given camera is equirectangular (360°) based on its make, model and dimensions (width, height).
is_360() False is_360("GoPro") False is_360("GoPro", "Max 360") True is_360("GoPro", "Max 360", "2048", "1024") True is_360("GoPro", "Max 360", "1024", "768") False is_360("RICOH", "THETA S", "5376", "2688") True