找色函数放入循环后,运行几圈就提示对象为空?
07:19:36.895/E: Wrapped java.lang.NullPointerException: Attempt to invoke virtual method 'org.opencv.core.Mat com.stardust.autojs.core.image.ImageWrapper.getMat()' on a null object reference (images.js#78)
at script(images.js:78)
at script(<模糊找色>:10)
var i=1;
while(i<11){
if(!requestScreenCapture()){
toast("请求截图失败");
exit();
}
var img = captureScreen();
//0x9966ff为编辑器紫色字体的颜色
toastLog("开始找色");
var point = findColor(img, 0x9966ff);
if(point){
toastLog("x = " + point.x + ", y = " + point.y);
}else{
toastLog("没有找到");
}
i++;
}