本文整理汇总了Python中utils.AttributeDict.crop方法的典型用法代码示例。如果您正苦于以下问题:Python AttributeDict.crop方法的具体用法?Python AttributeDict.crop怎么用?Python AttributeDict.crop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.AttributeDict
的用法示例。
在下文中一共展示了AttributeDict.crop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: demo
# 需要导入模块: from utils import AttributeDict [as 别名]
# 或者: from utils.AttributeDict import crop [as 别名]
def demo():
# set the parameters
# start with default parameters
params = defaultParameters()
# Nordland spring dataset
ds = AttributeDict()
ds.name = 'spring'
try:
path = os.environ['DATASET_1_PATH']
except:
path = '../datasets/nordland/64x32-grayscale-1fps/spring'
print "Warning: Environment variable DATASET_1_PATH not found! Trying '"+path+"'"
ds.imagePath = path
ds.prefix='images-'
ds.extension='.png'
ds.suffix=''
ds.imageSkip = 100 # use every n-nth image
ds.imageIndices = range(1, 35700, ds.imageSkip)
ds.savePath = 'results'
ds.saveFile = '%s-%d-%d-%d' % (ds.name, ds.imageIndices[0], ds.imageSkip, ds.imageIndices[-1])
ds.preprocessing = AttributeDict()
ds.preprocessing.save = 1
ds.preprocessing.load = 0 #1
#ds.crop=[1 1 60 32] # x0 y0 x1 y1 cropping will be done AFTER resizing!
ds.crop=[]
spring=ds
ds2 = deepcopy(ds)
# Nordland winter dataset
ds2.name = 'winter'
#ds.imagePath = '../datasets/nordland/64x32-grayscale-1fps/winter'
try:
path = os.environ['DATASET_2_PATH']
except:
path = '../datasets/nordland/64x32-grayscale-1fps/winter'
print "Warning: Environment variable DATASET_2_PATH not found! Trying '"+path+"'"
ds2.saveFile = '%s-%d-%d-%d' % (ds2.name, ds2.imageIndices[0], ds2.imageSkip, ds2.imageIndices[-1])
# ds.crop=[5 1 64 32]
ds2.crop=[]
winter=ds2
params.dataset = [spring, winter]
# load old results or re-calculate?
params.differenceMatrix.load = 0
params.contrastEnhanced.load = 0
params.matching.load = 0
# where to save / load the results
params.savePath='results'
## now process the dataset
ss = SeqSLAM(params)
t1=time.time()
results = ss.run()
t2=time.time()
print "time taken: "+str(t2-t1)
## show some results
if len(results.matches) > 0:
m = results.matches[:,0] # The LARGER the score, the WEAKER the match.
thresh=0.9 # you can calculate a precision-recall plot by varying this threshold
m[results.matches[:,1]>thresh] = np.nan # remove the weakest matches
plt.plot(m,'.') # ideally, this would only be the diagonal
plt.title('Matchings')
plt.show()
else:
print "Zero matches"