Devices API
ADB Device
pymordialdroid.devices.adb_device
Android Debug Bridge (ADB) device implementation for PymordialDroid.
AdbDevice
Bases: PymordialBridgeDevice
Handles Android device communication via pure Python ADB.
Fulfills the PymordialBridgeDevice contract with native package resolution, activity detection, focused window parsing, and resilient app lifecycle commands.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
18 19 20 21 22 23 24 25 26 27 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 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 | |
capture_screenshot()
Captures a PNG screenshot from the device using pure 'screencap -p'.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
355 356 357 358 359 360 361 362 363 364 365 366 367 | |
close_all_apps(exclude=None)
Force stops all installed third-party/user packages to clear device state.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
close_app(package_name=None, app_name=None, timeout=5.0, wait_time=0.5)
Force stops an app and polls pidof to confirm closure.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
connect()
Connects to the Android device via TCP socket with RSA authentication.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
disconnect()
Disconnects the ADB device.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
78 79 80 81 82 83 84 85 86 87 88 89 90 | |
find_package_by_keyword(keyword)
Finds an installed package matching a keyword using 'pm list packages'.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
get_current_app()
Gets the package name of the currently focused application.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
272 273 274 275 276 277 | |
get_focused_app()
Parses 'dumpsys window' to detect the currently focused package and activity.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
get_latest_frame()
Retrieves the most recent frame bytes or captures a fresh screenshot.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
377 378 379 380 381 | |
get_launch_activity(package_name)
Queries Android's activity manager to determine the exact launchable activity.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
go_back()
Simulates Back button press.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
341 342 343 | |
go_home()
Simulates Home button press.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
337 338 339 | |
initialize(config=None)
Initializes the ADB device plugin.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
44 45 46 | |
install_apk(apk_path, update=True)
Pushes and installs an APK file via adb.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | |
is_app_running(package_name=None, app_name=None, max_retries=2, wait_time=1.0)
Checks if an app is actively running by querying process PID.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
is_connected()
Checks if ADB connection is currently active and responsive.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
74 75 76 | |
open_app(package_name, app_name=None, timeout=10.0, wait_time=1.0)
Launches an app via resolved Activity or Monkey fallback, verifying it started.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.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 | |
press_enter()
Simulates Enter key press.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
345 346 347 | |
press_esc()
Simulates Back / Escape key press.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
349 350 351 | |
run_command(command, decode=True)
Executes a shell command on the device.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
92 93 94 95 96 97 98 99 100 101 102 | |
show_recent_apps()
Opens recent apps / overview.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
244 245 246 247 | |
shutdown()
Disconnects and cleans up resources.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
48 49 50 | |
start_stream()
Starts stream mode (tracks frames from screenshot captures).
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
369 370 371 | |
stop_stream()
Stops stream mode.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
373 374 375 | |
swipe(start_x, start_y, end_x, end_y, duration=300)
Performs a touch swipe gesture from start to end coordinates.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
305 306 307 308 309 310 311 312 313 314 315 316 317 | |
tap(coords, y=None, times=1)
Sends tap events to coordinates on screen.
Accepts either a tuple/list (x, y) or separate x, y integers.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
type_text(text, enter=False)
Types text into the focused input field, escaping shell characters.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/adb_device.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
BlueStacks Device
pymordialblue.devices.bluestacks_device
Controller for managing the BlueStacks emulator.
BluestacksDevice
Bases: PymordialEmulatorDevice
Controls the BlueStacks emulator.
Attributes:
| Name | Type | Description |
|---|---|---|
running_apps |
list[PymordialApp] | list
|
A list of currently running PymordialApp instances. |
state |
list[PymordialApp] | list
|
The state machine managing the BlueStacks lifecycle state. |
elements |
list[PymordialApp] | list
|
A container for BlueStacks UI elements. |
elements |
list[PymordialApp] | list
|
A container for BlueStacks UI elements. |
config |
The configuration dictionary for BlueStacks. |
Source code in src/pymordialblue/devices/bluestacks_device.py
26 27 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 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 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | |
filepath
property
writable
Gets the BlueStacks executable filepath.
Returns:
| Type | Description |
|---|---|
str | None
|
The absolute path to the HD-Player.exe file as a string, or None |
str | None
|
if it has not been determined. |
ref_window_size
property
writable
Gets the reference window size.
Returns:
| Type | Description |
|---|---|
tuple[int, int] | None
|
A tuple containing (width, height) in pixels, or None if not set. |
__init__(adb_bridge_device=None, vision_device=None, config=None)
Initializes the BluestacksDevice.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adb_bridge_device
|
AdbDevice | None
|
The bridge device (e.g. AdbDevice) used for low-level ADB interactions. |
None
|
vision_device
|
AndroidUiDevice | None
|
The vision device used for screen analysis. |
None
|
config
|
BluestacksConfig | None
|
A TypedDict containing BlueStacks configuration options. Defaults to package defaults if None. |
None
|
Source code in src/pymordialblue/devices/bluestacks_device.py
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 | |
close()
Kills the Bluestacks controller process.
This will also disconnect the ADB bridge device.
Returns:
| Type | Description |
|---|---|
bool
|
True if the Bluestacks process was found and killed, or if no |
bool
|
process was found running. False if the process was found but |
bool
|
could not be killed. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an unexpected error occurs during the process killing routine. |
Source code in src/pymordialblue/devices/bluestacks_device.py
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 | |
initialize(config)
Initializes the BlueStacks device plugin with configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
BlueConfig
|
Global Pymordial configuration dictionary. |
required |
Source code in src/pymordialblue/devices/bluestacks_device.py
91 92 93 94 95 96 97 | |
is_ready()
Checks if BlueStacks is in the READY state.
Returns:
| Type | Description |
|---|---|
bool
|
True if the current state is EmulatorState.READY, False otherwise. |
Source code in src/pymordialblue/devices/bluestacks_device.py
350 351 352 353 354 355 356 | |
open(max_retries=None, wait_time=None, timeout_s=None)
Opens the BlueStacks emulator application.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_retries
|
int | None
|
The maximum number of attempts to detect the process after launching. Defaults to the configuration value. |
None
|
wait_time
|
int | None
|
The time in seconds to wait between detection attempts. Defaults to the configuration value. |
None
|
timeout_s
|
int | None
|
The maximum total time in seconds to wait for the process to appear before timing out. Defaults to the configuration value. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If BlueStacks fails to start due to an OS error. |
Exception
|
If the BlueStacks process window is not found after the specified retries or timeout period. |
Source code in src/pymordialblue/devices/bluestacks_device.py
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 | |
open_settings()
Opens the Settings app using a verified activity name.
Returns:
| Type | Description |
|---|---|
bool
|
True if opened successfully, False otherwise. |
Source code in src/pymordialblue/devices/bluestacks_device.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
set_dependencies(adb_bridge_device, vision_device)
Sets external dependencies (dependency injection).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adb_bridge_device
|
AdbDevice
|
The ADB bridge device. |
required |
vision_device
|
AndroidUiDevice
|
The vision device. |
required |
Source code in src/pymordialblue/devices/bluestacks_device.py
99 100 101 102 103 104 105 106 107 108 109 110 111 | |
shutdown()
Kills the emulator process.
Source code in src/pymordialblue/devices/bluestacks_device.py
113 114 115 | |
wait_for_load(timeout_s=None)
Waits for Bluestacks to finish loading by polling the ADB connection.
This method blocks until the emulator is responsive via ADB or the timeout is reached.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout_s
|
int | None
|
The maximum number of seconds to wait for the emulator to load. Defaults to the configuration value. |
None
|
Source code in src/pymordialblue/devices/bluestacks_device.py
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 | |
UI Device
pymordialdroid.devices.ui_device
Vision and UI element detection implementing Pymordial's PymordialVisionDevice contract.
AndroidUiDevice
Bases: PymordialVisionDevice
Handles visual recognition tasks: template matching, pixel checks, and OCR.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/ui_device.py
26 27 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 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 | |
check_pixel_color(pymordial_pixel=None, pymordial_screenshot=None, coords=None, expected_color=None, tolerance=10, screenshot=None)
Checks if a pixel matches the target color within tolerance.
Supports coordinate scaling when og_resolution is set on pymordial_pixel.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/ui_device.py
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 | |
check_text(text_to_find, pymordial_screenshot=None, case_sensitive=False, strategy=None)
Checks if text is visible on screen using the OCR device.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/ui_device.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
find_text(text_to_find, pymordial_screenshot=None, strategy=None)
Finds the center coordinates of specified text using the OCR device.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/ui_device.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
initialize(config=None)
Initializes the UI vision plugin.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/ui_device.py
40 41 42 | |
read_text(pymordial_screenshot=None, case_sensitive=False, strategy=None)
Reads text lines from the screen using the OCR device.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/ui_device.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
scale_img_to_screen(image_path, screen_image, ref_resolution=None)
Scales a template image to match the device screen resolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_path
|
str | Path
|
Path to the reference image. |
required |
screen_image
|
str | Image | bytes | ndarray
|
The current screen image. |
required |
ref_resolution
|
tuple[int, int] | None
|
Original resolution (width, height) the template was captured at. |
None
|
Returns:
| Type | Description |
|---|---|
Image
|
Scaled PIL Image. |
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/ui_device.py
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 | |
set_bridge_device(bridge_device)
Sets the underlying bridge device.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/ui_device.py
48 49 50 | |
set_ocr_device(ocr_device)
Sets the OCR device.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/ui_device.py
52 53 54 | |
shutdown()
Performs cleanup.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/ui_device.py
44 45 46 | |
where_element(element, screenshot=None, max_tries=1, set_position=False, set_size=False, wait_time=0.5)
Finds (center_x, center_y) coordinates of a UI element on screen.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/ui_device.py
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 | |
where_elements(elements, screenshot=None, max_tries=1)
Finds the coordinates of the first matching element from a list.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/ui_device.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
Tesseract Device
pymordialdroid.devices.tesseract_device
Tesseract OCR device implementing Pymordial's PymordialOCRDevice contract.
TesseractDevice
Bases: PymordialOCRDevice
Optical Character Recognition device powered by Tesseract and OpenCV.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/tesseract_device.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 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 | |
extract_text(image_path, strategy=None)
Extracts text from an image with optional preprocessing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_path
|
Path | bytes | str | ndarray
|
Source image as Path, bytes, string, or numpy array. |
required |
strategy
|
PymordialExtractStrategy | None
|
Optional extraction strategy (defaults to DefaultExtractStrategy). |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Extracted text string. |
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/tesseract_device.py
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 | |
find_text(search_text, image_path, strategy=None)
Finds (center_x, center_y) coordinates of search_text in the source image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
search_text
|
str
|
Text keyword or substring to search for. |
required |
image_path
|
Path | bytes | str | ndarray
|
Source image as Path, bytes, string, or numpy array. |
required |
strategy
|
PymordialExtractStrategy | None
|
Optional preprocessing strategy. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[int, int] | None
|
(center_x, center_y) coordinates if located, None otherwise. |
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/tesseract_device.py
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 | |
initialize(config=None)
Initializes the OCR device plugin.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/tesseract_device.py
43 44 45 | |
shutdown()
Cleans up resources.
Source code in .venv/lib/python3.13/site-packages/pymordialdroid/devices/tesseract_device.py
47 48 49 | |