示例#1
0
def testComputeAndApplyHomographyStata():
    im1=io.imread('stata/stata-1.png')
    im2=io.imread('stata/stata-2.png')
    pointList1=[np.array([209, 218, 1]), np.array([425, 300, 1]), np.array([209, 337, 1]), np.array([396, 336, 1])]
    pointList2=[np.array([232, 4, 1]), np.array([465, 62, 1]), np.array([247, 125, 1]), np.array([433, 102, 1])]
    listOfPairsS=zip(pointList1, pointList2)
    HS=a6.computeHomography(listOfPairsS)
    #multiply by 0.2 to better show the transition
    out=im2*0.5    
    a6.applyHomography(im1, out, HS, True)
    io.imwrite(out, "stata_computeAndApplyHomography.png")
示例#2
0
def testComputeAndApplyHomographyFun():
    im1=io.imread('fun/room1.png')
    im2=io.imread('fun/room2.png')
    pointList1=[np.array([327, 258, 1], dtype=np.float64), np.array([75, 437, 1], dtype=np.float64), np.array([224, 364, 1], dtype=np.float64), np.array([423, 449, 1], dtype=np.float64)]
    pointList2=[np.array([294, 50, 1], dtype=np.float64), np.array([50, 227, 1], dtype=np.float64), np.array([190, 161, 1], dtype=np.float64), np.array([366, 240, 1], dtype=np.float64)]
    listOfPairsS=zip(pointList1, pointList2)
    HS=a6.computeHomography(listOfPairsS)
    #multiply by 0.2 to better show the transition
    out=im2*0.5    
    a6.applyHomography(im1, out, HS, True)
    io.imwrite(out, "fun.png")
示例#3
0
def testApplyHomographyPoster():
    signH = np.array(
        [
            [1.12265192e00, 1.44940136e-01, 1.70000000e02],
            [8.65164180e-03, 1.19897030e00, 9.50000000e01],
            [2.55704864e-04, 8.06420365e-04, 1.00000000e00],
        ]
    )
    green = io.getImage("green.png")
    poster = io.getImage("poster.png")
    a6.applyHomography(poster, green, signH, True)
    io.imwrite(green, "HWDueAt9pm_applyHomography.png")
示例#4
0
def testComputeAndApplyHomographyPoster():
    green = io.getImage("green.png")
    poster = io.getImage("poster.png")

    h, w = poster.shape[0] - 1, poster.shape[1] - 1
    pointListPoster = [np.array([0, 0, 1]), np.array([0, w, 1]), np.array([h, w, 1]), np.array([h, 0, 1])]
    pointListT = [np.array([170, 95, 1]), np.array([171, 238, 1]), np.array([233, 235, 1]), np.array([239, 94, 1])]

    listOfPairs = zip(pointListPoster, pointListT)

    H = a6.computeHomography(listOfPairs)
    # print H
    a6.applyHomography(poster, green, H, True)
    io.imwrite(green, "HWDueAt9pm_computeHomography.png")
示例#5
0
def makeStreetSign():
    sign = io.imread("highway.png")
    people = io.imread("coverphoto.png")
    h, w = people.shape[0] - 1, people.shape[1] - 1
    peoplecorners = [np.array([0, 0, 1]), np.array([0, w, 1]), np.array([h, w, 1]), np.array([h, 0, 1])]
    pointList1 = [
        np.array([105, 94, 1], dtype=np.float64),
        np.array([110, 200, 1], dtype=np.float64),
        np.array([162, 200, 1], dtype=np.float64),
        np.array([159, 92, 1], dtype=np.float64),
    ]
    listOfPairs = zip(peoplecorners, pointList1)
    H = a6.computeHomography(listOfPairs)
    a6.applyHomography(people, sign, H, True)
    io.imwrite(sign, "Fun.png")
def testComputeAndApplyHomographyPrudential():
    pru = io.getImage("pruSkyline.png")
    poster = io.getImage("andrewTag.png")

    h, w = poster.shape[0]-1, poster.shape[1]-1
    pointListPoster=[np.array([0, 0, 1]), np.array([0, w, 1]), np.array([h, w, 1]), np.array([h, 0, 1])]
    #pointListPru=[np.array([78, 120, 1]), np.array([99, 160, 1]), np.array([150, 159, 1]), np.array([132, 118, 1])]
    pointListPru=[np.array([78, 120, 1], dtype=np.float64), np.array([99, 160, 1], dtype=np.float64), np.array([207, 156, 1], dtype=np.float64), np.array([194, 115, 1], dtype=np.float64)]

    listOfPairs=zip(pointListPoster, pointListPru)
    
    H = a6.computeHomography(listOfPairs)
    #print H
    a6.applyHomography(poster, pru, H, True)
    io.imwrite(pru, "Fun.png")