按照JM区分

master
chenzenghui 2025-09-22 18:07:46 +08:00
parent 595751a3c3
commit c702658884
3 changed files with 15 additions and 7 deletions

View File

@ -71,10 +71,14 @@ def processMJPort(srcFolderPath,outMJPortSumTxtPath,outMJPortFolderPath,MLCShape
)
if os.system(cmdtxt) ==2:
print("sucess:",cmdtxt)
return "sucess: {}".format(cmdtxt)
writeoutlog(logPath, "sucess: {}\n".format(cmdtxt))
# return "sucess: {}".format(cmdtxt)
return 2
else:
print("failed:",cmdtxt)
return "failed: {}".format(cmdtxt)
writeoutlog(logPath, "failed: {}\n".format(cmdtxt))
# return "failed: {}".format(cmdtxt)
return 3
def preProcessShipPortTools(srcFolderPath,targetFolderPath,outTargetFolderPath):
@ -98,12 +102,15 @@ def preProcessShipPortTools(srcFolderPath,targetFolderPath,outTargetFolderPath):
outMJPortSumTxtPath=os.path.join(targetFolderPath,"AC-图像预处理","sumMJPort.txt")
outMJPortFolderPath=os.path.join(targetFolderPath,"AC-图像预处理","sumMJPortFolder")
existOrCreate(outMJPortFolderPath)
MLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\港口(民船).shp"
JLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\军港.shp"
MJLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\军民一体港口.shp"
processMJPortflag=processMJPort(srcFolderPath,outMJPortSumTxtPath,outMJPortFolderPath,MLCShapeFilePath,JLCShapeFilePath,MJLCShapeFilePath)
# 港口归属
if processMJPort(srcFolderPath,outMJPortSumTxtPath,outMJPortFolderPath,MLCShapeFilePath,JLCShapeFilePath,MJLCShapeFilePath)==2:
if processMJPortflag==2:
# 逐行处理
MJlines=None
with open(outMJPortSumTxtPath,"r",encoding="utf-8") as f:
@ -119,7 +126,7 @@ def preProcessShipPortTools(srcFolderPath,targetFolderPath,outTargetFolderPath):
for linestr in MJlines:
if len(linestr)>3:
clsname=linestr.split("\t\t")[0]
tiffpath=linestr.split("\t\t")[1]
tiffpath=linestr.split("\t\t")[1].replace("\n","")
rootname=Path(tiffpath).stem
portTxtpath = os.path.join(outMJPortFolderPath, rootname + ".txt")
tarPortFolder=None
@ -171,8 +178,8 @@ if __name__ == '__main__':
#
# 20250826-不分类 条带模式
srcFolderPath = r"R:\TYSAR-德清院\TYSAR-条带模式(SM)\港口\20250826-不分类\0-原图"
preFolderPath = r"D:\TYSAR-德清院\TYSAR-条带模式(SM)\港口\20250826-不分类\A-预处理\AB-图像预处理"
targetfolderPath = r"R:\TYSAR-德清院\TYSAR-条带模式(SM)\港口\20250826-不分类\A-预处理\AB-图像预处理"
preFolderPath = r"D:\TYSAR-德清院\TYSAR-条带模式(SM)\港口\20250826-不分类\A-预处理"
targetfolderPath = r"R:\TYSAR-德清院\TYSAR-条带模式(SM)\港口\20250826-不分类\A-预处理"
preProcessShipPortTools(srcFolderPath, preFolderPath, targetfolderPath)

View File

@ -389,6 +389,7 @@ def stretchSliceProcess(infilepath, outfolder,portfilestr, strechmethod):
allImagePath=os.path.join(allpngfolder, rootname+"_all.png")
Image.fromarray(im_data).save(allImagePath,compress_level=0)
slice_ID=sliceShipDataset(rootname,im_data, src_im_data,im_Geotrans, im_proj, outfolder)
slice_ID=slice_ID+1
slice_ID=slicePortDataset(rootname,im_data, src_im_data,im_Geotrans, im_proj, outfolder,slice_ID,portfilestr)
print("图像切片与拉伸完成")
pass

View File

@ -257,7 +257,7 @@ def SpliteProcess(srcfolderpath,outfolderPath,outfilepath,MLCPath,JLCPath,JMLCPa
JLCName:KDTree(shipPort[JLCName]),
# "JMLC":KDTree(shipPort["JMLC"]),
}
srcFolderPath_0img=os.path.join(srcfolderpath,"0-原图") # 0-原图 文件路径
srcFolderPath_0img=os.path.join(srcfolderpath) # 0-原图 文件路径
getTiffInPort(shipPortTree, srcFolderPath_0img, outfilepath,outfolderPath)
return True
pass