예제 #1
0
def extractInfo(self, master, slave):
    from contrib.frameUtils.FrameInfoExtractor import FrameInfoExtractor
    FIE = FrameInfoExtractor()
    masterInfo = FIE.extractInfoFromFrame(master)
    slaveInfo = FIE.extractInfoFromFrame(slave)
    masterInfo.sensingStart = [masterInfo.sensingStart, slaveInfo.sensingStart]
    masterInfo.sensingStop = [masterInfo.sensingStop, slaveInfo.sensingStop]
    # for stitched frames do not make sense anymore
    mbb = masterInfo.getBBox()
    sbb = slaveInfo.getBBox()
    latEarlyNear = mbb[0][0]
    latLateNear = mbb[2][0]

    #figure out which one is the bottom
    if latEarlyNear > latLateNear:
        #early is the top
        ret = []
        # the calculation computes the minimum bbox. it is not exact, bu given
        # the approximation in the estimate of the corners, it's ok
        ret.append([min(mbb[0][0], sbb[0][0]), max(mbb[0][1], sbb[0][1])])
        ret.append([min(mbb[1][0], sbb[1][0]), min(mbb[1][1], sbb[1][1])])
        ret.append([max(mbb[2][0], sbb[2][0]), max(mbb[2][1], sbb[2][1])])
        ret.append([max(mbb[3][0], sbb[3][0]), min(mbb[3][1], sbb[3][1])])
    else:
        # late is the top
        ret = []
        ret.append([max(mbb[0][0], sbb[0][0]), max(mbb[0][1], sbb[0][1])])
        ret.append([max(mbb[1][0], sbb[1][0]), min(mbb[1][1], sbb[1][1])])
        ret.append([min(mbb[2][0], sbb[2][0]), max(mbb[2][1], sbb[2][1])])
        ret.append([min(mbb[3][0], sbb[3][0]), min(mbb[3][1], sbb[3][1])])

    masterInfo.bbox = ret
    return masterInfo
예제 #2
0
def create_alos2_md_isce(insar_obj, filename):
    from contrib.frameUtils.FrameInfoExtractor import FrameInfoExtractor
    FIE = FrameInfoExtractor()
    masterInfo = FIE.extractInfoFromFrame(insar_obj.frame)
    md = {}
    bbox = masterInfo.bbox
    md['bbox_seq'] = [
        "nearEarlyCorner", "farEarlyCorner", "nearLateCorner", "farLateCorner"
    ]
    md['bbox'] = bbox
    md['geometry'] = {
        "coordinates": [[
            [bbox[0][1], bbox[0][0]],  # nearEarlyCorner
            [bbox[1][1], bbox[1][0]],  # farEarlyCorner
            [bbox[3][1], bbox[3][0]],  # farLateCorner
            [bbox[2][1], bbox[2][0]],  # nearLateCorner
            [bbox[0][1], bbox[0][0]],  # nearEarlyCorner
        ]],
        "type":
        "Polygon"
    }
    md['start_time'] = masterInfo.sensingStart.strftime("%Y-%m-%dT%H:%M:%S.%f")
    md['stop_time'] = masterInfo.sensingStop.strftime("%Y-%m-%dT%H:%M:%S.%f")
    md['absolute_orbit'] = masterInfo.orbitNumber
    md['frame'] = masterInfo.frameNumber
    md['flight_direction'] = masterInfo.direction
    md['satellite_name'] = masterInfo.spacecraftName
    md['source'] = "isce_preprocessing"

    with open(filename, "w") as f:
        json.dump(md, f, indent=2)
        f.close()
예제 #3
0
def extractInfo(self, frames):
    FIE = FrameInfoExtractor()
    infos = []
    for frame in frames:
        infos.append(FIE.extractInfoFromFrame(frame))

    mainInfo = infos[0]
    mainInfo.sensingStart = [info.sensingStart for info in infos]
    mainInfo.sensingStop = [info.sensingStop for info in infos]

    # for stitched frames do not make sense anymore
    bbs = [info.getBBox() for info in infos]
    bbxy = {}
    for x in range(4):
        bbxy[x] = {}
        for y in range(2):
            bbxy[x][y] = [bb[x][y] for bb in bbs]
    latEarlyNear = bbxy[0][0][0]
    latLateNear = bbxy[2][0][0]

    #figure out which one is the bottom
    if latEarlyNear > latLateNear:
        #early is the top
        ret = []
        # the calculation computes the minimum bbox. it is not exact, but given
        # the approximation in the estimate of the corners, it's ok
        for x, op1, op2 in zip(range(4), (min, min, max, max),
                               (max, min, max, min)):
            ret.append([op1(bbxy[x][0]), op2(bbxy[x][1])])
    else:
        # late is the top
        ret = []
        for x, op1, op2 in zip(range(4), (max, max, min, min),
                               (max, min, max, min)):
            ret.append([op1(bbxy[x][0]), op2(bbxy[x][1])])

    mainInfo.bbox = ret
    return mainInfo