ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Segment Mean Shift

Available with Spatial Analyst license.

  • Summary
  • Usage
  • Syntax
  • Code Sample
  • Environments
  • Licensing Information

Summary

Identify features or segments in your imagery by grouping adjacent pixels together that have similar spectral characteristics. You may control the amount of spatial and spectral smoothing to help derive features of interest.

Usage

  • The input can be any Esri supported raster, with any valid bit depth.

  • The Band Index parameter is a list of three bands separated by a space delimiter.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Syntax

SegmentMeanShift (in_raster, {spectral_detail}, {spatial_detail}, {min_segment_size}, {band_indexes})
ParameterExplanationData Type
in_raster

Select the raster dataset you want to segment. This can be a multispectral or grayscale image.

To achieve optimal results, use the Symbology tab in the dataset properties to interactively stretch your imagery so the features you want to classify are apparent. Then use these optimal settings in the stretch raster function to enhance your imagery for optimum results.

Raster Dataset | Mosaic Dataset | Raster Layer | Mosaic Layer | Image Service Layer
spectral_detail
(Optional)

Set the level of importance given to the spectral differences of features in your imagery.

Valid values range from 1.0 to 20.0. A higher value is appropriate when you have features you want to classify separately but have somewhat similar spectral characteristics. Smaller values create spectrally smoother outputs. For example, with higher spectral detail in a forested scene, you will be able to have greater discrimination between the different tree species.

Double
spatial_detail
(Optional)

Set the level of importance given to the proximity between features in your imagery.

Valid values range from one to 20. A higher value is appropriate for a scene where your features of interest are small and clustered together. Smaller values create spatially smoother outputs. For example, in an urban scene, you could classify an impervious surface using a smaller spatial detail, or you could classify buildings and roads as separate classes using a higher spatial detail.

Long
min_segment_size
(Optional)

Merge segments smaller than this size with their best fitting neighbor segment.

Units are in pixels.

Long
band_indexes
(Optional)

Select the bands you want to use to segment your imagery separated by a space.

You want to select bands that offer the most differentiation between the features of interest.

String

Return Value

NameExplanationData Type
out_raster_dataset

Specify a name and extension for the output dataset.

If your input was a multispectral image, the output will be an 8-bit RGB image. If the input was a grayscale image, the output will be an 8-bit grayscale image.

Raster

Code Sample

SegmentMeanShift example 1 (Python window)

This example creates an output with a minimum segment size of 20, using the near-infrared, red, and green inputs.

import arcpy
from arcpy.sa import *

seg_raster = SegmentMeanShift("c:/test/moncton.tif", "15", "10", "20", "4 3 2")

seg_raster.save("c:/test/moncton_seg.tif")
SegmentMeanShift example 2 (stand-alone script)

This example performs a segment mean shift to create an output with a minimum segment size of 20, using the near-infrared, red, and green inputs.

# Import system modules
import arcpy
from arcpy.sa import *


# Set local variables
inRaster = "c:/test/moncton.tif"
spectral_detail = "14.5"
spatial_detail = "10"
min_segment_size = "20"
band_indexes = "4 3 2"

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute 
seg_raster = SegmentMeanShift(inRaster, spectral_detail, spatial_detail, 
                              min_segment_size, min_segment_size)

# Save the output 
seg_raster.save("c:/output/moncton_seg.tif")

Environments

  • Auto Commit
  • Cell Size
  • Compression
  • Current Workspace
  • Extent
  • Geographic Transformations
  • Mask
  • NoData
  • Output CONFIG Keyword
  • Output Coordinate System
  • Pyramid
  • Raster Statistics
  • Scratch Workspace
  • Snap Raster
  • Tile Size

Licensing Information

  • ArcGIS for Desktop Basic: Requires Spatial Analyst
  • ArcGIS for Desktop Standard: Requires Spatial Analyst
  • ArcGIS for Desktop Advanced: Requires Spatial Analyst

Related Topics

  • An overview of the Segmentation and Classification toolset
  • What is image classification?
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal