From 1040942f3fa95bd2c5ffb508bb35390e5d5ca7d8 Mon Sep 17 00:00:00 2001 From: Ouyang Date: Wed, 10 Jun 2020 17:54:59 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=89=8B=E5=8A=BF=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E7=BB=98=E5=88=B6=E8=BD=A8=E8=BF=B9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...73\230\345\210\266\350\275\250\350\277\271" | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 "\346\211\213\345\212\277\351\252\214\350\257\201\347\240\201\347\273\230\345\210\266\350\275\250\350\277\271" diff --git "a/\346\211\213\345\212\277\351\252\214\350\257\201\347\240\201\347\273\230\345\210\266\350\275\250\350\277\271" "b/\346\211\213\345\212\277\351\252\214\350\257\201\347\240\201\347\273\230\345\210\266\350\275\250\350\277\271" new file mode 100644 index 0000000..f8fb82c --- /dev/null +++ "b/\346\211\213\345\212\277\351\252\214\350\257\201\347\240\201\347\273\230\345\210\266\350\275\250\350\277\271" @@ -0,0 +1,18 @@ +Collections.sort(list, (o1, o2) -> (int) (o1.x - o2.x)); +List line = new ArrayList<>(); +for (Point point : list) { + if (line.size() == 0) { + line.add(point); + continue; + } + Point compare = line.get(line.size() - 1); + double distance = Math.sqrt(Math.pow(point.y - compare.y, 2) + Math.pow(point.x - compare.x, 2)); + if (distance > step) { + line.add(point); + } +} +if (null != result) { + for (Point point : line) { + Imgproc.drawMarker(result, point, new Scalar(0, 0, 255)); + } +} -- Gitee