Exemple #1
0
def main():
    image0 = cv.LoadImage('tests/grid.jpg')
    image1 = cv.LoadImage('tests/grid2.jpg')
    buff = cv.LoadImage('buff.jpg')
    buff2 = cv.LoadImage('buff.jpg')
    #image[ y, x , rgb ]
    features0 = []
    for row in csv.reader(open('tests/grid.csv')):
        features0.append([float(r) for r in row])
    features0 = numpy.mat(features0)
    features1 = []
    for row in csv.reader(open('tests/grid2.csv')):
        features1.append([float(r) for r in row])
    features1 = numpy.mat(features1)
    
    fund = fundamental(features0, features1)
    H1, H2 = H1H2Calc(fund)
    prewarp1, prewarp2 = WarpImages(image0, image1, H1, H2, buff, buff2)
##    features0, features1 = formatForFund(features0, features1)
##    warpFeatures0 = WarpFeatures(features0.T, H1)
##    warpFeatures1 = WarpFeatures(features1.T, H2)
    #Transition(prewarp1, prewarp2, warpFeatures0, warpFeatures1, features0, features1)
    cv.NamedWindow('display')
##    cv.NamedWindow('prewarp1')
##    cv.NamedWindow('prewarp2')
    writer = cv.CreateVideoWriter("feed/out.avi", 0, 10, (1000,1000), True)
##    cv.ShowImage('prewarp1', prewarp1)
##    cv.WaitKey(0)
##    cv.ShowImage('prewarp2', prewarp2)
##    cv.WaitKey(0)
    Test(prewarp1, prewarp2, H1, H2)
    Linear(prewarp1, prewarp2, H1, H2, writer)
Exemple #2
0
def main():
    image0 = cv.LoadImage('pic1.jpg')
    image1 = cv.LoadImage('pic2.jpg')
    buff = cv.LoadImage('buff.jpg')
    buff2 = cv.LoadImage('buff.jpg')
    #image[ y, x , rgb ]
    features0 = numpy.mat([[1771,1111],[2073.5,1056],[1963.5,1259.5],[1732.5,1435.5],[2095.5,1347.5],
                    [1908.5,1468.5],[1941.5,1666.5],[1210,1705],[2156,1551],[1534.5,2040.5],
                    [1952.5,1941.5],[1837,418],[1930.5,1100],[1611.5,1133],[2194.5,1039.5],
                    [1848,797.5],[2101,775.5],[1545.5,1408],[2167,1303.5]])
    features1 = numpy.mat([[1738,1111],[2117.5,1094.5],[1936,1309],[1710.5,1457.5],[2161.5,1430],
                    [1919.5,1512.5],[1925,1732.5],[1342,1633.5],[2420,1650],[1644.5,2029.5],
                    [2128.5,2035],[1941.5,374],[1936,1122],[1578.5,1111],[2288,1089],[1798.5,786.5],
                    [2095.5,803],[1540,1391.5],[2293.5,1364]])
    fund = fundamental(features0, features1)
    H1, H2 = H1H2Calc(fund)
    prewarp1, prewarp2 = WarpImages(image0, image1, H1, H2, buff, buff2)
    features0, features1 = formatForFund(features0, features1)
    warpFeatures0 = WarpFeatures(features0.T, H1)
    warpFeatures1 = WarpFeatures(features1.T, H2)
    #Transition(prewarp1, prewarp2, warpFeatures0, warpFeatures1, features0, features1)
    cv.NamedWindow('display')
##    cv.NamedWindow('prewarp1')
##    cv.NamedWindow('prewarp2')
##    cv.ShowImage('prewarp1', prewarp1)
##    cv.WaitKey(0)
##    cv.ShowImage('prewarp2', prewarp2)
##    cv.WaitKey(0)
    Linear(prewarp1, prewarp2, H1, H2, buff)#, writer)
Exemple #3
0
##    e1 = V[:,0]
####    print V
##    print e1



    Fd0 = fundamental * d0
##    print Fd0
    Fd0[2] = Fd0[2]**2
    Fd0 = Fd0 / math.sqrt(Fd0.sum())
##    print Fd0
    a = -Fd0[1]
    b = Fd0[0]
    c = numpy.mat("0")
    d1 = numpy.bmat('a;b;c')
##    print d1

    return e0, d0, e1, d1


if __name__ == "__main__":
    fund = fundamental(numpy.mat([[1771,1111],[2073.5,1056],[1963.5,1259.5],[1732.5,1435.5],[2095.5,1347.5],
                              [1908.5,1468.5],[1941.5,1666.5],[1210,1705],[2156,1551],[1534.5,2040.5],
                              [1952.5,1941.5],[1837,418],[1930.5,1100],[1611.5,1133],[2194.5,1039.5],
                              [1848,797.5],[2101,775.5],[1545.5,1408],[2167,1303.5]]),
                   numpy.mat([[1738,1111],[2117.5,1094.5],[1936,1309],[1710.5,1457.5],[2161.5,1430],
                              [1919.5,1512.5],[1925,1732.5],[1342,1633.5],[2420,1650],[1644.5,2029.5],
                              [2128.5,2035],[1941.5,374],[1936,1122],[1578.5,1111],[2288,1089],[1798.5,786.5]
                              ,[2095.5,803],[1540,1391.5],[2293.5,1364]]))
    H1H2Calc(fund)