#img_matching = matching.drawMatchLine(img_1_cy, img_2_cy, pairs[0][start:end], pairs[1][start:end]) #cv2.imwrite('match_line'+str(i)+'.jpg', img_matching ) tmp_M = matching.solve_M(pairs[0], pairs[1]) tmp_M = numpy.concatenate((tmp_M, numpy.array([0,0,1]).reshape(1,3)), 0) # Extend M to 3x3 matrix if i == 0: M.append(tmp_M) else: print 'appending M', i, i-1 M.append( numpy.dot(M[i-1], tmp_M) ) print 'Got ', len(pairs[0]), ' pairs' ### run poisson blending ### get mask print img[0].shape mask = numpy.ones((len(img[0]), len(img[0][0]), 3)) mask = projection.cyCorrect(mask, focal)[:, :, 0] print mask.shape ### run assemble img_pano_linear = assemble_2(img_cy, M, mask) img_pano_linear = drift(img_pano_linear, M[-1]) cv2.imwrite('pano_linear.jpg', img_pano_linear) ### run poisson img_pano_poisson = poisson(img_cy, M, mask) img_pano_poisson = drift(img_pano_poisson, M[-1]) cv2.imwrite('pano_poisson.jpg', img_pano_poisson)
#!/usr/bin/python import numpy as nm import matplotlib.pyplot as plt from time import sleep from drift import drift dt=1e-5 dl=10 drf=drift(mapfile="1D.map") nx=drf.dimension() dim=nx[0]*nx[1]*nx[2] drf.timestep(dt) drf.spacestep(dl) drf.algorithm("basic") source=drf.source() con=drf.con() cap=drf.cap() for i in range(0,dim): source[i]=nm.cos(i*dl*nm.pi/(dim*dl)/2.0) con[i]=0.2497 cap[i]=1.8088e-7 drf.setcell(50.0,cells="s") drf.step()
"s +--- ") mapstr="" for i in range(0,dim-1): mapstr+="x" mapstr+="s" print len(mapstr) print mapstr dim=1000 dt=1e-5 dl=10 drf=drift(dim,1,1,symlist,mapstr) drf.timestep(dt) drf.spacestep(dl) drf.algorithm("basic") source=drf.source() con=drf.con() cap=drf.cap() cell=drf.cell() for i in range(0,dim): source[i]=nm.cos(i*dl*nm.pi/(dim*dl)/2.0) con[i]=0.2497 cap[i]=1.8088e-7 #@MAC numbers having more than 4 digit is treated as variable! drf.link_equhead(cell, symbol='s', equ='RCELL(c,0,0)-(RCELL(0,0,0)-30)*DL*0.001;c=-1')