如何在R程序中创建可用于在图像上绘制轮廓的蒙版

时间:2020-09-24 01:27:38

标签: r image-processing image-segmentation

我有一个分割金属珠子的项目,我已经使用R中的以下代码(带有成像器库)完成了所有图像处理,最后得到的结果如最后所示。

metal <- imager::load.image('Entropy_2.jpeg')
plot(metal)
#gray <- imager::grayscale(metal)
#plot(gray)

blur_image <- imager::blur_anisotropic(metal, ampl = 1.25e5, sharp = 1)
plot(blur_image)
thresh <- imager::threshold(blur_image, thr = "94%", approx = TRUE, adjust = 1)
plot(thresh)
image_fill <- imager::bucketfill(thresh, x = 0, y = 1200,
sigma = .2, opacity = 0.2, high_connexity = TRUE)
plot(image_fill)
image_fill == 1
image_clean <- imager::clean(image_fill,0)
plot(image_clean)
image_filled <- imager::fill(image_clean, 20)
plot(image_filled)
clean_image <- split_connected(image_filled)

输入图像为:Entropy_2

使用上面显示的管道,我进入了这个面具 expected result

但是结果expected result会显示出所需的轮廓

我到过的地方的任何帮助都会得到承认

0 个答案:

没有答案
相关问题