我在script.py
中插入了更多功能,以使其一次全部处理,但是当我从端子python script.py
启动时,他停止了运行而未运行其他功能。因此,在完成第一个过程之后,python会返回到终端。我已经阅读了像我这样的几种情况,建议在代码末尾插入input(),但这对我不起作用。我正在使用ubuntu。
import rsgislib
from rsgislib.segmentation import segutils
img='/home/ubuntu/remote_sensing/dati_input/stack_rgb.tif'
img_clump='/home/ubuntu/remote_sensing/output_raster/segmentato.tif'
img_mean='/home/ubuntu/remote_sensing/cache/'
segutils.runShepherdSegmentation(img,img_clump,img_mean,gdalformat='GTiff',numClusters=500,minPxls=435,distThres=500,sampling=500,kmMaxIter=500)
这里停止
import shutil
shutil.rmtree('/home/ubuntu/remote_sensing/cache/')
import os
stream = os.popen('gdal_polygonize.py /home/ubuntu/remote_sensing/output_raster/segmentato.tif /home/ubuntu/remote_sensing/output_shp/segmentato.shp -b 1 -f "Esri Shapefile"')
output = stream.read()
output