normalSpeed安装

Ubuntu20.04

opencv4.5.5

python3.9

想试一下FFB6D作者用的normalSpeed,看了一下这个应该也是他们团队内做的。

GitHub - hfutcgncas/normalSpeed: A fast algorithm for comupting the normal of the depth img. And warp it by pybind11 as python3 interface.

一开始尝试在windows下安装,被.egg折磨了两天,不要给自己找不痛快了。

Ubuntu安装

如果服务器上已经有Opencv(Opencv不是pip或conda安装的opencv-python)了,那么顺着github上给的命令安装应该是没什么问题的。但是最近换了新的服务器,Opencv什么的都没有,需要重新编译opencv+opencv_contrib,注意只编译opencv是不够的,因为normalSpeed中调用了opencv2/rgbd模块的内容,而该模块在opencv_contrib中。

cv4的问题:

1.找不到opencv

cmake完Opencv且设置OPENCV_DIR并source ~/.bashrc后,还是报找不到Opencv的错,可能是CMakeList中指定了Opencv的版本是3.x,将3去掉即可

//fing_package(OpenCV 3 REQUIRED)
fing_package(OpenCV REQUIRED)

2.error: invalid conversion from 'int' to 'cv::AccessFlag' [-fpermissive]

报错来自np2mat/ndarray_converter.cpp,

参考:​​​​​​https://github.com/iterait/hipipe/issues/22

 将两处代码中的int替换为cv::AccessFlag

//- UMatData* allocate(int dims0, const int* sizes, int type, void* data, size_t* step, int flags, UMatUsageFlags usageFlags) const
//+
    UMatData* allocate(int dims0, const int* sizes, int type, void* data, size_t* step, cv::AccessFlag flags, UMatUsageFlags usageFlags) const

...

//- bool allocate(UMatData* u, int accessFlags, UMatUsageFlags usageFlags) const
//+
    bool allocate(UMatData* u, cv::AccessFlag accessFlags, UMatUsageFlags usageFlags) const

放一张运行成功的照片  :)

 

for i, j, k, l in product(range(10, 21), range(5, 11), range(2, 11), range(1, 3)): data["normalSpeed"] = i / 3.6 data["minTurningRadius"] = j data["breadth"] = k data["jobType"] = l # 小地块 data["map"]["outerbd"] = outerbd_small data["map"]["entrance"] = entrance_small data["map"]["exit"] = exit_small json_str = json.dumps(data) res = requests.post(url, json_str).text filename = os.path.join(desktop_path_file, f'normalSpeed={i}, minTurningRadius={j}, breadth={k}, jobType={l}, ' f'小地块.txt') # filename = f'normalSpeed={i}, minTurningRadius={j}, breadth={k}, 小地块.txt' with open(filename, 'w') as file: file.write(res) print(f'写入成功,速度为{i},转弯半径为{j},幅宽为{k},作业模式为{l},小地块') logger.info(f'写入成功,速度为{i},转弯半径为{j},幅宽为{k},作业模式为{l},小地块') time.sleep(10) plot_route_from_file(filename, f'normalSpeed={i}, minTurningRadius={j}, breadth={k}, jobType={l}, 小地块') # 大地块 data["map"]["outerbd"] = outerbd_large data["map"]["entrance"] = entrance_large data["map"]["exit"] = exit_large json_str = json.dumps(data) res = requests.post(url, json_str).text filename = os.path.join(desktop_path_file, f'normalSpeed={i}, minTurningRadius={j}, breadth={k}, jobType={l}, ' f'大地块.txt') with open(filename, 'w') as file: file.write(res) print(f'写入成功,速度为{i},转弯半径为{j},幅宽为{k},作业模式为{l},大地块') logger.info(f'写入成功,速度为{i},转弯半径为{j},幅宽为{k},作业模式为{l},大地块') time.sleep(10) plot_route_from_file(filename, f'normalSpeed={i}, minTurningRadius={j}, breadth={k}, jobType={l}, 大地块')。大地块和小地块只有map区别。能不能合并代码?要求大地块小地块都能遍历到
07-15
for x, i, j, k, l in product(range(2, 11), range(12, 21), range(7, 11), range(2, 11), range(1, 3)): data["normalSpeed"] = i / 3.6 data["turningFarmToolCtrlSpeed"] = x / 3.6 data["minTurningRadius"] = j data["breadth"] = k data["jobType"] = l for block_type in ["小地块", "中地块", "大地块"]: if block_type == "小地块": data["map"]["outerbd"] = outerbd_small data["map"]["entrance"] = entrance_small data["map"]["exit"] = exit_small elif block_type == "中地块": data["map"]["outerbd"] = outerbd_middle data["map"]["entrance"] = entrance_middle data["map"]["exit"] = exit_middle else: data["map"]["outerbd"] = outerbd_large data["map"]["entrance"] = entrance_large data["map"]["exit"] = exit_large json_str = json.dumps(data) res = requests.post(url, json_str).text filename = os.path.join(e_path_file, f'normalSpeed={i}, turningFarmToolCtrlSpeed={x}, minTurningRadius={j}, breadth={k}, ' f'jobType={l}, {block_type}.txt') with open(filename, 'w') as file: file.write(res) print(f'写入成功,速度为{i},转弯速度为{x},转弯半径为{j},幅宽为{k},作业模式为{l},{block_type}') logger.info(f'写入成功,速度为{i},转弯速度为{x},转弯半径为{j},幅宽为{k},作业模式为{l},{block_type}') if block_type == "小地块": time.sleep(5) plot_route_from_file(filename, f'normalSpeed={i}, turningFarmToolCtrlSpeed={x}, minTurningRadius={j}, breadth={k}, ' f'jobType={l}, {block_type}', error_flag, success_flag, outerbd_small) elif block_type == "中地块": time.sleep(10) plot_route_from_file(filename, f'normalSpeed={i}, turningFarmToolCtrlSpeed={x}, minTurningRadius={j}, breadth={k}, ' f'jobType={l}, {block_type}', error_flag, success_flag, outerbd_middle) else: time.sleep(15) plot_route_from_file(filename, f'normalSpeed={i}, turningFarmToolCtrlSpeed={x}, minTurningRadius={j}, breadth={k}, ' f'jobType={l}, {block_type}', error_flag, success_flag, outerbd_large) 这样发送post请求有时候会报错requests.exceptions.ConnectionError: ('Connection aborted.', LineTooLong('got more than 65536 bytes when reading status line'))。这是为什么,怎么解决
07-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值