信息发布软件,b2b软件,广告发布软件

 找回密码
 立即注册
搜索
查看: 1|回复: 0
打印 上一主题 下一主题

[宣传软件网站动态] AIWROK软件找图方法汇总示例

[复制链接]

775

主题

859

帖子

5506

积分

积分
5506

资讯缩略图:

资讯发布日期:2026-02-05

资讯发布简介:AIWROK软件找图方法汇总示例

资讯关键词:AIWROK软件找图方法汇总示例

资讯所属分类:IT资讯 

联系:

① 本信息收集于网络,如有不对的地方欢迎联系我纠正!
② 本信息免费收录,不存在价格的问题!
③ 如果您的网站也想这样出现在这里,请您加好友情链接,我当天会审核通过!

④友情链接关键字:软件网站分类目录 网址:http://www.postbbs.com/

资讯详细描述
AIWROK软件找图方法汇总示例
AIWROK软件找图方法汇总示例 b2b软件

AIWROK软件找图方法汇总示例 b2b软件

  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软件滑动方法集合示例nextnocontent
回复

使用道具 举报

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

本版积分规则

相关导读
信息发布软件AIWROK软件找图方法汇总示例
AIWROK软件找图方法汇总示例
信息发布软件AIWROK软件滑动方法集合示例
AIWROK软件滑动方法集合示例
信息发布软件AIWROK软件安卓AIWROK汇集软件点击
AIWROK软件安卓AIWROK汇集软件点击
信息发布软件苹果系统点击方法综合示例
苹果系统点击方法综合示例
信息发布软件AIWROK苹果系统找图方法完整示例集合
AIWROK苹果系统找图方法完整示例集合
信息发布软件苹果系统找图方法完整示例集合
苹果系统找图方法完整示例集合
信息发布软件苹果IOS系统找字OCR方法例子
苹果IOS系统找字OCR方法例子
信息发布软件AIWORK软件数组高级示例
AIWORK软件数组高级示例
信息发布软件AIWROK软件运算符封装库示例
AIWROK软件运算符封装库示例
信息发布软件AIWROK软件语法运行小示例
AIWROK软件语法运行小示例
信息发布软件AIWROK软件JS循环小示例
AIWROK软件JS循环小示例
信息发布软件AIWROK软件H5网页被主脚本获取值用法
AIWROK软件H5网页被主脚本获取值用法
信息发布软件AIWROK软件创建可暂停恢复的多线程任务
AIWROK软件创建可暂停恢复的多线程任务
信息发布软件AIWROK软件类型转换方法例子
AIWROK软件类型转换方法例子
信息发布软件AIWROK软件H5脚本执行与进度显示
AIWROK软件H5脚本执行与进度显示 .
信息发布软件AIWROK软件根据时间段执行异步任务支持多线程并行处理
AIWROK软件根据时间段执行异步任务支持多线程并行处理
信息发布软件H5自动开关执行脚本功能演示
H5自动开关执行脚本功能演示
信息发布软件AIWROK软件H5单选脚本运行示例
AIWROK软件H5单选脚本运行示例
信息发布软件H5任务脚本选择与执行中心
H5任务脚本选择与执行中心
信息发布软件H5里CheckBox控件演示
H5里CheckBox控件演示
信息发布软件AIWROK软件正则用法实际例子
AIWROK软件正则用法实际例子
信息发布软件AIWROK软件权限管理器实现
AIWROK软件权限管理器实现
信息发布软件AIWORK软件节点方法无碍示例子
AIWORK软件节点方法无碍示例子
信息发布软件JSON.stringify 和 JSON.parse 完整示例
JSON.stringify 和 JSON.parse 完整示例
信息发布软件AIWROK软件展示JavaScript各种语句标识符的用法
AIWROK软件展示JavaScript各种语句标识符的用法
信息发布软件JS巧妙地组合使用各种条件语句
JS巧妙地组合使用各种条件语句
信息发布软件AIWROK手机数据库MySQL数据库截图片批量上传操作脚本
AIWROK手机数据库MySQL数据库截图片批量上传操作脚本
信息发布软件HID中文输入智能打字功能
HID中文输入智能打字功能
信息发布软件AIWROK软件对象工具函数库例子
AIWROK软件对象工具函数库例子
信息发布软件AIWROK软件H5交互演示黄色主题
AIWROK软件H5交互演示黄色主题
信息发布软件H5单按钮执行脚本示例
H5单按钮执行脚本示例
信息发布软件苹果H5界面完整调用脚本示例
苹果H5界面完整调用脚本示例
信息发布软件AIWROK软件平台设备信息全面检测工具例子
AIWROK软件平台设备信息全面检测工具例子
信息发布软件AIWROK创建和放大日志窗口并展示动态内容
AIWROK创建和放大日志窗口并展示动态内容
信息发布软件AIWROK软件device相关方法获取设备信息例子
AIWROK软件device相关方法获取设备信息例子[/backcolor]
信息发布软件数据库MySQL实时内容随机调用
数据库MySQL实时内容随机调用
信息发布软件AIWROK软件分享一个特效苹果H5页面
AIWROK软件分享一个特效苹果H5页面
信息发布软件数据库MYQ业务流程心跳程序启动
数据库MYQ业务流程心跳程序启动
信息发布软件数据库MySQL功能支持创建表插入中文数据查询删除功能例子
数据库MySQL功能支持创建表插入中文数据查询删除功能例子
信息发布软件AIWROK软件Zip 高级操作复杂示例
AIWROK软件Zip 高级操作复杂示例
信息发布软件AIWROK软件txt_文件读写方法小结
AIWROK软件txt_文件读写方法小结
信息发布软件AIWROK软件file文件操作方法小结
AIWROK软件file文件操作方法小结
信息发布软件AIWORK软件配置读写H5演示配套脚本
AIWORK软件配置读写H5演示配套脚本
信息发布软件AIWROK配置读写功能演示示例
AIWROK配置读写功能演示示例
信息发布软件AIWROK截图缓存工具
AIWROK截图缓存工具
信息发布软件AIWROK线程许可证工具
AIWROK线程许可证工具
信息发布软件整理了AIWROK环境下常用的Date对象和sleep对象方法
整理了AIWROK环境下常用的Date对象和sleep对象方法
信息发布软件FastUI界面普通用法
FastUI界面普通用法
信息发布软件FastUI界面类[window]方法小结
FastUI界面类[window]方法小结 方法 1:close(关闭指定窗口)方法 2:closeAll(关闭所有窗口)方法 3:loadUI(加载 UI 界面)方法 4:onClose(监听窗口关闭事件)方法 5:onLoad(监听窗口加载事件)方法 6:setFull(设置窗口全屏)方法 7:setHeight(设置窗口高度)方法 8:setHidden(隐藏窗口)方法 9:setLeft(设置窗口 X 轴坐标)方法 10:setTop(设置窗口 Y 轴坐标)方法 11:setVisable(显示隐藏的窗口)方
信息发布软件AIWROK软件按钮监听UI界面与事件监听功能演示
AIWROK软件按钮监听UI界面与事件监听功能演示.
信息发布软件AWIROK软件多选[uiCheckBox]方法小结
AWIROK软件多选方法小结 方法一:findByID 加载多选控件方法二:getAllChecked 获取所有选中项方法三:getAllSelect 获取所有选项方法四:getChecked 获取某个选项是否选中方法五:setChecked 设置某个选项是否选中方法六:setCheckeds 设置多个选项是否选中方法七:setHeight 设置高度
信息发布软件AIWROK日志演示开启日志显示 → 放大 → 关闭代码
AIWROK日志演示开启日志显示 → 放大 → 关闭代码
信息发布软件&#127983;AIWROK数组方法高级应用案例
🏯AIWROK数组方法高级应用案例
信息发布软件AIWROK软件日志悬浮窗简化版自动切换位置
AIWROK软件日志悬浮窗简化版自动切换位置
信息发布软件AIWROK软件String实例演示
AIWROK软件String实例演示
信息发布软件AIWROK软件S内置String类[String]方法小结
AIWROK软件S内置String类[String]方法小结 方法 1:charAt[/backcolor]方法 2:charCodeAt[/backcolor]方法 3:indexOf[/backcolor]方法 4:lastIndexOf[/backcolor]方法 5:length[/backcolor]方法 6:match[/backcolor]方法 7:replace[/backcolor]方法 8:replaceAll[/backcolor]方法 9:split[/backcolor]方法 10:startsWith[/backcolor]方法 11:substr[/backcolor]方法 12:substring[/backcolor]方法 13:trim[/backcol
信息发布软件AIWROK软件完整的WebSocket客户端示例
这段代码是一个完整的WebSocket客户端示例,用于连接到指定的WebSocket服务器并处理各种事件。具体来说,代码的作用如下: 定义服务器地址:首先定义了一个服务器的IP地址和端口号 var ip = "154.37.221.104:8886";。 创建WebSocket对象:尝试创建一个新的WebSocket对象 var ws = new WebSocket();。注意,这里的 new ws() 应该是 new WebSocket()。 添加事件监听器:代码中尝试为WebSocket对象添加事件监听器,但这里有一个错误。
信息发布软件AIWROK软件苹果系统中实现四种基本滑动操作
AIWROK软件苹果系统中实现四种基本滑动操作
信息发布软件hid的滑动没有百分比坐标滑动吗
hid的滑动没有百分比坐标滑动吗
信息发布软件单选控件[uiRadioButton]方法小结
单选控件方法小结 方法 1:加载单选控件[/backcolor]方法 2:获取选中项[/backcolor]方法 3:设置高度[/backcolor]方法 4:设置选中项[/backcolor]
信息发布软件AIWROK软件无障碍触摸操作示例:点击、左右滑动、上下滑动实例
AIWROK软件无障碍触摸操作示例:点击、左右滑动、上下滑动实例
信息发布软件AIWROK软件安卓随机工具应用函数生成
AIWROK软件安卓随机工具应用函数生成
信息发布软件用在AIWORK软件代码中的实用符号分类整理2
用在AIWORK软件代码中的实用符号分类整理2 软件IDE用Emoji符号分类整理(含用途说明)一、表情与情感1. 微笑 [*]😀 笑脸(基础开心反馈,用于操作成功后的友好提示) [*]😃 笑脸大眼睛(强化开心情绪,用于重要任务完成后的积极反馈) [*]😄 笑脸和微笑的眼睛(温和友好的状态,用于日常交互中的正向回应) [*]😁 带着微笑的眼睛(轻松愉悦的反馈,用于轻度成功或趣味操作) [*]
信息发布软件AIWROK软件图像二值化的各种方法和应用场景
AIWROK软件图像二值化的各种方法和应用场景
信息发布软件AIWROK软件找图区分页面变化和卡死状态
AIWROK软件找图区分页面变化和卡死状态

QQ|( 京ICP备09078825号 )

本网站信息发布软件,是可以发布论坛,发送信息到各大博客,各大b2b软件自动发布,好不夸张的说:只要手工能发在电脑打开IE能发的网站,用这个宣传软件就可以仿制动作,进行推送发到您想发送的B2B网站或是信息发布平台上,不管是后台,还是前台,都可以进行最方便的广告发布,这个广告发布软件,可以按月购买,还可以试用软件,对网站的验证码也可以完全自动对信息发布,让客户自动找上门,使企业轻松实现b2b发布,这个信息发布软件,均是本站原创正版开发,拥有正版的血统,想要新功能,欢迎提意见给我,一好的分类信息群发软件在手,舍我其谁。QQ896757558

GMT+8, 2026-2-5 10:37 , Processed in 0.598818 second(s), 52 queries .

宣传软件--信息发布软件--b2b软件广告发布软件

快速回复 返回顶部 返回列表