Added Live Screenshot data functionality
This commit is contained in:
@ -35,7 +35,6 @@ regions = {}
|
||||
|
||||
app_instance = None
|
||||
|
||||
|
||||
def _ensure_qapplication():
|
||||
"""
|
||||
Ensures that QApplication is initialized before creating widgets.
|
||||
@ -45,6 +44,15 @@ def _ensure_qapplication():
|
||||
if app_instance is None:
|
||||
app_instance = QApplication(sys.argv) # Start in main thread
|
||||
|
||||
def capture_region_as_image(region_id):
|
||||
collector_mutex.lock()
|
||||
if region_id not in regions:
|
||||
collector_mutex.unlock()
|
||||
return None
|
||||
x, y, w, h = regions[region_id]['bbox'][:]
|
||||
collector_mutex.unlock()
|
||||
screenshot = ImageGrab.grab(bbox=(x, y, x + w, y + h))
|
||||
return screenshot
|
||||
|
||||
def create_ocr_region(region_id, x=250, y=50, w=DEFAULT_WIDTH, h=DEFAULT_HEIGHT, color=(255, 255, 0), thickness=2):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user