add: images.findImage; change images.findColor implementation to opencv
This commit is contained in:
@@ -9,8 +9,8 @@ android {
|
||||
applicationId "com.stardust.scriptdroid"
|
||||
minSdkVersion 17
|
||||
targetSdkVersion 23
|
||||
versionCode 221
|
||||
versionName "3.0.0 Alpha21"
|
||||
versionCode 222
|
||||
versionName "3.0.0 Alpha22"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
ndk {
|
||||
|
||||
@@ -3,11 +3,10 @@ if(!requestScreenCapture()){
|
||||
stop();
|
||||
}
|
||||
var img = captureScreen();
|
||||
//0xffffff为白色
|
||||
toastLog("开始找色");
|
||||
//指定在位置(90, 220)宽高为900*1000的区域找色。
|
||||
//0xff00cc是编辑器的深粉红色字体(字符串)颜色
|
||||
var point = findColorInRegion(img, "#ff00cc", 90, 220, 900, 1000);
|
||||
//指定在位置(100, 220)宽高为400*400的区域找色。
|
||||
//#75438a是编辑器默认主题的棕红色字体(数字)颜色,位置大约在第5行的"2000",坐标大约为(283, 465)
|
||||
var point = findColorInRegion(img, "#75438a", 90, 220, 900, 1000);
|
||||
if(point){
|
||||
toastLog("x = " + point.x + ", y = " + point.y);
|
||||
}else{
|
||||
|
||||
@@ -4,8 +4,8 @@ if(!requestScreenCapture()){
|
||||
}
|
||||
var img = captureScreen();
|
||||
toastLog("开始找色");
|
||||
//0x006699为编辑器蓝色字体(var)的颜色
|
||||
//找到颜色与0x006699完全相等的颜色
|
||||
//0x1d75b3为编辑器默认主题蓝色字体(if, var等关键字)的颜色
|
||||
//找到颜色与0x1d75b3完全相等的颜色
|
||||
var point = findColorEquals(img, 0x006699);
|
||||
if(point){
|
||||
toastLog("x = " + point.x + ", y = " + point.y);
|
||||
|
||||
@@ -44,6 +44,9 @@ import com.stardust.scriptdroid.tool.AccessibilityServiceTool;
|
||||
import com.stardust.view.accessibility.LayoutInspector;
|
||||
import com.stardust.view.accessibility.NotificationListener;
|
||||
|
||||
import org.opencv.android.BaseLoaderCallback;
|
||||
import org.opencv.android.OpenCVLoader;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/4/2.
|
||||
@@ -78,7 +81,7 @@ public class AutoJs {
|
||||
mContext = context;
|
||||
mUiHandler = new UiHandler(context);
|
||||
mAppUtils = new AppUtils(context);
|
||||
mGlobalConsole = new GlobalStardustConsole(mUiHandler){
|
||||
mGlobalConsole = new GlobalStardustConsole(mUiHandler) {
|
||||
@Override
|
||||
public String println(int level, CharSequence charSequence) {
|
||||
String log = super.println(level, charSequence);
|
||||
@@ -93,6 +96,8 @@ public class AutoJs {
|
||||
mScriptEngineService.registerGlobalScriptExecutionListener(new ScriptExecutionGlobalListener());
|
||||
registerActivityLifecycleCallbacks();
|
||||
InputEventObserver.initGlobal(context);
|
||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_13, context, new BaseLoaderCallback(context) {
|
||||
});
|
||||
}
|
||||
|
||||
private ScriptEngineService buildScriptEngineService() {
|
||||
|
||||
BIN
app/src/main/jniLibs/armeabi-v7a/libopencv_core.a
Normal file
BIN
app/src/main/jniLibs/armeabi-v7a/libopencv_core.a
Normal file
Binary file not shown.
BIN
app/src/main/jniLibs/armeabi-v7a/libopencv_imgproc.a
Normal file
BIN
app/src/main/jniLibs/armeabi-v7a/libopencv_imgproc.a
Normal file
Binary file not shown.
Reference in New Issue
Block a user