【python】超像素分段【SLIC(simple linear iterative clustering)简单的线性迭代聚类】

【python】超像素分段【SLIC(simple linear iterative clustering)简单的线性迭代聚类】_第1张图片


# -*- coding: utf-8 -*-
"""
Created on Sun Sep 16 13:49:22 2018

@author: Lenovo
"""

# 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 numpy as np
#import argparse
import cv2
 
# 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 apply SLIC and extract (approximately)
# the supplied number of segments
image = cv2.imread('testbi.png')
segments = slic(img_as_float(image), n_segments = 20, sigma = 10)
 
#

你可能感兴趣的:(传统图像处理与深度学习,人工智能与深度学习算法研究,机器学习,人工智能)