估计阅读时长: 2 分钟

imports "clustering" from "MLkit";

require(graphics2D);

multishapes = read.csv("./multishapes.csv");
[x, y] = list(multishapes[, "x"], multishapes[, "y"]);
print(multishapes, max.print = 13);

# detect object shapes
objects = graphics2D::pointVector(multishapes[, "x"], multishapes[, "y"]) |> dbscan_objects();
objects[objects == "-1"] = "noise";
objects = ifelse(objects == "noise", objects, `object_${objects}`);

# show object detection result
bitmap(file = "./object_detection.png") {
    plot(multishapes[, "x"], multishapes[, "y"], 
        class     = objects, 
        grid.fill = "white",
        padding   = "padding: 125px 300px 200px 200px;",
        colorSet  = "paper"
    );
}
谢桂纲
Latest posts by 谢桂纲 (see all)

Attachments

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *

博客文章
July 2025
S M T W T F S
 12345
6789101112
13141516171819
20212223242526
2728293031  
  1. […] 这个时候,可能你就会惊呼了,这怎么可能,我们通过ssh远程上去的Linux终端就是一个纯文本组成的命令行,怎么可能直接显示图片呢。只要思想不滑坡,办法总是有的。可能你之前会了解过通过ASCII Art的方式在Linux终端上显示图像:对于ASCII Art方式,我们会将不同像素点的亮度信息(或者说灰度信息)映射到占据不同显示面积的字符上,从而组成了一副可以显示灰度差异的黑白字符画。这个方法可以解决我们的一部分显示需求,但是不多。 […]