def bowtie_py(modis_img,p,cs):
print 'removie bowtie effect from image... '
stripwidth=10000/cs
#Loop over every x coordinate of the image
for x in sp.arange(modis_img.shape[1]):
#Loop over every sanning strip
overlap=sp.polyval(p,x).round() #get the overlap from the polynom
if overlap > 0:
for y in sp.arange(stripwidth,modis_img.shape[0],stripwidth):
#cut out the current part:
strippart=modis_img[y:y+stripwidth,x]
#delete the upper and lower few pixels of the strippart:
strippart=strippart[int(overlap/2.):-int(round(overlap/2.))]
#Interpolat to stipwidth length
f=interp1d(sp.arange(0,len(strippart)),strippart)
strippart=f(sp.linspace(0,len(strippart)-1,stripwidth))
#replace the current sick part in the image by the new healthy one
modis_img[y:y+stripwidth,x]=strippart
print 'done'
return modis_img
评论列表
文章目录