Opencv学习笔记 超像素分割
生活随笔
收集整理的這篇文章主要介紹了
Opencv学习笔记 超像素分割
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
? ? ? ? 在計算機視覺領域,圖像分割(Segmentation)指的是將數字圖像細分為多個圖像子區域(像素的集合)(也被稱作超像素)的過程。超像素由一系列位置相鄰且顏色、亮度、紋理等特征相似的像素點組成的小區域。這些小區域大多保留了進一步進行圖像分割的有效信息,且一般不會破壞圖像中物體的邊界信息。 圖像分割的結果是圖像上子區域的集合(這些子區域的全體覆蓋了整個圖像),或是從圖像中提取的輪廓線的集合(例如邊緣檢測)。一個子區域中的每個像素在某種特性的度量下或是由計算得出的特性都是相似的,例如顏色、亮度、紋理。鄰接區域在某種特性的度量下有很大的不同。
? ? ? ? 超像素分割有什么用處?超像素可以用來做跟蹤;可以做標簽分類;視頻前景分割,因為相比像素,超像素處理速度會快幾十倍、幾百倍甚至更高;超像素還可以用于骨架提取、人體姿態估計、醫學圖像分割等方面。
? ? ? ? Python參考代碼如下:
# import the necessary packages from skimage.segmentation import slic from skimage.segmentation import mark_boundaries from skimage.util import img_as_float from skimage import io import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import argparse # construct the argument parser and parse the arguments # ap = argparse.ArgumentParser() # ap.add_argument("-i", "--image", required = True, help = "Path to the image") # args = vars(ap.parse_args()) # load the image and convert it to a floating point data type image = img_as_float(io.imread("C:/Users/zyh/Desktop/QQ圖片20200922073254.png")) # loop over the number of segments for numSegments in (100, 200, 300):# apply SLIC and extract (approximately) the supplied number# of segmentssegments = slic(image, n_segments = numSegments, sigma = 5)# show the output of SLICfig = plt.figure("Superpixels -- %d segments" % (numSegments))ax = fig.add_subplot(1, 1, 1)ax.imshow(mark_boundaries(image, segments))plt.axis("off") # show the plots plt.show() 原圖? ? ? ? OpenCv的超像素分割算法:opencv——superpixel算法——SLIC,SEEDS,LSC_莫談天下-CSDN博客_opencv slic?
總結
以上是生活随笔為你收集整理的Opencv学习笔记 超像素分割的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 随机种子的详解
- 下一篇: VGG16和VGG19网络结构图