コード例 #1
0
def GetImageGridPointsIndices(data, ResolutionPixels):
    #----------------------------------------------------------------------------------------
    #
    # Create Grid according to the image dimension and user-defined resolution
    #
    #----------------------------------------------------------------------------------------
    GlobalGridPoints = []

    # get image dimension
    easting = data.coordinates.easting[0, :]
    northing = data.coordinates.northing[:, 0]
    nx = easting.shape[0]
    ny = northing.shape[0]

    # create points indices arrays
    IndicesX = GridSubSampling(nx, ResolutionPixels)
    IndicesY = GridSubSampling(ny, ResolutionPixels)
    X, Y = np.meshgrid(IndicesX, IndicesY)
    # flatten the arrays for fast computation
    indx = X.flatten()
    indy = Y.flatten()

    # gather all information about grid points
    for i in range(indx.shape[0]):
        indexx = indx[i]
        indexy = indy[i]
        east = easting[indexx]
        north = northing[indexy]
        Point = CL.GridPoints(east, north)
        GlobalGridPoints.append(Point)

    # array format
    GlobalGridPoints = np.asarray(GlobalGridPoints)

    return GlobalGridPoints
コード例 #2
0
def GetImageGridPoints(data, ResolutionPixels):
    #----------------------------------------------------------------------------------------
    #
    # Create Grid according to the image dimension and user-defined resolution
    #
    #----------------------------------------------------------------------------------------
    GlobalGridPoints = []

    # get image dimension
    easting = data.coordinates.easting[0, :]
    northing = data.coordinates.northing[:, 0]

    # create points indices arrays
    Easting = GridSubSampling(easting, ResolutionPixels)
    Northing = GridSubSampling(northing, ResolutionPixels)
    E, N = np.meshgrid(Easting, Northing)
    # flatten the arrays for fast computation
    East = E.flatten()
    North = N.flatten()

    # gather all information about grid points
    for i in range(East.shape[0]):
        Point = CL.GridPoints(East[i], North[i])
        GlobalGridPoints.append(Point)

    # array format
    GlobalGridPoints = np.asarray(GlobalGridPoints)

    return GlobalGridPoints
コード例 #3
0
def Array2List(array):
    #---------------------------------------------------------------------
    #
    # convert numpy coordinate array coordinate into a list of data
    #
    #----------------------------------------------------------------------
    data = []
    for i in range(array.shape[0]):
        if array.shape[1] == 1:
            point = CL.GridPoints(array[i, 0])
        elif array.shape[1] == 2:
            point = CL.GridPoints(array[i, 0], array[i, 1])
        elif array.shape[1] == 3:
            point = CL.GridPoints(array[i, 0], array[i, 1], array[i, 2])
        data.append(point)
    data = np.asarray(data)

    return data
コード例 #4
0
def CreatePolygon(indices, image, easting, northing):
    #----------------------------------------------
    # create a polygonial region of interest (ROI)
    #----------------------------------------------
    ROI_points = []
    for i in range(indices.shape[0]):
        indx, indy = indices[i, 0], indices[i, 1]  # indices
        East, North = easting[indx], northing[indy]  # coordinates
        cv2.circle(image, (indx, indy), 10, (255, 255, 255), -1)  # plot points
        point = CL.GridPoints(East, North)
        # store points
        ROI_points.append(point)

    ROI_points = np.asarray(ROI_points)
    return ROI_points