VideoInput¶
Documentation for library VideoInput
.
Type: LIBRARY
Scope: GLOBAL
Keywords¶
Find Text¶
Find the specified text in the provided image or grab a screenshot to search from. The region can be specified directly in the robot file using RPA.core.geometry.to_region
Args: text: text or regex to search for, use the format regex:<regex-string> if the text we want to find is a regex. region: region to search for the text. image: image to search from.
Returns: The list of matched text regions where the text was found. Each match is a dictionary with "text", "region", and "confidence".
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
---|---|---|---|---|
text |
string |
POSITIONAL_OR_NAMED |
Yes |
|
region |
None |
None |
POSITIONAL_OR_NAMED |
No |
image |
None |
None |
POSITIONAL_OR_NAMED |
No |
Get Text Position¶
Get the center position of the best match for the specified text. The region to search can be also specified. The center position is round to the nearest integer.
Run with --debug option (or YARF_LOG_LEVEL=DEBUG) to always log the image with the matched region.
Args: text: The text to match on screen region: The region to search for the text Returns: The x and y coordinates of the center of the best match
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
---|---|---|---|---|
text |
string |
POSITIONAL_OR_NAMED |
Yes |
|
region |
None |
None |
POSITIONAL_OR_NAMED |
No |
Match¶
Grab screenshots and compare until there's a match with the provided template or timeout.
Args: template: path to an image file to be used as template timeout: timeout in seconds tolerance: The tolerance for image comparison in the compare_images method region: the region to search for the template in Returns: list of matched regions
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
---|---|---|---|---|
template |
string |
POSITIONAL_OR_NAMED |
Yes |
|
timeout |
integer |
10 |
POSITIONAL_OR_NAMED |
No |
tolerance |
float |
0.8 |
POSITIONAL_OR_NAMED |
No |
region |
None |
None |
POSITIONAL_OR_NAMED |
No |
Match All¶
Grab screenshots and compare with the provided templates until a frame is found which matches all templates simultaneously or timeout.
Args: templates: sequence of paths to image files to use as templates timeout: timeout in seconds tolerance: The tolerance for image comparison in the compare_images method
Returns: List of matched regions and template path matched
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
---|---|---|---|---|
templates |
list |
POSITIONAL_OR_NAMED |
Yes |
|
timeout |
integer |
10 |
POSITIONAL_OR_NAMED |
No |
tolerance |
float |
0.8 |
POSITIONAL_OR_NAMED |
No |
Match Any¶
Grab screenshots and compare with the provided templates until there's at least one match or timeout.
Args: templates: sequence of paths to image files to use as templates timeout: timeout in seconds tolerance: The tolerance for image comparison in the compare_images method region: the region to search for the template in
Returns: list of matched regions and template path matched
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
---|---|---|---|---|
templates |
list |
POSITIONAL_OR_NAMED |
Yes |
|
timeout |
integer |
10 |
POSITIONAL_OR_NAMED |
No |
tolerance |
float |
0.8 |
POSITIONAL_OR_NAMED |
No |
region |
None |
None |
POSITIONAL_OR_NAMED |
No |
Match Text¶
Wait for specified text to appear on screen and get the position of the best match. The region can be specified directly in the robot file using RPA.core.geometry.to_region.
Args: text: text or regex to match, use the format regex:<regex-string> if the text we want to find is a regex. timeout: Time to wait for the text to appear region: The region to search for the text Returns: It returns a tuple with:
- The list of matched text regions where the text was found, sorted by confidence.
- The image (used for debugging). Each match is a dictionary with "text", "region", and "confidence".
Raises: ValueError: If the specified text isn't found in time
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
---|---|---|---|---|
text |
string |
POSITIONAL_OR_NAMED |
Yes |
|
timeout |
integer |
10 |
POSITIONAL_OR_NAMED |
No |
region |
None |
None |
POSITIONAL_OR_NAMED |
No |
Read Text¶
Read the text from the provided image or grab a screenshot to read from.
Args: image: image to read text from
Returns: text read from the image
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
---|---|---|---|---|
image |
None |
None |
POSITIONAL_OR_NAMED |
No |
Restart Video Input¶
Restart video stream process if needed.
Set Ocr Method¶
Set the OCR method to use.
Args: method: OCR method to use. Either "rapidocr" or "tesseract".
Raises: ValueError: If the specified method is not supported.
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
---|---|---|---|---|
method |
string |
rapidocr |
POSITIONAL_OR_NAMED |
No |
Start Video Input¶
Connect to the display.
Stop Video Input¶
Disconnect from the display.