影像區域選擇器
「影像區域選擇器」提供了從系統相機膠卷與主目錄選擇截圖,並在截圖上標注一個矩形區域,以取得其頂點與尺寸的能力。
「影像區域選擇器」類型為 rect,其回傳值為 包含四個數值的陣列,這四個數值分別為矩形區域左上角頂點的 x 座標和 y 座標、右下角頂點的 x 座標和 y 座標,如:
{ 0, 534, 295, 626 }
範例
local group, name
group = '图色'
name = 'text = screen.ocr_text(rect)'
return {
name = string.format('%s - %s', group, name),
description = "屏幕区域文字识别",
arguments = {
{type = 'rect'},
},
generator = function(rect)
return string.format('text = screen.ocr_text(%d, %d, %d, %d)', rect[1], rect[2], rect[3], rect[4])
end,
}