mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-10-30 06:34:13 +00:00
ReventWorkload: State detection fixes
- Corrected code highlighting and phase names in documentation - Fixed check_states paremeter not being honoured - Moved state dependencies check to happen earlier in execution and to be a user facing error
This commit is contained in:
@@ -40,6 +40,8 @@ try:
|
||||
except ImportError:
|
||||
imutils = None
|
||||
|
||||
from wlauto.exceptions import HostError
|
||||
|
||||
|
||||
class StateDefinitionError(RuntimeError):
|
||||
pass
|
||||
@@ -58,10 +60,14 @@ def auto_canny(image, sigma=0.33):
|
||||
return edged
|
||||
|
||||
|
||||
def check_match_state_dependencies():
|
||||
if np is None or cv2 is None or imutils is None:
|
||||
raise HostError("State detection requires numpy, opencv (cv2) and imutils.")
|
||||
|
||||
|
||||
def match_state(screenshot_file, defpath, state_definitions): # pylint: disable=too-many-locals
|
||||
# check dependencies
|
||||
if np is None or cv2 is None or imutils is None:
|
||||
raise RuntimeError("State detection requires numpy, opencv (cv2) and imutils.")
|
||||
check_match_state_dependencies()
|
||||
|
||||
# check if file exists, then load screenshot into opencv and create edge map
|
||||
if not os.path.isfile(screenshot_file):
|
||||
|
||||
Reference in New Issue
Block a user