顶象差异点击识别验证算法
文章只提供学习,如有侵权请立即联系我。
对于这种 差异点击验证 可以通过算法进行 识别
还原图片之后
识别图片之后
说一下思路哈
思路懒得说了 反正 你通过深度学习能够获取更为准确的识别结果
但是我不想标数据集呀 只好写一个直接可以解决的代码进行解决了
下面我就贴一下我的代码了
唯一的确定就是 颜色 不同的 识别准确性不行 因为我做二值化处理了
所以 。。。。。。。。。。。。。。
好了 不多说了 上代码
public class IConUtil {
static {
try {
if (SystemUtils.IS_OS_WINDOWS) {
//要用到 opencv
String path = IConUtil.class.getResource("/win/x64/opencv_java3412.dll").getPath();
System.load(path);
} else if (SystemUtils.IS_OS_LINUX) {
System.out.println("linux");
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
//传入图片路径 返回图片的坐标
String s = predict10("C:\\dx\\notun\\1639375094033bj.png");
System.out.println(s);
}
/**
* 识别图标
*
* @param originPath
* @param iconPaths
* @param totalPath
*/
public static String predict(String originPath, String[] iconPaths, String totalPath) {
Mat afterMat = Imgcodecs.imread(totalPath);
String aferterPoint = "";
for (int i = 0; i < iconPaths.length; i++) {
double[] predict = predict(originPath, iconPaths[i]);
if (predict.length > 0) {
Imgproc.rectangle(afterMat, new Point(predict[0], predict[1]), new Point(predict[2], predict[3]), new Scalar(0, 0, 225));
} else {
return "";
}
int x = (int) (predict[0] + (predict[2] - predict[0]) / 2);
int y = (int) (predict[1] + (predict[3] - predict[1]) / 2);
aferterPoint += x + "," + y + "|";
Imgproc.putText(afterMat, i + "", new Point(x, y), Imgproc.FONT_HERSHEY_COMPLEX, 1, new Scalar(0, 255, 0));
}
Imgcodecs