注册 登录
发贴工具
查看: 5|回复: 0
打印 上一主题 下一主题

[24小时收录超级好的网站] AIWROK软件找图方法汇总示例

[复制链接]

2472

主题

2520

帖子

1万

积分

积分
15032
跳转到指定楼层
楼主


AIWROK软件找图方法汇总示例
AIWROK软件找图方法汇总示例 群发软件发帖工具

AIWROK软件找图方法汇总示例 群发软件发帖工具
  1. // 找图方法汇总示例
  2. // 技术交流QQ群711841924群一,苹果内测群,528816639

  3. /**
  4. * 基础找图方法 - 使用opencv.findImagesEx
  5. * @returns {boolean} 是否找到并点击目标
  6. */
  7. function basicFindImage() {
  8.     printl("开始基础找图: 图色823706.cv");
  9.    
  10.     try {
  11.         // 检查opencv是否可用
  12.         if (typeof opencv !== 'undefined' && typeof opencv.findImagesEx === 'function') {
  13.             // 执行找图操作
  14.             var detects = opencv.findImagesEx('图色823706.cv');
  15.             
  16.             if (detects !== null) {
  17.                 printl("找到目标数组: " + detects);
  18.                
  19.                 // 点击第一个找到的目标
  20.                 if (detects.length > 0) {
  21.                     printl("点击第一个找到的目标");
  22.                     detects[0].click();
  23.                     return true;
  24.                 } else {
  25.                     printl("目标数组为空");
  26.                     return false;
  27.                 }
  28.             } else {
  29.                 printl("未找到目标");
  30.                 return false;
  31.             }
  32.         } else {
  33.             printl("❌ opencv模块不可用");
  34.             return false;
  35.         }
  36.     } catch (e) {
  37.         printl("执行错误: " + String(e));
  38.         return false;
  39.     }
  40. }

  41. /**
  42. * 多图像查找方法 - 使用opencv.findImagesEx
  43. * @returns {boolean} 是否找到并点击目标
  44. */
  45. function multiFindImage() {
  46.     printl("开始多图像查找,共 3 个图像");
  47.    
  48.     try {
  49.         // 多个要查找的图像(使用同一个CV文件多次测试)
  50.         var imagePaths = new Array();
  51.         imagePaths[0] = '图色823706.cv';
  52.         imagePaths[1] = '图色823706.cv';
  53.         imagePaths[2] = '图色823706.cv';
  54.         
  55.         // 遍历每个图像进行查找
  56.         for (var i = 0; i < imagePaths.length; i++) {
  57.             var imagePath = imagePaths[i];
  58.             printl("正在查找: " + imagePath);
  59.             
  60.             // 检查opencv是否可用
  61.             if (typeof opencv !== 'undefined' && typeof opencv.findImagesEx === 'function') {
  62.                 var detects = opencv.findImagesEx('图色823706.cv');
  63.                
  64.                 if (detects != null && detects.length > 0) {
  65.                     printl("在图像 " + imagePath + " 找到 " + detects.length + " 个匹配结果");
  66.                     
  67.                     // 只处理第一个找到的结果
  68.                     var result = detects[0];
  69.                     printl("位置: (" + (result.x || 0) + ", " + (result.y || 0) + ")");
  70.                     printl("尺寸: " + (result.width || 0) + "x" + (result.height || 0));
  71.                     printl("相似度: " + (result.similarity || 0));
  72.                     
  73.                     // 执行点击
  74.                     result.click();
  75.                     sleep.second(1);
  76.                     return true;
  77.                 } else {
  78.                     printl("未找到有效匹配: " + imagePath);
  79.                 }
  80.             } else {
  81.                 printl("❌ opencv模块不可用");
  82.                 return false;
  83.             }
  84.         }
  85.         return false;
  86.     } catch (e) {
  87.         printl("多图像查找过程中发生错误: " + String(e));
  88.         return false;
  89.     }
  90. }

  91. /**
  92. * 截图找图方法 - 使用opencv.findImagesEx
  93. * @returns {boolean} 是否找到并点击目标
  94. */
  95. function screenshotFindImage() {
  96.     printl("开始截图找图");
  97.    
  98.     try {
  99.         // 使用系统截图功能(如果可用)
  100.         try {
  101.             // 尝试使用截图功能
  102.             var screenshotPath = "/sdcard/screenshot.png";
  103.             printl("尝试保存截图到: " + screenshotPath);
  104.             // 注意:screen.capture在某些环境中可能不可用
  105.             if (typeof screen !== 'undefined' && typeof screen.screenShot === 'function') {
  106.                 var screenWidth = screen.getScreenWidth();
  107.                 var screenHeight = screen.getScreenHeight();
  108.                 printl("屏幕尺寸: " + screenWidth + "x" + screenHeight);
  109.                 var screenshot = screen.screenShot(screenWidth, screenHeight);
  110.                 printl("截图成功,尺寸: " + screenshot.getMat().width() + "x" + screenshot.getMat().height());
  111.             }
  112.         } catch (e) {
  113.             printl("截图功能不可用: " + String(e));
  114.         }
  115.         
  116.         // 直接进行找图
  117.         var targetImagePath = '图色823706.cv';
  118.         printl("正在查找图像: " + targetImagePath);
  119.         
  120.         // 检查opencv是否可用
  121.         if (typeof opencv !== 'undefined' && typeof opencv.findImagesEx === 'function') {
  122.             var detects = opencv.findImagesEx('图色823706.cv');
  123.             
  124.             if (detects != null && detects.length > 0) {
  125.                 printl("找到 " + detects.length + " 个匹配结果");
  126.                
  127.                 for (var i = 0; i < detects.length; i++) {
  128.                     var result = detects[i];
  129.                     printl("结果 " + (i+1) + ": x=" + (result.x || 0) + ", y=" + (result.y || 0) +
  130.                            ", width=" + (result.width || 0) + ", height=" + (result.height || 0) +
  131.                            ", similarity=" + (result.similarity || 0));
  132.                 }
  133.                
  134.                 // 点击第一个结果
  135.                 detects[0].click();
  136.                 return true;
  137.             } else {
  138.                 printl("截图找图未找到有效匹配结果");
  139.                 printl("请检查以下几点:");
  140.                 printl("1. 图像文件是否存在: " + targetImagePath);
  141.                 printl("2. 图像是否在屏幕上可见");
  142.                 printl("3. 图像相似度设置是否合适");
  143.                 return false;
  144.             }
  145.         } else {
  146.             printl("❌ opencv模块不可用");
  147.             return false;
  148.         }
  149.     } catch (e) {
  150.         printl("截图找图过程中发生错误: " + String(e));
  151.         return false;
  152.     }
  153. }

  154. /**
  155. * SIFT图像查找方法 - 使用opencv.findImageOneSift
  156. * @returns {boolean} 是否找到并点击目标
  157. */
  158. function siftFindImage() {
  159.     printl("开始SIFT图像查找");
  160.    
  161.     try {
  162.         // 检查opencv是否可用
  163.         if (typeof opencv !== 'undefined' && typeof opencv.findImageOneSift === 'function') {
  164.             // 获取屏幕尺寸
  165.             var screenWidth = 900;
  166.             var screenHeight = 1600;
  167.             
  168.             try {
  169.                 if (typeof screen !== 'undefined') {
  170.                     if (typeof screen.getScreenWidth === 'function') {
  171.                         screenWidth = screen.getScreenWidth();
  172.                         screenHeight = screen.getScreenHeight();
  173.                     }
  174.                 }
  175.             } catch (e) {
  176.                 printl("获取屏幕尺寸失败,使用默认值: " + String(e));
  177.             }
  178.             
  179.             printl("大图尺寸: " + screenWidth + "x" + screenHeight);
  180.             printl("小图尺寸: 300x300");
  181.             
  182.             // 截取大图和小图
  183.             var bigMat = screen.screenShot(screenWidth, screenHeight, 100).getMat();
  184.             var smallMat = screen.screenShot(300, 300, 100).getMat();
  185.             
  186.             // 定义搜索区域
  187.             var searchRegion = [0, 0, 1, 1]; // 整个屏幕
  188.             
  189.             // 执行SIFT图像查找
  190.             var result = opencv.findImageOneSift(bigMat, smallMat, 60, 50, searchRegion);
  191.             
  192.             if (result !== null) {
  193.                 printl("SIFT图像查找成功");
  194.                 printl("位置: (" + result.x + ", " + result.y + ")");
  195.                 printl("尺寸: " + result.width + "x" + result.height);
  196.                 printl("相似度: " + result.similarity);
  197.                
  198.                 // 点击找到的位置
  199.                 result.click();
  200.                
  201.                 // 释放资源
  202.                 bigMat = null;
  203.                 smallMat = null;
  204.                
  205.                 return true;
  206.             } else {
  207.                 printl("SIFT图像查找未找到匹配结果");
  208.                
  209.                 // 释放资源
  210.                 bigMat = null;
  211.                 smallMat = null;
  212.                
  213.                 return false;
  214.             }
  215.         } else {
  216.             printl("SIFT方法在当前AIWROK版本中不可用,跳过执行");
  217.             return false;
  218.         }
  219.     } catch (e) {
  220.         printl("SIFT方法在当前AIWROK版本中不可用,跳过执行");
  221.         return false;
  222.     }
  223. }

  224. /**
  225. * 多点找色方法 - 使用opencv.findMultiColor
  226. * @returns {boolean} 是否找到并点击目标
  227. */
  228. function multiColorFind() {
  229.     printl("开始多点找色");
  230.    
  231.     try {
  232.         // 获取屏幕尺寸
  233.         var screenWidth = 900;
  234.         var screenHeight = 1600;
  235.         
  236.         try {
  237.             if (typeof screen !== 'undefined') {
  238.                 if (typeof screen.getScreenWidth === 'function') {
  239.                     screenWidth = screen.getScreenWidth();
  240.                     screenHeight = screen.getScreenHeight();
  241.                 }
  242.             }
  243.         } catch (e) {
  244.             printl("获取屏幕尺寸失败,使用默认值: " + String(e));
  245.         }
  246.         
  247.         printl("图像尺寸: " + screenWidth + "x" + screenHeight);
  248.         
  249.         // 截取屏幕图像
  250.         var screenMat = screen.screenShot(screenWidth, screenHeight, 100).getMat();
  251.         
  252.         // 定义基准点和颜色点
  253.         var basePoint = "";
  254.         var colorPoints = [];
  255.         var colorTolerance = 0;
  256.         var offsetTolerance = 0;
  257.         var region = [0, 0, 1, 1]; // 整个屏幕
  258.         var similarity = 0.9;
  259.         
  260.         // 检查opencv是否可用
  261.         if (typeof opencv !== 'undefined' && typeof opencv.findMultiColor === 'function') {
  262.             var result = opencv.findMultiColor(screenMat, basePoint, colorPoints, colorTolerance, offsetTolerance, region, similarity);
  263.             
  264.             if (result !== null) {
  265.                 printl("多点找色成功");
  266.                 printl("位置: (" + result.x + ", " + result.y + ")");
  267.                
  268.                 // 点击找到的位置
  269.                 touch.tap(result.x, result.y);
  270.                
  271.                 // 释放资源
  272.                 screenMat = null;
  273.                
  274.                 return true;
  275.             } else {
  276.                 printl("多点找色未找到有效匹配项");
  277.                
  278.                 // 释放资源
  279.                 screenMat = null;
  280.                
  281.                 return false;
  282.             }
  283.         } else {
  284.             printl("❌ opencv模块不可用或findMultiColor方法不存在");
  285.             
  286.             // 释放资源
  287.             screenMat = null;
  288.             
  289.             return false;
  290.         }
  291.     } catch (e) {
  292.         printl("执行多点找色时发生错误: " + String(e));
  293.         return false;
  294.     }
  295. }

  296. /**
  297. * 使用auto.checkImage查找图
  298. * @param {Array} images - 图像数组
  299. * @param {number} similarity - 相似度
  300. * @param {number} timeout - 超时时间
  301. * @param {Array} region - 区域
  302. * @returns {boolean} 是否找到并点击目标
  303. */
  304. function autoCheckImage(images, similarity, timeout, region) {
  305.     printl("开始使用auto.checkImage查找图");
  306.    
  307.     try {
  308.         // 检查auto是否可用
  309.         if (typeof auto !== 'undefined' && typeof auto.checkImage === 'function') {
  310.             var result = auto.checkImage(images, similarity, timeout, 0, region);
  311.             
  312.             if (result !== null) {
  313.                 printl("auto.checkImage查找成功");
  314.                 printl("位置: (" + result.x + ", " + result.y + ")");
  315.                
  316.                 // 点击找到的位置
  317.                 touch.tap(result.x, result.y);
  318.                
  319.                 return true;
  320.             } else {
  321.                 printl("auto.checkImage未找到匹配结果");
  322.                 return false;
  323.             }
  324.         } else {
  325.             printl("❌ auto模块不可用或checkImage方法不存在");
  326.             return false;
  327.         }
  328.     } catch (e) {
  329.         printl("auto.checkImage执行错误: " + String(e));
  330.         return false;
  331.     }
  332. }

  333. /**
  334. * 使用auto.findBestImage查找最佳图
  335. * @param {Array} images - 图像数组
  336. * @param {number} similarity - 相似度
  337. * @param {number} timeout - 超时时间
  338. * @param {Array} region - 区域
  339. * @returns {boolean} 是否找到并点击目标
  340. */
  341. function autoFindBestImage(images, similarity, timeout, region) {
  342.     printl("开始使用auto.findBestImage查找最佳图");
  343.    
  344.     try {
  345.         // 检查auto是否可用
  346.         if (typeof auto !== 'undefined' && typeof auto.findBestImage === 'function') {
  347.             var result = auto.findBestImage(images, similarity, timeout, 0, region);
  348.             
  349.             if (result !== null) {
  350.                 printl("auto.findBestImage查找成功");
  351.                 printl("位置: (" + result.x + ", " + result.y + ")");
  352.                 printl("相似度: " + result.similarity);
  353.                
  354.                 // 点击找到的位置
  355.                 touch.tap(result.x, result.y);
  356.                
  357.                 return true;
  358.             } else {
  359.                 printl("auto.findBestImage未找到匹配结果");
  360.                 return false;
  361.             }
  362.         } else {
  363.             printl("❌ auto模块不可用或findBestImage方法不存在");
  364.             return false;
  365.         }
  366.     } catch (e) {
  367.         printl("auto.findBestImage执行错误: " + String(e));
  368.         return false;
  369.     }
  370. }

  371. /**
  372. * 使用auto.findImages找多图
  373. * @param {Array} images - 图像数组
  374. * @param {number} similarity - 相似度
  375. * @param {number} timeout - 超时时间
  376. * @param {number} maxResults - 最大结果数
  377. * @param {Array} region - 区域
  378. * @returns {boolean} 是否找到并点击目标
  379. */
  380. function autoFindImages(images, similarity, timeout, maxResults, region) {
  381.     printl("开始使用auto.findImages找多图");
  382.    
  383.     try {
  384.         // 检查auto是否可用
  385.         if (typeof auto !== 'undefined' && typeof auto.findImages === 'function') {
  386.             var results = auto.findImages(images, similarity, timeout, maxResults, region);
  387.             
  388.             if (results !== null && results.length > 0) {
  389.                 printl("auto.findImages找到 " + results.length + " 个匹配结果");
  390.                
  391.                 // 处理第一个结果
  392.                 var result = results[0];
  393.                 printl("位置: (" + result.x + ", " + result.y + ")");
  394.                 printl("相似度: " + result.similarity);
  395.                
  396.                 // 点击找到的位置
  397.                 touch.tap(result.x, result.y);
  398.                
  399.                 return true;
  400.             } else {
  401.                 printl("auto.findImages未找到匹配结果");
  402.                 return false;
  403.             }
  404.         } else {
  405.             printl("❌ auto模块不可用或findImages方法不存在");
  406.             return false;
  407.         }
  408.     } catch (e) {
  409.         printl("auto.findImages执行错误: " + String(e));
  410.         return false;
  411.     }
  412. }

  413. /**
  414. * 使用auto.findColors多点找色
  415. * @param {Object} mat - 图像矩阵
  416. * @param {string} basePoint - 基准点
  417. * @param {Array} colorPoints - 颜色点数组
  418. * @param {number} colorTolerance - 颜色容差
  419. * @param {number} offsetTolerance - 偏移容差
  420. * @param {Array} region - 区域
  421. * @param {number} similarity - 相似度
  422. * @returns {boolean} 是否找到并点击目标
  423. */
  424. function autoFindColors(mat, basePoint, colorPoints, colorTolerance, offsetTolerance, region, similarity) {
  425.     printl("开始使用auto.findColors多点找色");
  426.    
  427.     try {
  428.         // 检查auto是否可用
  429.         if (typeof auto !== 'undefined' && typeof auto.findColors === 'function') {
  430.             var result = auto.findColors(mat, basePoint, colorPoints, colorTolerance, offsetTolerance, region, similarity);
  431.             
  432.             if (result !== null) {
  433.                 printl("auto.findColors多点找色成功");
  434.                 printl("位置: (" + result.x + ", " + result.y + ")");
  435.                
  436.                 // 点击找到的位置
  437.                 touch.tap(result.x, result.y);
  438.                
  439.                 return true;
  440.             } else {
  441.                 printl("auto.findColors未找到匹配结果");
  442.                 return false;
  443.             }
  444.         } else {
  445.             printl("❌ auto模块不可用或findColors方法不存在");
  446.             return false;
  447.         }
  448.     } catch (e) {
  449.         printl("auto.findColors执行错误: " + String(e));
  450.         return false;
  451.     }
  452. }

  453. /**
  454. * 使用auto.findText找文字
  455. * @param {string} text - 要查找的文字
  456. * @param {number} similarity - 相似度
  457. * @param {Array} region - 区域
  458. * @returns {boolean} 是否找到并点击目标
  459. */
  460. function autoFindText(text, similarity, region) {
  461.     printl("开始使用auto.findText找文字: " + text);
  462.    
  463.     try {
  464.         // 检查auto是否可用
  465.         if (typeof auto !== 'undefined' && typeof auto.findText === 'function') {
  466.             var result = auto.findText(text, similarity, region);
  467.             
  468.             if (result !== null) {
  469.                 printl("auto.findText查找成功");
  470.                 printl("位置: (" + result.x + ", " + result.y + ")");
  471.                
  472.                 // 点击找到的位置
  473.                 touch.tap(result.x, result.y);
  474.                
  475.                 return true;
  476.             } else {
  477.                 printl("auto.findText未找到匹配结果");
  478.                 return false;
  479.             }
  480.         } else {
  481.             printl("❌ auto模块不可用或findText方法不存在");
  482.             return false;
  483.         }
  484.     } catch (e) {
  485.         printl("auto.findText执行错误: " + String(e));
  486.         return false;
  487.     }
  488. }

  489. /**
  490. * 使用ai.findImage找多图
  491. * @param {Object} image - 图像
  492. * @param {Array} rect - 矩形区域
  493. * @param {string} model - 模型名
  494. * @param {number} targetSize - 目标大小
  495. * @param {string} sort - 排序方式
  496. * @param {number} similarity - 相似度
  497. * @returns {boolean} 是否找到并点击目标
  498. */
  499. function aiFindImage(image, rect, model, targetSize, sort, similarity) {
  500.     printl("开始使用ai.findImage找多图");
  501.    
  502.     try {
  503.         // 检查ai是否可用
  504.         if (typeof ai !== 'undefined' && typeof ai.findImage === 'function') {
  505.             var results = ai.findImage(image, rect, model, targetSize, sort, similarity);
  506.             
  507.             if (results !== null && results.length > 0) {
  508.                 printl("ai.findImage找到 " + results.length + " 个匹配结果");
  509.                
  510.                 // 处理第一个结果
  511.                 var result = results[0];
  512.                 printl("位置: (" + result.x + ", " + result.y + ")");
  513.                 printl("相似度: " + result.similarity);
  514.                
  515.                 // 点击找到的位置
  516.                 touch.tap(result.x, result.y);
  517.                
  518.                 return true;
  519.             } else {
  520.                 printl("ai.findImage未找到匹配结果");
  521.                 return false;
  522.             }
  523.         } else {
  524.             printl("❌ ai模块不可用或findImage方法不存在");
  525.             return false;
  526.         }
  527.     } catch (e) {
  528.         printl("ai.findImage执行错误: " + String(e));
  529.         return false;
  530.     }
  531. }

  532. /**
  533. * 使用ai.findImageOne找单图
  534. * @param {Object} image - 图像
  535. * @param {Array} rect - 矩形区域
  536. * @param {string} model - 模型名
  537. * @param {number} targetSize - 目标大小
  538. * @param {string} sort - 排序方式
  539. * @param {number} similarity - 相似度
  540. * @returns {boolean} 是否找到并点击目标
  541. */
  542. function aiFindImageOne(image, rect, model, targetSize, sort, similarity) {
  543.     printl("开始使用ai.findImageOne找单图");
  544.    
  545.     try {
  546.         // 检查ai是否可用
  547.         if (typeof ai !== 'undefined' && typeof ai.findImageOne === 'function') {
  548.             var result = ai.findImageOne(image, rect, model, targetSize, sort, similarity);
  549.             
  550.             if (result !== null) {
  551.                 printl("ai.findImageOne查找成功");
  552.                 printl("位置: (" + result.x + ", " + result.y + ")");
  553.                 printl("相似度: " + result.similarity);
  554.                
  555.                 // 点击找到的位置
  556.                 touch.tap(result.x, result.y);
  557.                
  558.                 return true;
  559.             } else {
  560.                 printl("ai.findImageOne未找到匹配结果");
  561.                 return false;
  562.             }
  563.         } else {
  564.             printl("❌ ai模块不可用或findImageOne方法不存在");
  565.             return false;
  566.         }
  567.     } catch (e) {
  568.         printl("ai.findImageOne执行错误: " + String(e));
  569.         return false;
  570.     }
  571. }

  572. /**
  573. * 使用ai.setSpeed设置AI速度
  574. * @param {number} speed - 速度值
  575. * @returns {boolean} 是否设置成功
  576. */
  577. function aiSetSpeed(speed) {
  578.     printl("开始使用ai.setSpeed设置速度: " + speed);
  579.    
  580.     try {
  581.         // 检查ai是否可用
  582.         if (typeof ai !== 'undefined' && typeof ai.setSpeed === 'function') {
  583.             ai.setSpeed(speed);
  584.             printl("ai.setSpeed设置成功");
  585.             return true;
  586.         } else {
  587.             printl("❌ ai模块不可用或setSpeed方法不存在");
  588.             return false;
  589.         }
  590.     } catch (e) {
  591.         printl("ai.setSpeed执行错误: " + String(e));
  592.         return false;
  593.     }
  594. }

  595. /**
  596. * 使用opencv.findImageOneKAZE找图(KAZE算法)
  597. * @param {Object} bigMat - 大图矩阵
  598. * @param {Object} smallMat - 小图矩阵
  599. * @param {Object} resultMat - 结果矩阵
  600. * @returns {boolean} 是否找到并点击目标
  601. */
  602. function opencvFindImageOneKAZE(bigMat, smallMat, resultMat) {
  603.     printl("开始使用opencv.findImageOneKAZE找图");
  604.    
  605.     try {
  606.         // 检查opencv是否可用
  607.         if (typeof opencv !== 'undefined' && typeof opencv.findImageOneKAZE === 'function') {
  608.             var result = opencv.findImageOneKAZE(bigMat, smallMat, resultMat);
  609.             
  610.             if (result !== null) {
  611.                 printl("opencv.findImageOneKAZE查找成功");
  612.                 printl("位置: (" + result.x + ", " + result.y + ")");
  613.                 printl("相似度: " + result.similarity);
  614.                
  615.                 // 点击找到的位置
  616.                 touch.tap(result.x, result.y);
  617.                
  618.                 return true;
  619.             } else {
  620.                 printl("opencv.findImageOneKAZE未找到匹配结果");
  621.                 return false;
  622.             }
  623.         } else {
  624.             printl("❌ opencv模块不可用或findImageOneKAZE方法不存在");
  625.             return false;
  626.         }
  627.     } catch (e) {
  628.         printl("opencv.findImageOneKAZE执行错误: " + String(e));
  629.         return false;
  630.     }
  631. }

  632. /**
  633. * 使用opencv.findImageOneSift找图(SIFT算法)
  634. * @param {Object} bigMat - 大图矩阵
  635. * @param {Object} smallMat - 小图矩阵
  636. * @param {number} param1 - 参数1
  637. * @param {number} param2 - 参数2
  638. * @param {Array} region - 区域
  639. * @returns {boolean} 是否找到并点击目标
  640. */
  641. function opencvFindImageOneSift(bigMat, smallMat, param1, param2, region) {
  642.     printl("开始使用opencv.findImageOneSift找图");
  643.    
  644.     try {
  645.         // 检查opencv是否可用
  646.         if (typeof opencv !== 'undefined' && typeof opencv.findImageOneSift === 'function') {
  647.             var result = opencv.findImageOneSift(bigMat, smallMat, param1, param2, region);
  648.             
  649.             if (result !== null) {
  650.                 printl("opencv.findImageOneSift查找成功");
  651.                 printl("位置: (" + result.x + ", " + result.y + ")");
  652.                 printl("相似度: " + result.similarity);
  653.                
  654.                 // 点击找到的位置
  655.                 touch.tap(result.x, result.y);
  656.                
  657.                 return true;
  658.             } else {
  659.                 printl("opencv.findImageOneSift未找到匹配结果");
  660.                 return false;
  661.             }
  662.         } else {
  663.             printl("❌ opencv模块不可用或findImageOneSift方法不存在");
  664.             return false;
  665.         }
  666.     } catch (e) {
  667.         printl("opencv.findImageOneSift执行错误: " + String(e));
  668.         return false;
  669.     }
  670. }

  671. /**
  672. * 使用opencv.findImagesEx找图
  673. * @param {string} cvFile - CV文件名
  674. * @returns {boolean} 是否找到并点击目标
  675. */
  676. function opencvFindImagesEx(cvFile) {
  677.     printl("开始使用opencv.findImagesEx找图: " + cvFile);
  678.    
  679.     try {
  680.         // 检查opencv是否可用
  681.         if (typeof opencv !== 'undefined' && typeof opencv.findImagesEx === 'function') {
  682.             var detects = opencv.findImagesEx(cvFile);
  683.             
  684.             if (detects !== null && detects.length > 0) {
  685.                 printl("opencv.findImagesEx找到 " + detects.length + " 个匹配结果");
  686.                
  687.                 // 处理第一个结果
  688.                 var result = detects[0];
  689.                 printl("位置: (" + (result.x || 0) + ", " + (result.y || 0) + ")");
  690.                 printl("尺寸: " + (result.width || 0) + "x" + (result.height || 0));
  691.                 printl("相似度: " + (result.similarity || 0));
  692.                
  693.                 // 点击找到的位置
  694.                 result.click();
  695.                
  696.                 return true;
  697.             } else {
  698.                 printl("opencv.findImagesEx未找到匹配结果");
  699.                 return false;
  700.             }
  701.         } else {
  702.             printl("❌ opencv模块不可用或findImagesEx方法不存在");
  703.             return false;
  704.         }
  705.     } catch (e) {
  706.         printl("opencv.findImagesEx执行错误: " + String(e));
  707.         return false;
  708.     }
  709. }

  710. /**
  711. * 使用opencv.findMultiColor找多色
  712. * @param {Object} mat - 图像矩阵
  713. * @param {string} basePoint - 基准点
  714. * @param {Array} colorPoints - 颜色点数组
  715. * @param {number} colorTolerance - 颜色容差
  716. * @param {number} offsetTolerance - 偏移容差
  717. * @param {Array} region - 区域
  718. * @param {number} similarity - 相似度
  719. * @returns {boolean} 是否找到并点击目标
  720. */
  721. function opencvFindMultiColor(mat, basePoint, colorPoints, colorTolerance, offsetTolerance, region, similarity) {
  722.     printl("开始使用opencv.findMultiColor找多色");
  723.    
  724.     try {
  725.         // 检查opencv是否可用
  726.         if (typeof opencv !== 'undefined' && typeof opencv.findMultiColor === 'function') {
  727.             var result = opencv.findMultiColor(mat, basePoint, colorPoints, colorTolerance, offsetTolerance, region, similarity);
  728.             
  729.             if (result !== null) {
  730.                 printl("opencv.findMultiColor查找成功");
  731.                 printl("位置: (" + result.x + ", " + result.y + ")");
  732.                
  733.                 // 点击找到的位置
  734.                 touch.tap(result.x, result.y);
  735.                
  736.                 return true;
  737.             } else {
  738.                 printl("opencv.findMultiColor未找到匹配结果");
  739.                 return false;
  740.             }
  741.         } else {
  742.             printl("❌ opencv模块不可用或findMultiColor方法不存在");
  743.             return false;
  744.         }
  745.     } catch (e) {
  746.         printl("opencv.findMultiColor执行错误: " + String(e));
  747.         return false;
  748.     }
  749. }

  750. /**
  751. * 使用opencv.findMultiColorEx找多色扩展
  752. * @param {string} params - 参数
  753. * @returns {boolean} 是否找到并点击目标
  754. */
  755. function opencvFindMultiColorEx(params) {
  756.     printl("开始使用opencv.findMultiColorEx找多色扩展");
  757.    
  758.     try {
  759.         // 检查opencv是否可用
  760.         if (typeof opencv !== 'undefined' && typeof opencv.findMultiColorEx === 'function') {
  761.             var result = opencv.findMultiColorEx(params);
  762.             
  763.             if (result !== null) {
  764.                 printl("opencv.findMultiColorEx查找成功");
  765.                 printl("位置: (" + result.x + ", " + result.y + ")");
  766.                
  767.                 // 点击找到的位置
  768.                 touch.tap(result.x, result.y);
  769.                
  770.                 return true;
  771.             } else {
  772.                 printl("opencv.findMultiColorEx未找到匹配结果");
  773.                 return false;
  774.             }
  775.         } else {
  776.             printl("❌ opencv模块不可用或findMultiColorEx方法不存在");
  777.             return false;
  778.         }
  779.     } catch (e) {
  780.         printl("opencv.findMultiColorEx执行错误: " + String(e));
  781.         return false;
  782.     }
  783. }

  784. /**
  785. * 使用opencv.findImages找多图
  786. * @param {Array} images - 图像数组
  787. * @returns {boolean} 是否找到并点击目标
  788. */
  789. function opencvFindImages(images) {
  790.     printl("开始使用opencv.findImages找多图");
  791.    
  792.     try {
  793.         // 检查opencv是否可用
  794.         if (typeof opencv !== 'undefined' && typeof opencv.findImages === 'function') {
  795.             var results = opencv.findImages(images);
  796.             
  797.             if (results !== null && results.length > 0) {
  798.                 printl("opencv.findImages找到 " + results.length + " 个匹配结果");
  799.                
  800.                 // 处理第一个结果
  801.                 var result = results[0];
  802.                 printl("位置: (" + result.x + ", " + result.y + ")");
  803.                 printl("相似度: " + result.similarity);
  804.                
  805.                 // 点击找到的位置
  806.                 touch.tap(result.x, result.y);
  807.                
  808.                 return true;
  809.             } else {
  810.                 printl("opencv.findImages未找到匹配结果");
  811.                 return false;
  812.             }
  813.         } else {
  814.             printl("❌ opencv模块不可用或findImages方法不存在");
  815.             return false;
  816.         }
  817.     } catch (e) {
  818.         printl("opencv.findImages执行错误: " + String(e));
  819.         return false;
  820.     }
  821. }



  822. /**
  823. * 创建图像对象
  824. * @param {string} path - 图像路径
  825. * @returns {Object} 图像对象
  826. */
  827. function createImage(path) {
  828.     try {
  829.         var img = new image();
  830.         img.read(path);
  831.         return img;
  832.     } catch (e) {
  833.         printl("创建图像对象错误: " + String(e));
  834.         return null;
  835.     }
  836. }

  837. /**
  838. * 演示KAZE图像查找
  839. * @returns {boolean} 是否成功
  840. */
  841. function demonstrateKAZEFindImage() {
  842.     printl("开始演示KAZE图像查找");
  843.    
  844.     try {
  845.         // 创建图像对象
  846.         var image1 = createImage("sdcard/auto/1.jpg");
  847.         var image2 = createImage("sdcard/auto/2.jpg");
  848.         
  849.         if (image1 && image2) {
  850.             var c = new Mat();
  851.             var res = opencv.findImageOneKAZE(image2.getMat(), image1.getMat(), c);
  852.             printl(res);
  853.             return true;
  854.         } else {
  855.             printl("创建图像对象失败");
  856.             return false;
  857.         }
  858.     } catch (e) {
  859.         printl("KAZE图像查找演示错误: " + String(e));
  860.         return false;
  861.     }
  862. }

  863. /**
  864. * 演示所有找图方法
  865. */
  866. function demonstrateAllFindImageMethods() {
  867.     printl("=== AIWROK 找图方法汇总示例 ===");
  868.    
  869.     // 安全获取APP版本
  870.     try {
  871.         if (typeof app !== 'undefined' && app && typeof app.version !== 'undefined') {
  872.             printl("APP版本: " + app.version);
  873.         } else {
  874.             printl("APP版本: 未知");
  875.         }
  876.     } catch (e) {
  877.         printl("获取APP版本失败: " + String(e));
  878.     }
  879.    
  880.     // 获取屏幕尺寸
  881.     var screenWidth = 1080;  // 默认值
  882.     var screenHeight = 1920; // 默认值
  883.    
  884.     try {
  885.         if (typeof screen !== 'undefined' && screen) {
  886.             if (typeof screen.getScreenWidth === 'function') {
  887.                 screenWidth = screen.getScreenWidth();
  888.                 screenHeight = screen.getScreenHeight();
  889.             }
  890.         }
  891.     } catch (e) {
  892.         printl("获取屏幕尺寸失败,使用默认值: " + String(e));
  893.     }
  894.    
  895.     printl("设备分辨率: " + screenWidth + "x" + screenHeight);
  896.    
  897.     // 1. 基础找图
  898.     printl("\n 1. 基础找图示例:");
  899.     basicFindImage();
  900.     sleep.second(1);
  901.    
  902.     // 2. 多图像查找
  903.     printl("\n 2. 多图像查找示例:");
  904.     multiFindImage();
  905.     sleep.second(1);
  906.    
  907.     // 3. 截图找图
  908.     printl("\n 3. 截图找图示例:");
  909.     screenshotFindImage();
  910.     sleep.second(1);
  911.    
  912.     // 4. SIFT图像查找
  913.     printl("\n 4. SIFT图像查找示例:");
  914.     siftFindImage();
  915.     sleep.second(1);
  916.    
  917.     // 5. 多点找色
  918.     printl("\n 5. 多点找色示例:");
  919.     multiColorFind();
  920.     sleep.second(1);
  921.    
  922.     printl("\n=== 找图方法演示完成 ===");
  923. }

  924. /**
  925. * 运行所有找图模块演示
  926. */
  927. function runAllFindImageModulesDemo() {
  928.     printl("开始执行找图方法汇总示例");
  929.    
  930.     // 演示基本找图方法
  931.     demonstrateAllFindImageMethods();
  932.    
  933.     // 演示opencv.findImagesEx
  934.     printl("\n演示opencv.findImagesEx:");
  935.     var detects = opencv.findImagesEx('图色823706.cv');
  936.     printl("opencv.findImagesEx结果: " + detects);
  937.     if (detects != null) {
  938.         printl("找到 " + detects.length + " 个匹配结果");
  939.         if (detects.length > 0) {
  940.             detects[0].click();
  941.         }
  942.     }
  943.    
  944.     // 演示opencv.findImages
  945.     printl("\n演示opencv.findImages:");
  946.     printl("opencv.findImages方法在当前AIWROK版本中不可用,跳过执行");
  947.    
  948.     printl("\n找图方法汇总示例执行完毕");
  949. }

  950. // 运行示例
  951. runAllFindImageModulesDemo();
复制代码


untoAIWROK软件滑动方法集合示例nextAIWROK软件找图方法汇总示例
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

相关导读了
    采集亚马逊正版群发工具有没有?
    Apr.20旅行X心语今天来说说YYPOST新功能的一个灵活用法,采集亚马逊商品信息,并且获得排名的软件,亚马逊现在越来越多客户做,淘宝的水是越来越清了,以前做电商的客户,现在都转战到外国,最赚钱的要数一些客户往亚马逊里堆了吧,拿我这个YYPOST的客户,最多的是采集,分析排名,刷价格,刷数量,改价,刷访问量等等技术

    企业发展B2B网站有什么东东软件可以发呢
    标题企业发展网B2B软件,现在虽然B2B网站收录不错,可愁的是心急的人们,他们太想一口吃撑胖子了,发帖宣传虽然不能像佛系那样淡定,但也不能像跑火车那般急躁对待,自己内容不收录,完全是自己操作内容问题,可以参考一下别人的内容是怎么弄的,然后自己要试着转变,而且收录这个内容,常常会变化的,不是一种规则就吃到老

    搜房天下房聊软件哪一个好呢
    本帖最后由 发帖软件 于 2019-5-22 16:15 编辑 2搜房天下群发房聊信息软件,开始本来打算做58同城的,但发一个就要一次点触验证码,这就让人没有感觉到存在的价值了吧,都是卖二手房和新房的搜房天下倒是可以发即时聊天信息,也没有发现他这个网站有啥子限制,登陆一个搜房天下账号,然后采集回来分类列表的网址,然后就一

    大家坛有没有好用的群发工具下载呢
    当你的笑容给我礼貌的招呼,大家坛全自动发帖软件,宣传推广是一场持久战,总是有一些人把软件用了一天,或是几个小时,就觉得自己付出太多了,那加进来的粉丝,或是流量,应该是和宣传多少成正比的,其实没有这么便宜的事,就像很多阅读量超过一百万的视频,或是电影,真正会在屏幕打赏的人不会超过三千,真正大额打赏给主

    群发正版软件中国塑料网
    中国塑料网群发软件YYPOST脚本下载地址,这个网站会有一个很奇怪的问题就是你在首页登陆无半个验证码,但在登陆网址登陆就会有一个验证码,所以我们灵活一些,在首页登陆就不用输入验证码了哈。网站秒收录比较高,但发的都是五金和建筑行业,先前有很多人都是发土建工程的大公司操作的,现在这个网站专为那个行业诞生的吧。

    OpenStreetMap网站正版2019年发帖工具下载
    本帖最后由 发帖软件 于 2019-5-21 11:13 编辑 OpenStreetMap网站全自动群发,OpenStreetMapOpenStreetMap(简称OSM,中文是公开地图)是一个网上地图协作计划,目标是创造一个内容自由且能让所有人编辑的世界地图。有的人编辑地图然后等收录,有的人发日志等收录,我们这里也是利用地图日志做为宣传的目标,简单的脚本理

    搜房天下全自动收短信全自动识别验证码注册账号软件
    房天下自动注册机,这个脚本是前几天发房聊的脚本廷伸品种,这个脚本能做到自动注册账号,自动保存账号,自动发房聊的效果,不过今天我们主要说一说怎么注册账号写脚本吧,这个搜房天天下的账号,可以发提问,可以发房聊,发论坛,发博客,还有发个人中心页都是有秒收的效果的,这样就省去了去买号,去乱花钱的效果了吧,而

    企业邮箱安卓端有什么APP软件可以发的呢
    请输入标题企业邮箱安卓发发送邮箱脚本,这个脚本是利用企业邮箱进行群发的,全程是一种模拟手工操作的过程,所以封号是很少的,而且企业邮箱群发到普通QQ邮箱不容易进垃圾箱中的,所以这个脚本也是这样的原理,不过最好是利用一些多开器,登陆多点的QQ邮箱账号会比较流畅一些,然后用软件一个一个的切换APP进行群发邮件会

    头条留评论软件有没有好用的呢?
    今天整一个今日头条留言软件,对于留言YYPOST是优势是比较大的存在,因为他往往专注一些下拉定位的优点,像今日头条这样,还是需要一些特殊下拉定位的,因为他新闻有长有短,有图有视频的,所以综合起来定位是比较难的,如果用POST也不是很轻松可以破解他的加密参数。这个脚本也是有一个不好的地方就是换号会比较麻烦,您电

    单网页生成神器
    最近新技术,网页生成机占领了整个网络的半壁江山,效果很疯狂,虽然不知道能持续多久,作为开发软件的领头者,一直在找收录的方法,一直在努力创新着,一直被人模仿,却从没有被超越过,这个网页生成机,已经出来有一段时间了,一直没有拿出来分享,醉过醉过,它是利用的一些小小收录漏洞整的,您最好用一些老站域名,进行

关闭
快速回复 返回列表 返回顶部
本站自动发贴软件,是现在最流行的做脚本软件,这种发贴工具,不但发贴收录快,而且抢占好的先机,完全自由编辑,实现针对性群发模拟操作,软件可以顶贴,也可以发贴,可以兼容支持Discuz、PHPWind、Dvbbs三大主流论坛,有手机验证码收件,邮件收发的功能,支持验证码识别,注册问题识别,多线程任务,自动上传头像,自动激活注册邮件,兼容防注册插件,本站软件原创正版,更新效率最快的原创软件。 『网络推广软件』『自动发帖软件』『 自动发帖