|
|
|
об изображениях, найти положение изображения |
|
|
Pinador |
23.7.2023, 4:02
|
Neophyte
Сообщений: 10
Регистрация: 1.10.2022 Группа: Пользователи Наличность: 0
Пользователь №: 20.354
Возраст: 32
|
Я пользуюсь переводчиком, поэтому не знаю, правильно ли написано... извините за что-нибудь I'm using the translator, so I don't know if it's spelled right... sorry for anything
Привет, я пытаюсь придумать скрипт, чтобы найти изображение в определенном месте на экране, и, когда я нахожу это изображение, я хотел бы получить его координаты или просто щелкнуть по нему... например: от х = 90 до х = 600, у = 20 до у = 180 давайте предположим, что это изображение с размером 30x30 и имеет x = 300, y = 100 каким-то образом он будет храниться в переменной, или я мог бы просто щелкнуть левой кнопкой мыши там, где я его нашел...
Возможно ли это сделать в uopilot? Если кто-нибудь знает, вы можете мне помочь, пожалуйста?
Hello, I'm trying to think of a script to find an image in a certain space on the screen and, when I find this image, I would like to get its coordinates or simply click on it... for example: from x = 90 to x = 600, y = 20 to y = 180 let's assume it is an img with 30x30 and is at x = 300, y = 100 somehow it would store in a variable or I could simply Left click where I found it...
Is this possible to do in uopilot? If anyone knows can you help me please?
|
|
|
|
Cockney |
23.7.2023, 13:56
|
Master
Сообщений: 1.395
Регистрация: 22.6.2013 Группа: Пользователи Наличность: 21064
Пользователь №: 16.156
|
see first example https://uopilot.uokit.com/wiki/index.php?ti...Findimage_(Lua)Код --lua local startX, startY, endX, endY = 0, 0, 1920, 1080 -- координаты поиска local path = [["C:\картинка.bmp"]] -- путь к картинке, bmp 24 бита local arr, a = findimage (startX, startY, endX, endY, {path}, 2) -- поиск картинки hint (a) -- результат поиска, подсказка в правом нижнем углу if arr then -- если найдена log ("Изображение найдено в координатах X= " .. arr[1][1] .. " Y= " .. arr[1][2]) kleft (arr[1][1], arr[1][2]) -- кликнули end -- в результате работы, если в заданной области картинка обнаружена, в массив %arr[1][1] будет записано значение координаты X -- а в %arr[1][2] - значение координаты Y
|
|
|
|
Pinador |
23.7.2023, 17:35
|
Neophyte
Сообщений: 10
Регистрация: 1.10.2022 Группа: Пользователи Наличность: 0
Пользователь №: 20.354
Возраст: 32
|
Цитата(Cockney @ 23.7.2023, 13:56) log ("Изображение найдено в координатах X= " .. arr[1][1] .. " Y= " .. arr[1][2])
Я не понял, что я должен заменить здесь, не могли бы вы мне помочь? I didn't understand what I should replace here, could you help me? --lua local startX, startY, endX, endY = 514, 121, 1353, 563 local path = [["C:\Users\nauan\Saved Games\Uopilot\Bootcamp\energy_left.bmp"]] local arr, a = findimage (startX, startY, endX, endY, {path}, 2) hint (a) if arr then log ("??????????? ??????? ? ??????????? X= " .. arr[1][1] .. " Y= " .. arr[1][2]) kleft (arr[1][1], arr[1][2]) end в этом случае я указал начальную и конечную позиции и заменил местоположение изображения, все в порядке? однако внизу было "Изображение найдено в координатах X= " Я не знал, что поставить. in this case, I put the start and end positions there, and replace the image location, was that all right? however at the bottom it was "Изображение найдено в координатах X= " I didn't know what to put. а когда запускаю скрипт, он уже выдавал ошибку, что не распознает "локальную" команду and when I put the script to run, it already gave an error that it does not recognize the "local" command
|
|
|
|
Cockney |
24.7.2023, 23:18
|
Master
Сообщений: 1.395
Регистрация: 22.6.2013 Группа: Пользователи Наличность: 21064
Пользователь №: 16.156
|
Код log ("??????????? ??????? ? ??????????? X= " .. arr[1][1] .. " Y= " .. arr[1][2]) this line may be useful for testing your script, but it's not required Код kleft (arr[1][1], arr[1][2]) this line doing click on the found image coordinates. you may to use kleft, left, etc functions from listЦитата in this case, I put the start and end positions there, and replace the image location, was that all right? however at the bottom it was "Изображение найдено в координатах X= " I didn't know what to put. fine ! uopilot found your image on the screen and made click on it (kleft function call) Цитата and when I put the script to run, it already gave an error that it does not recognize the "local" command can you provide a screenshot of the uopilot window and the log window at the time of the error ?
|
|
|
|
Pinador |
25.7.2023, 0:23
|
Neophyte
Сообщений: 10
Регистрация: 1.10.2022 Группа: Пользователи Наличность: 0
Пользователь №: 20.354
Возраст: 32
|
эта ошибка происходит this error is happening
local - Unrecognized command: local
Я не знаю, как использовать этот код.... не могли бы вы отправить его мне, пожалуйста? I don't know how to use this code.... could you send it to me please?
local startX, startY, endX, endY = 514, 121, 1353, 563 local path = [["C:\Users\nauan\Saved Games\Uopilot\Bootcamp\energy_left.bmp"]] local arr, a = findimage (startX, startY, endX, endY, {path}, 2) hint (a) if arr then kleft (arr[1][1], arr[1][2]) end
Эскизы прикрепленных изображений
|
|
|
|
Pinador |
25.7.2023, 5:39
|
Neophyte
Сообщений: 10
Регистрация: 1.10.2022 Группа: Пользователи Наличность: 0
Пользователь №: 20.354
Возраст: 32
|
Цитата(nykep @ 25.7.2023, 1:41) tracking function does not work on lua syntax
Итак, как мне получить позицию изображения? So how would I get the position of an image?
|
|
|
|
nykep |
25.7.2023, 14:11
|
Apprentice
Сообщений: 233
Регистрация: 1.9.2012 Группа: Пользователи Наличность: 1213
Пользователь №: 15.246
Возраст: 25
|
Код -lua local startX, startY, endX, endY = 514, 121, 1353, 563 local path = [["C:\Users\nauan\Saved Games\Uopilot\Bootcamp\energy_left.bmp"]] local arr, a = findimage (startX, startY, endX, endY, {path}, 2, 80, 1, 10) -- 80 - accuracy, 1 - count of images, - 10 deviation of color if arr then -- if image was found then X = arr[1][1], Y = arr[1][2] - coordinates of the upper left corner of the image move (arr[1][1], arr[1][2]) -- move cursor on X, Y end
|
|
|
|
Pinador |
26.7.2023, 3:29
|
Neophyte
Сообщений: 10
Регистрация: 1.10.2022 Группа: Пользователи Наличность: 0
Пользователь №: 20.354
Возраст: 32
|
Цитата(nykep @ 25.7.2023, 14:11) Код -lua local startX, startY, endX, endY = 514, 121, 1353, 563 local path = [["C:\Users\nauan\Saved Games\Uopilot\Bootcamp\energy_left.bmp"]] local arr, a = findimage (startX, startY, endX, endY, {path}, 2, 80, 1, 10) -- 80 - accuracy, 1 - count of images, - 10 deviation of color if arr then -- if image was found then X = arr[1][1], Y = arr[1][2] - coordinates of the upper left corner of the image move (arr[1][1], arr[1][2]) -- move cursor on X, Y end
не работает does not work он просто сидит на первой и последней строке... it just sits on the first and last line...
|
|
|
|
|
|
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0
|
|