针对不同场景做全景拼接
利用RANSAC算法来做不同场景的全景图
在运行代码的时候,会遇到一些错误,主要原因出现在pcv模块中。
from pylab import *
from numpy import *
from PIL import Image
# If you have PCV installed, these imports should work
from PCV.geometry import homography, warp
from PCV.localdescriptors import sift
"""
This is the panorama example from section 3.3.
"""
# set paths to data folder
featname = [r'D:\VScode_workplace\RANSACtest1\sw'+str(i+1)+'.sift' for i in range(5)]
imname = [r'D:\VScode_workplace\RANSACtest1\sw'+str(i+1)+'.jpg' for i in range(5)]
# extract features and match
l = {}
d = {}
for i in range(5):
sift.process_image(imname[i],featname[i])
l[i],d[i] = sift.read_features_from_file(featname[i])
matches = {}
for i in range(4):
matches[i] = sift.match(d[i+1],d[i])
# visualize the matches (Figure 3-11 in the book)
for i in range