{"id":4085,"date":"2025-02-16T10:41:33","date_gmt":"2025-02-16T01:41:33","guid":{"rendered":"https:\/\/ubun2m.com\/?p=4085"},"modified":"2025-02-16T11:19:31","modified_gmt":"2025-02-16T02:19:31","slug":"mac%e3%81%aeiphone%e3%83%9f%e3%83%a9%e3%83%bc%e3%83%aa%e3%83%b3%e3%82%b0%e6%a9%9f%e8%83%bd%e3%81%a7iphone%e3%82%a2%e3%83%97%e3%83%aa%e3%82%92%e8%87%aa%e5%8b%95%e6%93%8d%e4%bd%9c%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/ubun2m.com\/?p=4085","title":{"rendered":"Mac\u306eiPhone\u30df\u30e9\u30fc\u30ea\u30f3\u30b0\u6a5f\u80fd\u3067iPhone\u30a2\u30d7\u30ea\u3092\u81ea\u52d5\u64cd\u4f5c\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30b5\u30f3\u30d7\u30eb\u3010python\u3011"},"content":{"rendered":"\n<p>\u3000\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Python \u3068\u4e3b\u8981\u30e9\u30a4\u30d6\u30e9\u30ea\uff08OpenCV\u3001pyautogui\u3001NumPy\uff09\u3092\u5229\u7528\u3057\u3001\u6307\u5b9a\u753b\u50cf\u3092\u691c\u7d22\u3057\u3066\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u4ed8\u304d\u3067\u52d5\u4f5c\u3092\u5b9f\u884c\u3059\u308b\u4ed5\u7d44\u307f\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002MacOS\u306biPhone\u30df\u30e9\u30fc\u30ea\u30f3\u30b0\u6a5f\u80fd\u304c\u5b9f\u88c5\u3055\u308c\u305f\u3053\u3068\u306b\u3088\u308a\u3001iPhone\u30a2\u30d7\u30ea\u306e\u81ea\u52d5\u64cd\u4f5c\u304c\u7c21\u5358\u306b\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br>\u3000\u4f8b\u3048\u3070\u3001\u30b2\u30fc\u30e0\u30a2\u30d7\u30ea\u306e\u65e5\u8ab2\u3092\u3053\u306a\u3057\u305f\u308a\u3001\u30ea\u30bb\u30de\u30e9\u3092\u81ea\u52d5\u5316\u3067\u304d\u305f\u308a\u3068\u3001\u4f55\u304b\u3068\u3081\u3093\u3069\u304f\u3055\u3044\u4f5c\u696d\u3092\u81ea\u52d5\u5316\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"affiliate-box\"><div class=\"affiliate-containar\"><a href=\"https:\/\/amzn.to\/4jWxZqd\" rel=\"nofollow\"><img decoding=\"async\" style=\"border: none;\" src=\"https:\/\/m.media-amazon.com\/images\/I\/71wVar72dkL._AC_SX679_.jpg\" target=\"_blank\"><\/a><div class=\"affiliate-content\"><a href=\"https:\/\/amzn.to\/4jWxZqd\" rel=\"nofollow\">Apple 2024 MacBook Air<\/a><ul class=\"affiliate-button\"><li><a href=\"https:\/\/amzn.to\/4jWxZqd\" rel=\"nofollow\">Amazon<\/a><\/li><\/ul><\/div><\/div><\/div>\n\n\n\n<p>\u3000<\/p>\n\n\n\n<div class=\"affiliate-box\"><div class=\"affiliate-containar\"><a href=\"https:\/\/amzn.to\/3QgSkZU\" rel=\"nofollow\"><img decoding=\"async\" style=\"border: none;\" src=\"https:\/\/m.media-amazon.com\/images\/I\/61veAtnXzWL._AC_SX679_.jpg\" target=\"_blank\"><\/a><div class=\"affiliate-content\"><a href=\"https:\/\/amzn.to\/3QgSkZU\" rel=\"nofollow\">Apple iPhone 16 Pro Max (256 GB)<\/a><ul class=\"affiliate-button\"><li><a href=\"https:\/\/amzn.to\/3QgSkZU\" rel=\"nofollow\">Amazon<\/a><\/li><\/ul><\/div><\/div><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">1. \u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>OpenCV (cv2)<\/strong><br>\u753b\u50cf\u51e6\u7406\u30e9\u30a4\u30d6\u30e9\u30ea\u3002\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30de\u30c3\u30c1\u30f3\u30b0\u3092\u4f7f\u3063\u3066\u3001\u753b\u9762\u30ad\u30e3\u30d7\u30c1\u30e3\u5185\u304b\u3089\u6307\u5b9a\u753b\u50cf\u3092\u691c\u7d22\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>pip install opencv-python<\/code><\/pre><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>NumPy<\/strong><br>\u6570\u5024\u8a08\u7b97\u30e9\u30a4\u30d6\u30e9\u30ea\u3002\u753b\u50cf\u30c7\u30fc\u30bf\u3092\u6271\u3046\u969b\u306b\u5fc5\u8981\u3067\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>pip install numpy<\/code><\/pre><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>pyautogui<\/strong><br>\u753b\u9762\u30ad\u30e3\u30d7\u30c1\u30e3\u3001\u30de\u30a6\u30b9\u64cd\u4f5c\uff08\u30af\u30ea\u30c3\u30af\u3001\u30c9\u30e9\u30c3\u30b0\u306a\u3069\uff09\u3092\u81ea\u52d5\u5316\u3059\u308b\u305f\u3081\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>pip install pyautogui<\/code><\/pre><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>time, os<\/strong><br>Python \u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30ea\u3002\u30bf\u30a4\u30df\u30f3\u30b0\u5236\u5fa1\u3084\u30b7\u30b9\u30c6\u30e0\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">2. \u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306e\u6982\u8981<\/h2>\n\n\n\n<p>\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u6d41\u308c\u3067\u52d5\u4f5c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30a2\u30d7\u30ea\u306e\u30a2\u30af\u30c6\u30a3\u30d9\u30fc\u30c8<\/strong><br>Mac \u4e0a\u3067 AppleScript \u3092\u5229\u7528\u3057\u3066\u3001\u6307\u5b9a\u3057\u305f\u30a2\u30d7\u30ea\uff08iPhone \u30df\u30e9\u30fc\u30ea\u30f3\u30b0\uff09\u3092\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u753b\u9762\u30ad\u30e3\u30d7\u30c1\u30e3<\/strong><br>pyautogui \u3092\u4f7f\u3044\u3001\u73fe\u5728\u306e\u753b\u9762\u3092\u30ad\u30e3\u30d7\u30c1\u30e3\u3057\u3001\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u753b\u50cf\u691c\u7d22<\/strong><br>OpenCV \u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30de\u30c3\u30c1\u30f3\u30b0\u3092\u5229\u7528\u3057\u3066\u3001\u30ad\u30e3\u30d7\u30c1\u30e3\u753b\u50cf\u5185\u304b\u3089\u6307\u5b9a\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf\u3092\u63a2\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30a2\u30af\u30b7\u30e7\u30f3\u5b9f\u884c<\/strong><br>\u691c\u51fa\u3057\u305f\u5ea7\u6a19\u306b\u5bfe\u3057\u3066\u3001pyautogui \u306b\u3088\u308b\u30bf\u30c3\u30d7\uff08\u30af\u30ea\u30c3\u30af\uff09\u3084\u30b9\u30ef\u30a4\u30d7\uff08\u30c9\u30e9\u30c3\u30b0\uff09\u64cd\u4f5c\u3092\u884c\u3044\u307e\u3059\u3002<br>\u307e\u305f\u3001Retina \u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u306a\u3069\u3067\u30ad\u30e3\u30d7\u30c1\u30e3\u753b\u50cf\u3068\u5b9f\u969b\u306e\u5ea7\u6a19\u7cfb\u306e\u30b9\u30b1\u30fc\u30eb\u304c\u7570\u306a\u308b\u5834\u5408\u306b\u5099\u3048\u3001\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0\u8abf\u6574\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u4ed8\u304d\u753b\u50cf\u691c\u7d22<\/strong><br>\u6307\u5b9a\u753b\u50cf\u306e\u691c\u7d22\u306f\u3001\u4e00\u5b9a\u6642\u9593\u5185\uff08\u4f8b\uff1a10\u79d2\uff09\u306b\u898b\u3064\u304b\u3089\u306a\u3051\u308c\u3070 False \u3092\u8fd4\u3057\u3001\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u6642\u306e\u5206\u5c90\u51e6\u7406\u304c\u53ef\u80fd\u3067\u3059\u3002<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306f\u3001\u4e0a\u8a18\u306e\u5185\u5bb9\u3092\u5b9f\u88c5\u3057\u305f\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<br>\u203b IMG_DIR \u5185\u306b\u306f\u691c\u7d22\u3057\u305f\u3044\u753b\u50cf\u3092\u7528\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import numpy as np\nimport pyautogui\nimport time\nimport os\n\n# \u8a2d\u5b9a\u30d1\u30e9\u30e1\u30fc\u30bf\nIMG_DIR = &quot;.\/img&quot;              # \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\nMATCH_THRESHOLD = 0.8          # \u753b\u50cf\u4e00\u81f4\u306e\u95be\u5024\nCAPTURE_IMAGE = &quot;current_screen.png&quot;  # \u30ad\u30e3\u30d7\u30c1\u30e3\u753b\u50cf\u4fdd\u5b58\u5148\nSCALING = 2                    # \u30ad\u30e3\u30d7\u30c1\u30e3\u753b\u50cf\u3068\u5b9f\u969b\u306e\u5ea7\u6a19\u306e\u30b9\u30b1\u30fc\u30eb\u6bd4\uff08Retina\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u306e\u5834\u5408\u306f2\uff09\n\ndef capture_screen(save_path):\n    &quot;&quot;&quot;\n    \u73fe\u5728\u306e\u753b\u9762\u3092\u30ad\u30e3\u30d7\u30c1\u30e3\u3057\u3066\u3001\u6307\u5b9a\u30d1\u30b9\u306b\u4fdd\u5b58\u5f8c\u3001OpenCV\u5f62\u5f0f\u306e\u753b\u50cf\u3092\u8fd4\u3059\n    &quot;&quot;&quot;\n    screenshot = pyautogui.screenshot()\n    screenshot.save(save_path)\n    img = cv2.imread(save_path)\n    return img\n\ndef find_image(template_path, screen_img, threshold=MATCH_THRESHOLD):\n    &quot;&quot;&quot;\n    screen_img\u5185\u304b\u3089 template_path \u306e\u753b\u50cf\u3092\u63a2\u3057\u3001\u4e00\u81f4\u3057\u305f\u90e8\u5206\u306e\u4e2d\u5fc3\u5ea7\u6a19\u3092\u8fd4\u3059\u3002\n    \u4e00\u81f4\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306f None \u3092\u8fd4\u3059\u3002\n    &quot;&quot;&quot;\n    template = cv2.imread(template_path)\n    if template is None:\n        print(&quot;\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093:&quot;, template_path)\n        return None\n    res = cv2.matchTemplate(screen_img, template, cv2.TM_CCOEFF_NORMED)\n    loc = np.where(res &gt;= threshold)\n    try:\n        y = loc[0][0]\n        x = loc[1][0]\n        h, w = template.shape[:2]\n        center = (x + w \/\/ 2, y + h \/\/ 2)\n        return center\n    except IndexError:\n        return None\n\ndef find_image_ignore_color(template_path, screen_img, threshold=MATCH_THRESHOLD, use_edges=False):\n    &quot;&quot;&quot;\n    screen_img\u5185\u304b\u3089\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf(template_path)\u306e\u5f62\u72b6\u3092\u63a2\u3057\u3001\u4e2d\u5fc3\u5ea7\u6a19\u3092\u8fd4\u3059\u3002\n    \u8272\u306e\u5f71\u97ff\u3092\u6392\u9664\u3059\u308b\u305f\u3081\u3001\u30b0\u30ec\u30fc\u30b9\u30b1\u30fc\u30eb\u306b\u5909\u63db\u3057\u3066\u30de\u30c3\u30c1\u30f3\u30b0\u3092\u884c\u3046\u3002\n    use_edges \u304c True \u306e\u5834\u5408\u3001Canny \u30a8\u30c3\u30b8\u691c\u51fa\u3092\u9069\u7528\u3057\u3066\u5f62\u72b6\u60c5\u5831\u3092\u5f37\u8abf\u3059\u308b\u3002\n    &quot;&quot;&quot;\n    template = cv2.imread(template_path)\n    if template is None:\n        print(&quot;\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093:&quot;, template_path)\n        return None\n\n    # \u30b0\u30ec\u30fc\u30b9\u30b1\u30fc\u30eb\u306b\u5909\u63db\n    template_gray = cv2.cvtColor(template, cv2.COLOR_BGR2GRAY)\n    screen_gray = cv2.cvtColor(screen_img, cv2.COLOR_BGR2GRAY)\n    \n    # \u30a8\u30c3\u30b8\u691c\u51fa\u3092\u9069\u7528\u3059\u308b\u5834\u5408\n    if use_edges:\n        template_gray = cv2.Canny(template_gray, 50, 150)\n        screen_gray = cv2.Canny(screen_gray, 50, 150)\n    \n    # \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30de\u30c3\u30c1\u30f3\u30b0\n    res = cv2.matchTemplate(screen_gray, template_gray, cv2.TM_CCOEFF_NORMED)\n    loc = np.where(res &gt;= threshold)\n    \n    try:\n        y = loc[0][0]\n        x = loc[1][0]\n        h, w = template_gray.shape[:2]\n        center = (x + w \/\/ 2, y + h \/\/ 2)\n        return center\n    except IndexError:\n        return None\n\ndef tap(position, scaling=SCALING):\n    &quot;&quot;&quot;\n    \u6307\u5b9a\u4f4d\u7f6e\u3078\u30bf\u30c3\u30d7\uff08\u30af\u30ea\u30c3\u30af\uff09\u64cd\u4f5c\u3092\u5b9f\u884c\u3059\u308b\u95a2\u6570\n    scaling: \u30ad\u30e3\u30d7\u30c1\u30e3\u753b\u50cf\u3068\u5b9f\u969b\u306e\u5ea7\u6a19\u7cfb\u306e\u6bd4\u7387\n    &quot;&quot;&quot;\n    if position:\n        adjusted_pos = (int(position[0] \/ scaling), int(position[1] \/ scaling))\n        pyautogui.moveTo(adjusted_pos[0], adjusted_pos[1])\n        pyautogui.click()\n        print(f&quot;\u30bf\u30c3\u30d7\uff1a {adjusted_pos} (\u5143: {position}, scaling: {scaling})&quot;)\n        time.sleep(0.5)\n    else:\n        print(&quot;\u30bf\u30c3\u30d7\u5bfe\u8c61\u306e\u4f4d\u7f6e\u304c\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot;)\n\ndef swipe(start, end, duration=0.5, scaling=SCALING):\n    &quot;&quot;&quot;\n    \u6307\u5b9a\u958b\u59cb\u4f4d\u7f6e\u304b\u3089\u7d42\u4e86\u4f4d\u7f6e\u3078\u30b9\u30ef\u30a4\u30d7\uff08\u30c9\u30e9\u30c3\u30b0\uff09\u64cd\u4f5c\u3092\u5b9f\u884c\u3059\u308b\u95a2\u6570\n    scaling: \u30ad\u30e3\u30d7\u30c1\u30e3\u753b\u50cf\u3068\u5b9f\u969b\u306e\u5ea7\u6a19\u7cfb\u306e\u6bd4\u7387\n    &quot;&quot;&quot;\n    adjusted_start = (int(start[0] \/ scaling), int(start[1] \/ scaling))\n    adjusted_end = (int(end[0] \/ scaling), int(end[1] \/ scaling))\n    pyautogui.moveTo(adjusted_start[0], adjusted_start[1])\n    pyautogui.dragTo(adjusted_end[0], adjusted_end[1], duration=duration, button=&#39;left&#39;)\n    print(f&quot;\u30b9\u30ef\u30a4\u30d7\uff1a {adjusted_start} \u304b\u3089 {adjusted_end} \u3078 (scaling: {scaling})&quot;)\n    time.sleep(0.5)\n\ndef activate_app(app_name):\n    &quot;&quot;&quot;\n    \u6307\u5b9a\u3057\u305f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u3059\u308b\uff08Mac\u306e\u5834\u5408\u3001AppleScript\u3092\u5229\u7528\uff09\n    &quot;&quot;&quot;\n    os.system(f&quot;osascript -e &#39;tell application \\&quot;{app_name}\\&quot; to activate&#39;&quot;)\n    time.sleep(0.5)\n\ndef search_for_image(template_path, threshold=MATCH_THRESHOLD, timeout=10, use_edges=False):\n    &quot;&quot;&quot;\n    \u6307\u5b9a\u3057\u305f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf\u3092\u753b\u9762\u4e0a\u3067\u63a2\u7d22\u3059\u308b\u95a2\u6570\n      - timeout\u79d2\u4ee5\u5185\u306b\u753b\u50cf\u304c\u898b\u3064\u304b\u308c\u3070\u4e2d\u5fc3\u5ea7\u6a19\u3092\u8fd4\u3059\n      - \u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u3057\u305f\u5834\u5408\u306f False \u3092\u8fd4\u3059\n    &quot;&quot;&quot;\n    # IMG_DIR\u5185\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf\u306e\u30d5\u30eb\u30d1\u30b9\u3092\u7d44\u307f\u7acb\u3066\u308b\n    template_path = os.path.join(IMG_DIR, template_path)\n    start_time = time.time()\n    while time.time() - start_time &lt; timeout:\n        screen_img = capture_screen(CAPTURE_IMAGE)\n        pos = find_image_ignore_color(template_path, screen_img, threshold, use_edges)\n        if pos:\n            return pos\n        time.sleep(0.5)\n    return False\n\ndef main():\n    # iPhone Mirroring\u30a2\u30d7\u30ea\u3092\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u3059\u308b\n    activate_app(&quot;iPhone Mirroring&quot;)\n    print(&quot;BOT\u52d5\u4f5c\u958b\u59cb&quot;)\n    \n    while True:\n        # \u753b\u50cf\u691c\u7d22\u4f8b \u4e0a\u65b9\u5411\u30b9\u30ef\u30a4\u30d7\n        pos = search_for_image(&quot;SWIPE.png&quot;, threshold=MATCH_THRESHOLD, timeout=10, use_edges=False)\n        if pos:\n            print(&quot;\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f:&quot;, pos)\n            swipe(pos, (pos[0], pos[1] - 100), scaling=SCALING)\n        else:\n            print(&quot;\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\uff1a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot;)\n            break\n        time.sleep(1)\n        \n        # \u753b\u50cf\u691c\u7d22\u4f8b \u30bf\u30c3\u30d7\n        pos = search_for_image(&quot;TAP.png&quot;, threshold=MATCH_THRESHOLD, timeout=10, use_edges=False)\n        if pos:\n            print(&quot;\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f:&quot;, pos)\n            tap(pos)\n        else:\n            print(&quot;\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\uff1a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot;)\n            break\n        time.sleep(1)\n        \n        # \u753b\u50cf\u691c\u7d22\u4f8b\uff1a\u30bf\u30c3\u30d7\u30fb\u80cc\u666f\u8272\u306e\u5909\u5316\u304c\u3042\u308b\u5834\u5408\u3001\u30a8\u30c3\u30b8\u691c\u51fa\u3092\u9069\u7528\n        pos = search_for_image(&quot;TAP2.png&quot;, threshold=MATCH_THRESHOLD, timeout=10, use_edges=True)\n        if pos:\n            print(&quot;\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f:&quot;, pos)\n            tap(pos)\n        else:\n            print(&quot;\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\uff1a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u753b\u50cf\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot;)\n            break\n        time.sleep(1)\n\nif __name__ == &#39;__main__&#39;:\n    main()<\/code><\/pre><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">4. \u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30dd\u30a4\u30f3\u30c8<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u753b\u50cf\u8a8d\u8b58\u306e\u7cbe\u5ea6\u5411\u4e0a<\/strong><br>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30de\u30c3\u30c1\u30f3\u30b0\u306f\u3001\u80cc\u666f\u8272\u306e\u5909\u52d5\u306b\u5de6\u53f3\u3055\u308c\u3084\u3059\u3044\u3067\u3059\u304c\u3001\u30b0\u30ec\u30fc\u30b9\u30b1\u30fc\u30eb\u5909\u63db\u3084\u30a8\u30c3\u30b8\u691c\u51fa\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5f62\u72b6\u306e\u307f\u3067\u8a8d\u8b58\u3059\u308b\u65b9\u6cd5\u3092\u63a1\u7528\u3057\u3066\u3044\u307e\u3059\u3002<br><code>find_image_ignore_color<\/code> \u95a2\u6570\u5185\u3067\u3001<code>use_edges<\/code> \u30d5\u30e9\u30b0\u3092\u8abf\u6574\u3059\u308b\u3053\u3068\u3067\u8a66\u884c\u932f\u8aa4\u304c\u53ef\u80fd\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u4ed8\u304d\u691c\u7d22<\/strong><br><code>search_for_image<\/code> \u95a2\u6570\u3067\u306f\u3001\u6307\u5b9a\u79d2\u6570\u5185\u306b\u753b\u50cf\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u5834\u5408\u3001False \u3092\u8fd4\u3059\u305f\u3081\u3001\u305d\u306e\u5f8c\u306e\u51e6\u7406\u3092\u5206\u5c90\u3055\u305b\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<br>\u3053\u308c\u306b\u3088\u308a\u3001\u60f3\u5b9a\u5916\u306e\u753b\u9762\u72b6\u614b\u306b\u306a\u3063\u305f\u5834\u5408\u3067\u3082\u3001\u67d4\u8edf\u306a\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u304c\u53ef\u80fd\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>\u5ea7\u6a19\u306e\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0<\/strong><br>Retina\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u3067\u306f\u30ad\u30e3\u30d7\u30c1\u30e3\u753b\u50cf\u306e\u89e3\u50cf\u5ea6\u3068\u5b9f\u969b\u306e\u5ea7\u6a19\u304c\u7570\u306a\u308b\u305f\u3081\u3001SCALING \u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u8abf\u6574\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002<br>\u30bf\u30c3\u30d7\u3084\u30b9\u30ef\u30a4\u30d7\u306e\u969b\u306f\u3001\u3053\u306e\u8abf\u6574\u5024\u3092\u5229\u7528\u3057\u3066\u6b63\u78ba\u306a\u4f4d\u7f6e\u3067\u64cd\u4f5c\u3092\u5b9f\u65bd\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u52d5\u4f5c\u74b0\u5883<\/strong><br>\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u3001<strong>Mac M1 (macOS 15.0)<\/strong> \u3068 <strong>iPhone 14 Pro (iOS 18.3.1)<\/strong> \u3067\u306e\u52d5\u4f5c\u78ba\u8a8d\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u307e\u3068\u3081<\/h2>\n\n\n\n<p>\u3000\u672c\u8a18\u4e8b\u3067\u306f\u3001Python \u3092\u7528\u3044\u3066\u3001\u30b7\u30f3\u30d7\u30eb\u306a\u753b\u50cf\u8a8d\u8b58\u306b\u3088\u308b\u30a2\u30d7\u30ea\u64cd\u4f5c BOT \u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3068\u3001\u305d\u306e\u89e3\u8aac\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<br>\u3000\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u5c0e\u5165\u65b9\u6cd5\u304b\u3089\u3001\u753b\u50cf\u30ad\u30e3\u30d7\u30c1\u30e3\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30de\u30c3\u30c1\u30f3\u30b0\u3001\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u4ed8\u304d\u691c\u7d22\u3001\u305d\u3057\u3066\u30bf\u30c3\u30d7\u30fb\u30b9\u30ef\u30a4\u30d7\u306a\u3069\u306e\u64cd\u4f5c\u3092\u5b9f\u88c5\u3059\u308b\u65b9\u6cd5\u307e\u3067\u3001\u6c4e\u7528\u6027\u306e\u3042\u308b\u30b3\u30fc\u30c9\u3092\u63d0\u793a\u3057\u3066\u3044\u307e\u3059\u3002<br>\u3000\u74b0\u5883\u306b\u5408\u308f\u305b\u305f\u30b9\u30b1\u30fc\u30ea\u30f3\u30b0\u8abf\u6574\u3084\u3001\u30a8\u30c3\u30b8\u691c\u51fa\u306b\u3088\u308b\u8272\u306e\u5f71\u97ff\u3092\u6392\u9664\u3057\u305f\u753b\u50cf\u8a8d\u8b58\u3092\u5de5\u592b\u3059\u308b\u3053\u3068\u3067\u3001\u69d8\u3005\u306a\u30b7\u30fc\u30f3\u3067\u5fdc\u7528\u53ef\u80fd\u306a BOT \u3092\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u3053\u306e\u30b3\u30fc\u30c9\u3092\u30d9\u30fc\u30b9\u306b\u3001\u81ea\u8eab\u306e\u7528\u9014\u306b\u5408\u308f\u305b\u305f\u62e1\u5f35\u3084\u6539\u826f\u3092\u884c\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"affiliate-box\"><div class=\"affiliate-containar\"><a href=\"https:\/\/amzn.to\/4b6U9lB\" rel=\"nofollow\"><img decoding=\"async\" style=\"border: none;\" src=\"https:\/\/m.media-amazon.com\/images\/I\/71jt9BEXU-L._SY522_.jpg\" target=\"_blank\"><\/a><div class=\"affiliate-content\"><a href=\"https:\/\/amzn.to\/4b6U9lB\" rel=\"nofollow\">\u30b9\u30c3\u30ad\u30ea\u308f\u304b\u308bPython\u5165\u9580 \u7b2c2\u7248 <\/a><ul class=\"affiliate-button\"><li><a href=\"https:\/\/amzn.to\/4b6U9lB\" rel=\"nofollow\">Amazon<\/a><\/li><\/ul><\/div><\/div><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001Python \u3068\u4e3b\u8981\u30e9\u30a4\u30d6\u30e9\u30ea\uff08OpenCV\u3001pyautogui\u3001NumPy\uff09\u3092\u5229\u7528\u3057\u3001\u6307\u5b9a\u753b\u50cf\u3092\u691c\u7d22\u3057\u3066\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u4ed8\u304d\u3067\u52d5\u4f5c\u3092\u5b9f\u884c\u3059\u308b\u4ed5\u7d44\u307f\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002MacOS\u306biPhone\u30df\u30e9\u30fc\u30ea\u30f3\u30b0\u6a5f\u80fd\u304c\u5b9f\u88c5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4094,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[20,3],"tags":[],"class_list":["post-4085","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chatgpt","category-3"],"acf":[],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ubun2m.com\/wp-content\/uploads\/2025\/02\/jidouimo.webp","_links":{"self":[{"href":"https:\/\/ubun2m.com\/index.php?rest_route=\/wp\/v2\/posts\/4085","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubun2m.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubun2m.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubun2m.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubun2m.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4085"}],"version-history":[{"count":0,"href":"https:\/\/ubun2m.com\/index.php?rest_route=\/wp\/v2\/posts\/4085\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubun2m.com\/index.php?rest_route=\/wp\/v2\/media\/4094"}],"wp:attachment":[{"href":"https:\/\/ubun2m.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubun2m.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubun2m.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}