The paths are fine, and the 4th parameter is optional, but just for giggles I tried specifying that parameter and experienced the same behavior.
This is how it looks in the Results window, after having run successfully within ArcMap:
It also works in the Python window within ArcMap:
arcpy.gp.SegmentMeanShift_sa("D:/REDACTED/master.img", "D:/REDACTED/segments.img", "20", "15", "10", "1 2 3")
But not in a standalone script:
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 2016.2.3\helpers\pydev\_pydevd_bundle\pydevd_exec.py", line 3, in Exec
exec exp in global_vars, local_vars
File "<input>", line 1, in <module>
File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\geoprocessing\_base.py", line 506, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
ExecuteError: ERROR 999998: Unexpected Error.
Failed to execute (SegmentMeanShift).
I have tried two different syntaxes in the script:
segments = SegmentMeanShift(in_raster, 20.0, 15, 10, '1 2 3')
and
arcpy.gp.SegmentMeanShift_sa(in_raster, segments, 20.0, 15, 10, "1 2 3")