python: use the slic function of the Scikit-image library to segment remote sensing images

Author: CSDN @ _Yakult_

This article records the code for superpixel segmentation using the slic function in the skimage.segmentation module of the Scikit-image library.

insert image description here



1. Detailed explanation of slic function

In the skimage.segmentation module of the Scikit-image library, the slic function is used for superpixel segmentation. The parameters of this function have the following meanings:

  • image : The input image to be segmented, either grayscale or color. For color images, superpixel segmentation will be performed in color space.

  • n_segments : desired number of superpixels. Larger values ​​produce more superpixels, smaller values ​​produce fewer superpixels. Generally, the larger the value, the more detailed the segmentation.

  • compactness : The compactness parameter used to adjust the shape of superpixels. Larger values ​​make superpixels more compact and more regularly shaped, while smaller values ​​result in more irregular shapes.

Guess you like

Origin blog.csdn.net/qq_35591253/article/details/131306326