ar-app使用教程
ar_app文件夹:

数据与输出文件夹:建议按以下路径放置,可以更改

ar_app使用

其中:
路径下有两个文件夹:
- mapping:构建库的图片(不可动)
- query:存储定位图片的临时文件夹(需要定期删除里面的图片)

—output_path:输出路径
里面有若干定位所需要的文件,不可更改

—host:本机IP
本机电脑IP地址,服务发布的位置
—port:服务运行的IP
—number_retrieval:定位前图片检索的张数
数量可以设置为100,可以根据定位效果调整,这个对定位效率影响较小
—init_match_num:初始化图片用于定位需要的图片数目
这个对初始化定位速率影响较大,数量越多,定位精度越高,但定位效率越低
—navigation_match_num:导航过程中用于定位的图片数目
这个对导航定位数量影响较大,如上所述,可以根据精度和定位效率要求进行更改,默认为10
发起请求与返回
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| wx.uploadFile({ filePath: res.tempFilePath, name: 'image', url: 'http://10.104.31.14:5001/upLoadImg_api', success:(res)=>{ let x_y_data = JSON.parse(res.data) if(x_y_data.status === "floor"){ wx.showLoading({ title: '行走楼梯中', mask: True }) }else{ this.addPointToMap(x_y_data.x, x_y_data.y,"image") wx.hideLoading() }
if(this.is_end === false){ this.upLoadImage() } }, fail:(res)=>{ console.log(res) } })
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| import json import os import time import requests url = "http://192.168.20.146:5001/upLoadImg_api" src_dir = "cz_1" images = os.listdir(src_dir) images = sorted(images, key=lambda x: int(x.split(".")[0])) for image in images: file = os.path.join(src_dir, image) files = {'image': open(file, 'rb')} start_time = time.time() r = requests.post(url=url, files=files) end_time = time.time() print(end_time-start_time, r.content)
|
返回值:
1 2 3 4 5 6 7 8 9
| {
x:x坐标,
y:坐标,
status:"floor"时表示定位失误
}
|