Segmentation: A SLIC Superpixel Tutorial using Python(超级像素(像素网格分类))

5 篇文章 0 订阅
5 篇文章 0 订阅

Segmentation: A SLIC Superpixel Tutorial using Python(超级像素(像素网格分类))

涉及到的原文引用:

代码出处

论文

工具库

translator:aaron-clark-aic

超级像素点的介绍

像素网格化是一个很常见的机器视觉算法,比如人脸检测就是利用一个固定大小的匹配模板在图像中遍历寻找适合的像素位置。超级像素点方式可以让我们自定义图像分割尺寸,比如按照像素分组分割100/300/500份网格,分割成的网格中每个像素点都在色彩和特征上高度一致。

超级像素点的使用场景分析

我们可以假设,一个物体使用边缘检测的时候,某些情况下边缘有可能模糊或者错误。使用超级像素点可以在一定程度上去修正这种边缘的错误。也就是保证切图区域更加合理。

在这里插入图片描述

超级像素点的代码实现

在这里插入图片描述

# import the necessary packages
from skimage.segmentation import slic
from skimage.segmentation import mark_boundaries
from skimage.util import img_as_float
import matplotlib.pyplot as plt
import cv2 as cv

# load the image and convert it to a floating point data type
image = img_as_float(cv.imread(".././img/base.jpg"))

fig = plt.figure()
# loop over the number of segments
for numSegments, i in ((100, 1), (200, 2), (300, 3)):
	# apply SLIC and extract (approximately) the supplied number
	# of segments
	segments = slic(image, n_segments = numSegments, sigma = 5)

	# show the output of SLIC
	ax = fig.add_subplot(3, 1, i)
	ax.set_title("Superpixels -- %d segments" % (numSegments))
	ax.imshow(mark_boundaries(image, segments))
	plt.axis("off")

# show the plots
plt.show()
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值