Skip to content
Snippets Groups Projects
Commit d4e8eb67 authored by pascal.mouquet_ird.fr's avatar pascal.mouquet_ird.fr
Browse files

add b11 masking dilatation 6px

parent 88aaacba
No related branches found
No related tags found
No related merge requests found
......@@ -370,21 +370,28 @@ def create_cloud_mask_b11(
BinaryMorphologicalOperation.ExecuteAndWriteOutput()
# Masquage du masque
logger.info("00")
BandMath = otbApplication.Registry.CreateApplication("BandMath")
logger.info("01")
BandMath.SetParameterStringList("il", [str(cloud_mask),str(out_dilate)])
logger.info("02")
BandMath.SetParameterString("out", out_mask)
BandMath.SetParameterOutputImagePixelType("out", 0)
logger.info("03")
BandMath.SetParameterString("exp", "(im1b1 == 1) * (im2b1 == 0)")
logger.info("04")
BandMath.ExecuteAndWriteOutput()
logger.info("05")
# Dilatation
BinaryMorphologicalOperation = otbApplication.Registry.CreateApplication("BinaryMorphologicalOperation")
BinaryMorphologicalOperation.SetParameterString("in", out_mask)
BinaryMorphologicalOperation.SetParameterString("out", out_dilate)
BinaryMorphologicalOperation.SetParameterOutputImagePixelType("out", 0)
BinaryMorphologicalOperation.SetParameterInt("channel", 1)
BinaryMorphologicalOperation.SetParameterInt("structype.ball.xradius", dilatation+1)
BinaryMorphologicalOperation.SetParameterInt("structype.ball.yradius", dilatation+1)
BinaryMorphologicalOperation.SetParameterFloat("filter.dilate.foreval", 1)
BinaryMorphologicalOperation.SetParameterString("filter", "dilate")
BinaryMorphologicalOperation.ExecuteAndWriteOutput()
# Save to JP2000
src_ds = gdal.Open(out_mask)
src_ds = gdal.Open(out_dilate)
driver = gdal.GetDriverByName("JP2OpenJPEG")
dst_ds = driver.CreateCopy(str(out_path), src_ds,
options=["CODEC=JP2", "QUALITY=100", "REVERSIBLE=YES", "YCBCR420=NO"])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment