Utils
Page under construction...
geometric_verification
geometric_verification(kpts0=None, kpts1=None, method='pydegensac', threshold=1, confidence=0.9999, max_iters=10000, quiet=False, **kwargs)
Computes the fundamental matrix and inliers between the two images using geometric verification.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/deep_image_matching/utils/geometric_verification.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 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 |
|
tiling
Tiler
Class for dividing an image into tiles.
Source code in src/deep_image_matching/utils/tiling.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 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 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 |
|
__init__(tiling_mode=TilingMode.SIZE)
Initialize class.
Parameters: - tiling_mode (TilingMode or str, default=TilingMode.SIZE): The tiling mode to use. Can be a TilingMode enum or a string with the name of the enum.
Returns: None
Source code in src/deep_image_matching/utils/tiling.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
compute_tiles_by_size(input, window_size, overlap=0)
Compute tiles by specifying the window size and overlap.
Parameters: |
|
---|
Returns: |
|
---|
Raises: |
|
---|
Note
- If the input is a numpy array, it is assumed to be in the format (H, W, C). If C > 1, it is converted to (C, H, W).
- The output tiles are in the format (H, W, C).
- The output origins are expressed in x, y coordinates, where x is the horizontal axis and y is the vertical axis (pointing down, as in OpenCV).
Source code in src/deep_image_matching/utils/tiling.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 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 |
|
image
Image
A class representing an image.
Attributes: |
|
---|
Source code in src/deep_image_matching/utils/image.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 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 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 |
|
K
property
Returns the camera intrinsics matrix K from exif data.
date
property
Returns the date and time of the image in a string format.
datetime
property
Returns the date and time of the image as datetime object.
exif
property
Returns the exif of the image
extension
property
Returns the extension of the image
focal_length
property
Returns the focal length of the image in mm.
height
property
Returns the height of the image in pixels
id
property
Returns the id of the image
name
property
Returns the name of the image (including extension)
parent
property
Path to the parent folder of the image
path
property
Path of the image
size
property
Returns the size of the image in pixels as a tuple (width, height)
stem
property
Returns the name of the image (excluding extension)
time
property
time Returns the time of the image from exif as a string
timestamp
property
Returns the date and time of the image in a string format.
width
property
Returns the width of the image in pixels
__init__(path, id=None)
init Create Image object as a lazy loader for image data
Parameters: |
|
---|
Source code in src/deep_image_matching/utils/image.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
get_intrinsics_from_exif()
Constructs the camera intrinsics from exif tag.
Equation: focal_px=max(w_px,h_px)*focal_mm / ccdw_mm
Note
References for this functions can be found:
- https://github.com/colmap/colmap/blob/e3948b2098b73ae080b97901c3a1f9065b976a45/src/util/bitmap.cc#L282
- https://openmvg.readthedocs.io/en/latest/software/SfM/SfMInit_ImageListing/
- https://photo.stackexchange.com/questions/40865/how-can-i-get-the-image-sensor-dimensions-in-mm-to-get-circle-of-confusion-from # noqa: E501
Returns: |
|
---|
Source code in src/deep_image_matching/utils/image.py
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 |
|
read()
Returns the image (pixel values) as numpy array
Source code in src/deep_image_matching/utils/image.py
227 228 229 |
|
read_exif()
Read image exif with exifread and store them in a dictionary
Raises: |
|
---|
Returns: |
|
---|
Source code in src/deep_image_matching/utils/image.py
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 |
|
ImageList
Represents a collection of Image objects
Attributes: |
|
---|
Source code in src/deep_image_matching/utils/image.py
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 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
|
img_names
property
Returns a list of image names in the ImageList.
Returns: |
|
---|
img_paths
property
Returns a list of image paths in the ImageList
Returns: |
|
---|
__init__(img_dir)
Initializes an ImageList object
Parameters: |
|
---|
Raises: |
|
---|
Source code in src/deep_image_matching/utils/image.py
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 |
|
add_image(path, img_id)
Adds a new Image object to the ImageList.
Parameters: |
|
---|
Source code in src/deep_image_matching/utils/image.py
423 424 425 426 427 428 429 430 431 432 |
|
read_image(path, color=True)
Reads image with OpenCV and returns it as a NumPy array.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/deep_image_matching/utils/image.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
logger
deprecated(func)
This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted and a logging warning when the function is used.
Source code in src/deep_image_matching/utils/logger.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|
setup_logger(name=None, log_level='info', log_folder=None, logfile_basename='log')
Configures and returns a logging.Logger instance.
This function checks for existing loggers with the same name. It provides flexible configuration for both console and file-based logging with customizable log levels, formats, and an optional log file.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/deep_image_matching/utils/logger.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
timer
Timer
Class to help manage printing simple timing of code execution.
Attributes: |
|
---|
Source code in src/deep_image_matching/utils/timer.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
__init__(smoothing=0.3, logger=logger, log_level='info', cumulate_by_key=False)
Initializes the Timer object.
Parameters: |
|
---|
Source code in src/deep_image_matching/utils/timer.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
print(text='Timer', sep=', ')
Prints the accumulated timing information.
Parameters: |
|
---|
Source code in src/deep_image_matching/utils/timer.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
reset()
Resets the Timer object, setting initial time values.
Source code in src/deep_image_matching/utils/timer.py
66 67 68 69 70 71 72 73 74 |
|
update(name)
Updates the timing information for a specific named section. If the section does not exist, it is created, otherwise the timing information is updated. If cumulate_by_key was set to True, the timing information is accumulated for each key, otherwise the timing information is smoothed.
Parameters: |
|
---|
Source code in src/deep_image_matching/utils/timer.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
timeit(func)
Decorator that measures the execution time of a function and prints the duration.
Parameters: |
|
---|
Returns: |
|
---|
Source code in src/deep_image_matching/utils/timer.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|