{"id":343344,"date":"2022-12-30T09:00:25","date_gmt":"2022-12-30T09:00:25","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=343344"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=343344","title":{"rendered":"<span>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Computer Vision \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u20ac6,147,455 \u0437\u0430 \u043d\u043e\u0447\u044c \u0432\u043e \u0432\u043d\u0443\u0442\u0440\u0438\u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u0432\u0430\u043b\u044e\u0442\u0435<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 10 \u043b\u0435\u0442 \u044f \u0438\u0433\u0440\u0430\u043b \u0432 \u0442\u0430\u043a\u0438\u0435 \u0438\u0433\u0440\u044b, \u043a\u0430\u043a TownsMen 6, Clash of the Clans, SimCity \u0438 \u043c\u043e\u044e \u043b\u044e\u0431\u0438\u043c\u0443\u044e OpenTTD (\u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c!).<\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0432 City Island 5, \u044f \u0431\u044b\u043b \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0435\u043d \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u044b \u043d\u0435 \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u043b\u0438\u0441\u044c, \u043f\u043e\u043a\u0430 \u044f \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0441\u044f \u0432\u043d\u0435 \u0438\u0433\u0440\u044b. \u0423 \u043c\u0435\u043d\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439 \u0431\u0438\u0437\u043d\u0435\u0441, \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0438 \u0442.\u0434., \u043d\u043e \u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 \u0438\u0433\u0440\u0435, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0441\u0431\u043e\u0440 \u0434\u0435\u043d\u0435\u0433\/\u043a\u043b\u044e\u0447\u0435\u0439\/\u0437\u043e\u043b\u043e\u0442\u0430 \u0441 \u0442\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043c\u043e\u044f \u043f\u0435\u043a\u0430\u0440\u043d\u044f \u0437\u0430\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 100 \u0435\u0432\u0440\u043e \u0432 \u043c\u0438\u043d\u0443\u0442\u0443, \u044f \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u044e 100 \u0435\u0432\u0440\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b\u0439\u0434\u0443 \u0438\u0437 \u0438\u0433\u0440\u044b \u0438 \u0432\u0435\u0440\u043d\u0443\u0441\u044c \u0447\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430.<\/p>\n<p>\u042d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u043a\u043e\u0433\u0434\u0430 \u044f \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u044c \u20ac5 000 000, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u043a\u0443\u043f\u043a\u0438 \u043e\u0441\u0442\u0440\u043e\u0432\u0430, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0438\u0436\u0435. \u042d\u0442\u043e \u0437\u0430\u0439\u043c\u0435\u0442 \u0443 \u043c\u0435\u043d\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0434\u0432\u0435 \u043d\u0435\u0434\u0435\u043b\u0438 \u0438\u0433\u0440\u044b, \u0435\u0441\u043b\u0438 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0434\u0435\u043d\u044c\u0433\u0438 &#8212; \u043e\u043d\u043e \u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/818\/38e\/963\/81838e963b7f3fb33efa987fd85ae9b4.png\" width=\"1990\" height=\"1464\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/818\/38e\/963\/81838e963b7f3fb33efa987fd85ae9b4.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 Python \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u043c\u0435\u043d\u044f<\/h2>\n<p>\u042d\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>a. \u0417\u0430\u0445\u0432\u0430\u0442 \u0444\u0440\u0435\u0439\u043c\u043e\u0432 \u0438\u0433\u0440\u044b<\/strong><\/p>\n<p>\u041c\u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u044b\u043b \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u0445\u0432\u0430\u0442\u0430 \u0444\u0440\u0435\u0439\u043c\u043e\u0432 \u0438\u0433\u0440\u044b \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>\u041f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043d\u0438\u043c\u043e\u043a \u044d\u043a\u0440\u0430\u043d\u0430 \u0432 \u0438\u0433\u0440\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f.<\/p>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/paulonteri.com\/thoughts\/play-game-with-computer-vision#:~:text=I%20use%20the-,Python%20MSS,-library.%20It%27s%20a\" rel=\"noopener noreferrer nofollow\">Python MSS<\/a>. \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0444\u0430\u0439\u043b. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0435\u0433\u043e <a href=\"https:\/\/python-mss.readthedocs.io\/api.html#mss.tools.mss.base.MSSBase.monitors\" rel=\"noopener noreferrer nofollow\">\u0441\u0432\u043e\u0439\u0441\u0442\u0432<\/a>, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0448\u0438\u0440\u0438\u043d\u0430 \u0438 \u0432\u044b\u0441\u043e\u0442\u0430.<\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/docs.opencv.org\/4.x\/\" rel=\"noopener noreferrer nofollow\">OpenCv<\/a> (cv2) \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0439 \u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u043c \u0437\u0440\u0435\u043d\u0438\u0435\u043c. \u042d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <em>cv2.imread()<\/em> \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"python\">import cv2  import mss  sct = mss.mss()  default_monitor = sct.monitors[1]  def click_template_image(monitor=default_monitor):      # Screenshot     game_screenshot_path = \"sct_{width}x{height}.png\".format(**monitor)     sct_img = sct.grab((0, 0, monitor[\"width\"], monitor[\"height\"]))     mss.tools.to_png(sct_img.rgb, sct_img.size, output=game_screenshot_path)      game_screenshot = cv2.imread(game_screenshot_path, 1)<\/code><\/pre>\n<h4>b. \u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435<\/h4>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0438\u0433\u0440\u044b \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b.<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b OpenCv TemplateMatching \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e.<\/p>\n<p>\u041e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0446\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430) \u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0444\u0438\u0434\u0435 \u0438\u0433\u0440\u044b). OpenCV \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043d\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (\u043a\u0430\u043a \u0432 2D-\u0441\u0432\u0435\u0440\u0442\u043a\u0435) \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0438 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0430. \u0412 OpenCV \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f. (\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/docs.opencv.org\/4.x\/d4\/dc6\/tutorial_py_template_matching.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>). \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435: <em>cv2.matchTemplate(&#8230; ).<\/em><\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u042f \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u0440\u0435\u0437\u0430\u043b \u043a\u0435\u0448, \u0437\u0432\u0435\u0437\u0434\u0443 \u0438 \u043a\u043b\u044e\u0447:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c8b\/15e\/a91\/c8b15ea918cfd5f301c4c2cc8110bc90.png\" width=\"64\" height=\"39\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c8b\/15e\/a91\/c8b15ea918cfd5f301c4c2cc8110bc90.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cd3\/9f9\/20c\/cd39f920cc70408a6d1af0ae75e4f623.png\" width=\"63\" height=\"39\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cd3\/9f9\/20c\/cd39f920cc70408a6d1af0ae75e4f623.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/eed\/634\/9f6\/eed6349f6e8d02068cfb6d840d2d25c1.png\" width=\"63\" height=\"39\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/eed\/634\/9f6\/eed6349f6e8d02068cfb6d840d2d25c1.png\"\/><figcaption><\/figcaption><\/figure>\n<p> \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043d\u0438\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434\u0430 \u043c\u044b \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u043c \u043a\u0435\u0448.<\/p>\n<pre><code class=\"python\">import cv2 import mss import numpy as np  sct = mss.mss() default_monitor = sct.monitors[1]  def click_template_image(monitor=default_monitor):      # 1. Screenshot     game_screenshot_path = \"sct_{width}x{height}.png\".format(**monitor)     sct_img = sct.grab((0, 0, monitor[\"width\"], monitor[\"height\"]))     mss.tools.to_png(sct_img.rgb, sct_img.size, output=game_screenshot_path)     game_screenshot = cv2.imread(game_screenshot_path, 1)       # 2. Find a way to identify the valuables in the screenshot     template_image = cv2.imread(\"images\/cash.png\", 1)      search_result = cv2.matchTemplate(game_screenshot, template_image, cv2.TM_CCOEFF_NORMED)      y_coords, x_coords = np.where(search_result >= threshold)      for idx in range(len(x_coords)):         x, y = x_coords[idx], y_coords[idx]  <\/code><\/pre>\n<p><strong>c. \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043a\u043b\u0438\u043a\u043e\u043c<\/strong><\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u043e \u043d\u0435\u043c\u0443.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <em>pyautogui.click(x,y)<\/em> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u041e\u043d\u0430 \u0449\u0435\u043b\u043a\u0430\u0435\u0442 \u043f\u043e \u044d\u043a\u0440\u0430\u043d\u0443 \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c x,y. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043d\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c <a href=\"https:\/\/pyautogui.readthedocs.io\/en\/latest\/mouse.html#mouse-clicks\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>\u041c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0440\u043e\u0433\u0443 \u0434\u043e\u0432\u0435\u0440\u0438\u044f. \u041f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 &#8212; \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u043e\u0442 0 \u0434\u043e 1, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0435\u0440\u0435\u043d \u0438 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0434\u043e\u0432\u0435\u0440\u0438\u044f \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 0,7 \u0438\u043b\u0438 \u0432\u044b\u0448\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c matchTemplate() \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u0435\u043a \u043d\u0430 \u043a\u0430\u0440\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0430\u0448\u0435\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443. \u0417\u0430\u0442\u0435\u043c \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0447\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0438\u0436\u0435 \u043f\u043e\u0440\u043e\u0433\u0430: <em>y_coords, x_coords = np.where(search_result >= threshold).<\/em><\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0431 \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u0430\u0440\u0442\u0443 \u0437\u0430 \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0443\u0441\u043a \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u0438 \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044f\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0449\u0435\u043b\u043a\u043d\u0443\u0442\u044c \u043d\u0430 \u0434\u0432\u0438\u0436\u0443\u0449\u0435\u043c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0435, \u043e\u043d \u043c\u043e\u0433 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u043c\u0435\u0441\u0442\u0430. \u042f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0449\u0435\u043b\u0447\u043a\u043e\u0432 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>click_template_image()<\/em> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>number_of_clicks<\/em> \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0449\u0435\u043b\u0447\u043a\u0435 \u0437\u0430 \u0448\u0430\u0433.<\/p>\n<\/li>\n<li>\n<p>\u042f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0449\u0435\u043b\u0447\u043e\u043a \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0449\u0435\u043b\u0447\u043e\u043a \u043f\u043e \u043b\u0435\u0432\u043e\u043c\u0443 \u0432\u0435\u0440\u0445\u043d\u0435\u043c\u0443 \u043a\u0440\u0430\u044e, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u0434\u0430\u043b\u0430 \u043d\u0430\u0448\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u0438 \u0448\u0438\u0440\u0438\u043d\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0446\u0435\u043d\u0442\u0440\u0430: <em>x_c = int((x + x + w) \/\/ 2) &amp; y_c = int((y + y + h) \/\/ 2)<\/em><\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">import cv2 import mss import numpy as np import pyautogui  pyautogui.FAILSAFE = False  sct = mss.mss() default_monitor = sct.monitors[1]  def click_template_image(monitor=default_monitor, number_of_clicks=1, threshold=0.7):      # 1. Screenshot     game_screenshot_path = \"sct_{width}x{height}.png\".format(**monitor)     sct_img = sct.grab((0, 0, monitor[\"width\"], monitor[\"height\"]))     mss.tools.to_png(sct_img.rgb, sct_img.size, output=game_screenshot_path)     game_screenshot = cv2.imread(game_screenshot_path, 1)      # 2. Find a way to identify the valuables in the screenshot     template_image = cv2.imread(\"images\/cash.png\", 1)     search_result = cv2.matchTemplate(game_screenshot, template_image, cv2.TM_CCOEFF_NORMED)     y_coords, x_coords = np.where(search_result >= threshold)      # get the width and height of the template image     w, h = template_image.shape[1], template_image.shape[0]     for idx in range(number_of_clicks):         if idx + 1 > len(x_coords):             continue         x, y = x_coords[idx], y_coords[idx]          # 3. Collect the valuables by clicking on them         # get centres         x_c = int((x + x + w) \/\/ 2)         y_c = int((y + y + h) \/\/ 2)          pyautogui.click(x=x_c, y=y_c)<\/code><\/pre>\n<p><strong>d. \u0417\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043e\u043a\u043d\u0430<\/strong><\/p>\n<p>\u041d\u0430\u0448\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u0432\u044b\u0448\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044e \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043e\u043a\u043e\u043d, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0433\u0440\u0430\u0434\u0443, \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u043c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438 \u0442.\u0434.<\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u043e\u043a\u043d\u043e, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0443 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0443, \u0447\u0442\u043e \u0438 \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u0446\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u0449\u0438.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043a\u043d\u043e\u043f\u043e\u043a \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043e\u043a\u043e\u043d, \u0447\u0442\u043e\u0431\u044b \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u0436\u0430\u0442\u044c. \u042f \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u0440\u0435\u0437\u0430\u043b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c47\/f69\/abd\/c47f69abddf017ae15276a273649684f.png\" width=\"210\" height=\"210\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c47\/f69\/abd\/c47f69abddf017ae15276a273649684f.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u0434, \u0447\u0442\u043e \u0432\u044b\u0448\u0435.<\/p>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430 \u043d\u043e\u0447\u044c<\/h2>\n<p>\u042f \u043d\u0430\u0447\u0430\u043b \u0438\u0433\u0440\u0443 \u0441 \u20ac316,415 \u0432 \u043a\u0430\u0440\u043c\u0430\u043d\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5d5\/590\/957\/5d55909573ecd966033b255b52d049d0.png\" width=\"3360\" height=\"2100\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5d5\/590\/957\/5d55909573ecd966033b255b52d049d0.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0443\u0442\u0440\u043e \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e \u20ac6,463,870.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8eb\/762\/d67\/8eb762d674eb6e17c94918287452d6fc.png\" width=\"3360\" height=\"2100\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8eb\/762\/d67\/8eb762d674eb6e17c94918287452d6fc.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u044f \u0441\u043c\u043e\u0433 \u043a\u0443\u043f\u0438\u0442\u044c \u0442\u043e\u0442 \u043e\u0441\u0442\u0440\u043e\u0432, \u0447\u0442\u043e \u044f \u0445\u043e\u0442\u0435\u043b<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c04\/e55\/d6a\/c04e55d6a5736a633658c0f4c2c5131e.png\" width=\"3360\" height=\"2100\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c04\/e55\/d6a\/c04e55d6a5736a633658c0f4c2c5131e.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435-\u0442\u043e \u044d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0438\u0442\u044b, \u043d\u043e \u0442\u0430\u043a \u043b\u0438 \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435?<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0430\u0432\u0442\u043e\u0440\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e <a href=\"https:\/\/github.com\/paulonteri\/play-game-with-computer-vision\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<p>\u0415\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ML \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u00a0<a href=\"https:\/\/t.me\/dat2art\" rel=\"noopener noreferrer nofollow\"><strong>\u043c\u043e\u0435\u043c \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043a\u0430\u043d\u0430\u043b\u0435<\/strong><\/a>. \u042f \u043f\u0438\u0448\u0443 \u043f\u0440\u043e ML, \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u044b \u0438 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u044e \u0432 UK \u0434\u043b\u044f IT \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/708618\/\"> https:\/\/habr.com\/ru\/post\/708618\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 10 \u043b\u0435\u0442 \u044f \u0438\u0433\u0440\u0430\u043b \u0432 \u0442\u0430\u043a\u0438\u0435 \u0438\u0433\u0440\u044b, \u043a\u0430\u043a TownsMen 6, Clash of the Clans, SimCity \u0438 \u043c\u043e\u044e \u043b\u044e\u0431\u0438\u043c\u0443\u044e OpenTTD (\u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c!).<\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0432 City Island 5, \u044f \u0431\u044b\u043b \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0435\u043d \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u044b \u043d\u0435 \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u043b\u0438\u0441\u044c, \u043f\u043e\u043a\u0430 \u044f \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0441\u044f \u0432\u043d\u0435 \u0438\u0433\u0440\u044b. \u0423 \u043c\u0435\u043d\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439 \u0431\u0438\u0437\u043d\u0435\u0441, \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u0438 \u0442.\u0434., \u043d\u043e \u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 \u0438\u0433\u0440\u0435, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0441\u0431\u043e\u0440 \u0434\u0435\u043d\u0435\u0433\/\u043a\u043b\u044e\u0447\u0435\u0439\/\u0437\u043e\u043b\u043e\u0442\u0430 \u0441 \u0442\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043c\u043e\u044f \u043f\u0435\u043a\u0430\u0440\u043d\u044f \u0437\u0430\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 100 \u0435\u0432\u0440\u043e \u0432 \u043c\u0438\u043d\u0443\u0442\u0443, \u044f \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u044e 100 \u0435\u0432\u0440\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b\u0439\u0434\u0443 \u0438\u0437 \u0438\u0433\u0440\u044b \u0438 \u0432\u0435\u0440\u043d\u0443\u0441\u044c \u0447\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430.<\/p>\n<p>\u042d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u043a\u043e\u0433\u0434\u0430 \u044f \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u044c \u20ac5 000 000, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u043a\u0443\u043f\u043a\u0438 \u043e\u0441\u0442\u0440\u043e\u0432\u0430, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0438\u0436\u0435. \u042d\u0442\u043e \u0437\u0430\u0439\u043c\u0435\u0442 \u0443 \u043c\u0435\u043d\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0434\u0432\u0435 \u043d\u0435\u0434\u0435\u043b\u0438 \u0438\u0433\u0440\u044b, \u0435\u0441\u043b\u0438 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0434\u0435\u043d\u044c\u0433\u0438 &#8212; \u043e\u043d\u043e \u0442\u043e\u0433\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442!<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 Python \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u043c\u0435\u043d\u044f<\/h2>\n<p>\u042d\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>a. \u0417\u0430\u0445\u0432\u0430\u0442 \u0444\u0440\u0435\u0439\u043c\u043e\u0432 \u0438\u0433\u0440\u044b<\/strong><\/p>\n<p>\u041c\u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u044b\u043b \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u0445\u0432\u0430\u0442\u0430 \u0444\u0440\u0435\u0439\u043c\u043e\u0432 \u0438\u0433\u0440\u044b \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>\u041f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043d\u0438\u043c\u043e\u043a \u044d\u043a\u0440\u0430\u043d\u0430 \u0432 \u0438\u0433\u0440\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f.<\/p>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/paulonteri.com\/thoughts\/play-game-with-computer-vision#:~:text=I%20use%20the-,Python%20MSS,-library.%20It%27s%20a\" rel=\"noopener noreferrer nofollow\">Python MSS<\/a>. \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u044d\u043a\u0440\u0430\u043d \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0444\u0430\u0439\u043b. \u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0435\u0433\u043e <a href=\"https:\/\/python-mss.readthedocs.io\/api.html#mss.tools.mss.base.MSSBase.monitors\" rel=\"noopener noreferrer nofollow\">\u0441\u0432\u043e\u0439\u0441\u0442\u0432<\/a>, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0448\u0438\u0440\u0438\u043d\u0430 \u0438 \u0432\u044b\u0441\u043e\u0442\u0430.<\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/docs.opencv.org\/4.x\/\" rel=\"noopener noreferrer nofollow\">OpenCv<\/a> (cv2) \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u0438 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0439 \u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u043c \u0437\u0440\u0435\u043d\u0438\u0435\u043c. \u042d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <em>cv2.imread()<\/em> \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"python\">import cv2  import mss  sct = mss.mss()  default_monitor = sct.monitors[1]  def click_template_image(monitor=default_monitor):      # Screenshot     game_screenshot_path = \"sct_{width}x{height}.png\".format(**monitor)     sct_img = sct.grab((0, 0, monitor[\"width\"], monitor[\"height\"]))     mss.tools.to_png(sct_img.rgb, sct_img.size, output=game_screenshot_path)      game_screenshot = cv2.imread(game_screenshot_path, 1)<\/code><\/pre>\n<h4>b. \u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435<\/h4>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0438\u0433\u0440\u044b \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b.<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b OpenCv TemplateMatching \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e.<\/p>\n<p>\u041e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0446\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430) \u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0444\u0438\u0434\u0435 \u0438\u0433\u0440\u044b). OpenCV \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043d\u0430 \u0432\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (\u043a\u0430\u043a \u0432 2D-\u0441\u0432\u0435\u0440\u0442\u043a\u0435) \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0438 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0430. \u0412 OpenCV \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f. (\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/docs.opencv.org\/4.x\/d4\/dc6\/tutorial_py_template_matching.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>). \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435: <em>cv2.matchTemplate(&#8230; ).<\/em><\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u042f \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u0440\u0435\u0437\u0430\u043b \u043a\u0435\u0448, \u0437\u0432\u0435\u0437\u0434\u0443 \u0438 \u043a\u043b\u044e\u0447:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p> \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043d\u0438\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434\u0430 \u043c\u044b \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u043c \u043a\u0435\u0448.<\/p>\n<pre><code class=\"python\">import cv2 import mss import numpy as np  sct = mss.mss() default_monitor = sct.monitors[1]  def click_template_image(monitor=default_monitor):      # 1. Screenshot     game_screenshot_path = \"sct_{width}x{height}.png\".format(**monitor)     sct_img = sct.grab((0, 0, monitor[\"width\"], monitor[\"height\"]))     mss.tools.to_png(sct_img.rgb, sct_img.size, output=game_screenshot_path)     game_screenshot = cv2.imread(game_screenshot_path, 1)       # 2. Find a way to identify the valuables in the screenshot     template_image = cv2.imread(\"images\/cash.png\", 1)      search_result = cv2.matchTemplate(game_screenshot, template_image, cv2.TM_CCOEFF_NORMED)      y_coords, x_coords = np.where(search_result >= threshold)      for idx in range(len(x_coords)):         x, y = x_coords[idx], y_coords[idx]  <\/code><\/pre>\n<p><strong>c. \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043a\u043b\u0438\u043a\u043e\u043c<\/strong><\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u043e \u043d\u0435\u043c\u0443.<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <em>pyautogui.click(x,y)<\/em> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e. \u041e\u043d\u0430 \u0449\u0435\u043b\u043a\u0430\u0435\u0442 \u043f\u043e \u044d\u043a\u0440\u0430\u043d\u0443 \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c x,y. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043d\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c <a href=\"https:\/\/pyautogui.readthedocs.io\/en\/latest\/mouse.html#mouse-clicks\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>\u041c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0440\u043e\u0433\u0443 \u0434\u043e\u0432\u0435\u0440\u0438\u044f. \u041f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438 &#8212; \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u043e\u0442 0 \u0434\u043e 1, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u0435\u0440\u0435\u043d \u0438 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0434\u043e\u0432\u0435\u0440\u0438\u044f \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 0,7 \u0438\u043b\u0438 \u0432\u044b\u0448\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c matchTemplate() \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u0435\u043a \u043d\u0430 \u043a\u0430\u0440\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0430\u0448\u0435\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443. \u0417\u0430\u0442\u0435\u043c \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0447\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0438\u0436\u0435 \u043f\u043e\u0440\u043e\u0433\u0430: <em>y_coords, x_coords = np.where(search_result >= threshold).<\/em><\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0431 \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043d\u0430 \u043a\u0430\u0440\u0442\u0443 \u0437\u0430 \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0443\u0441\u043a \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u0438 \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044f\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0449\u0435\u043b\u043a\u043d\u0443\u0442\u044c \u043d\u0430 \u0434\u0432\u0438\u0436\u0443\u0449\u0435\u043c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0435, \u043e\u043d \u043c\u043e\u0433 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u043c\u0435\u0441\u0442\u0430. \u042f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0449\u0435\u043b\u0447\u043a\u043e\u0432 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>click_template_image()<\/em> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>number_of_clicks<\/em> \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0449\u0435\u043b\u0447\u043a\u0435 \u0437\u0430 \u0448\u0430\u0433.<\/p>\n<\/li>\n<li>\n<p>\u042f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0449\u0435\u043b\u0447\u043e\u043a \u043f\u043e \u0446\u0435\u043d\u0442\u0440\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0449\u0435\u043b\u0447\u043e\u043a \u043f\u043e \u043b\u0435\u0432\u043e\u043c\u0443 \u0432\u0435\u0440\u0445\u043d\u0435\u043c\u0443 \u043a\u0440\u0430\u044e, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u0434\u0430\u043b\u0430 \u043d\u0430\u0448\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u0438 \u0448\u0438\u0440\u0438\u043d\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0446\u0435\u043d\u0442\u0440\u0430: <em>x_c = int((x + x + w) \/\/ 2) &amp; y_c = int((y + y + h) \/\/ 2)<\/em><\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">import cv2 import mss import numpy as np import pyautogui  pyautogui.FAILSAFE = False  sct = mss.mss() default_monitor = sct.monitors[1]  def click_template_image(monitor=default_monitor, number_of_clicks=1, threshold=0.7):      # 1. Screenshot     game_screenshot_path = \"sct_{width}x{height}.png\".format(**monitor)     sct_img = sct.grab((0, 0, monitor[\"width\"], monitor[\"height\"]))     mss.tools.to_png(sct_img.rgb, sct_img.size, output=game_screenshot_path)     game_screenshot = cv2.imread(game_screenshot_path, 1)      # 2. Find a way to identify the valuables in the screenshot     template_image = cv2.imread(\"images\/cash.png\", 1)     search_result = cv2.matchTemplate(game_screenshot, template_image, cv2.TM_CCOEFF_NORMED)     y_coords, x_coords = np.where(search_result >= threshold)      # get the width and height of the template image     w, h = template_image.shape[1], template_image.shape[0]     for idx in range(number_of_clicks):         if idx + 1 > len(x_coords):             continue         x, y = x_coords[idx], y_coords[idx]          # 3. Collect the valuables by clicking on them         # get centres         x_c = int((x + x + w) \/\/ 2)         y_c = int((y + y + h) \/\/ 2)          pyautogui.click(x=x_c, y=y_c)<\/code><\/pre>\n<p><strong>d. \u0417\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043e\u043a\u043d\u0430<\/strong><\/p>\n<p>\u041d\u0430\u0448\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u0432\u044b\u0448\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044e \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043e\u043a\u043e\u043d, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0433\u0440\u0430\u0434\u0443, \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u043c \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438 \u0442.\u0434.<\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u043e\u043a\u043d\u043e, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u0438. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u0443 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0443, \u0447\u0442\u043e \u0438 \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u0446\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u0449\u0438.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043a\u043d\u043e\u043f\u043e\u043a \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043e\u043a\u043e\u043d, \u0447\u0442\u043e\u0431\u044b \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u0436\u0430\u0442\u044c. \u042f \u0441\u0434\u0435\u043b\u0430\u043b \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u0440\u0435\u0437\u0430\u043b \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u0434, \u0447\u0442\u043e \u0432\u044b\u0448\u0435.<\/p>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430 \u043d\u043e\u0447\u044c<\/h2>\n<p>\u042f \u043d\u0430\u0447\u0430\u043b \u0438\u0433\u0440\u0443 \u0441 \u20ac316,415 \u0432 \u043a\u0430\u0440\u043c\u0430\u043d\u0435.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0443\u0442\u0440\u043e \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e \u20ac6,463,870.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u044f \u0441\u043c\u043e\u0433 \u043a\u0443\u043f\u0438\u0442\u044c \u0442\u043e\u0442 \u043e\u0441\u0442\u0440\u043e\u0432, \u0447\u0442\u043e \u044f \u0445\u043e\u0442\u0435\u043b<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435-\u0442\u043e \u044d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0438\u0442\u044b, \u043d\u043e \u0442\u0430\u043a \u043b\u0438 \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435?<\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0430\u0432\u0442\u043e\u0440\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e <a href=\"https:\/\/github.com\/paulonteri\/play-game-with-computer-vision\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<p>\u0415\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ML \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u00a0<a href=\"https:\/\/t.me\/dat2art\" rel=\"noopener noreferrer nofollow\"><strong>\u043c\u043e\u0435\u043c \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043a\u0430\u043d\u0430\u043b\u0435<\/strong><\/a>. \u042f \u043f\u0438\u0448\u0443 \u043f\u0440\u043e ML, \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u044b \u0438 \u0440\u0435\u043b\u043e\u043a\u0430\u0446\u0438\u044e \u0432 UK \u0434\u043b\u044f IT \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/708618\/\"> https:\/\/habr.com\/ru\/post\/708618\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-343344","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=343344"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343344\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}