The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support

这篇具有很好参考价值的文章主要介绍了The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

项目场景:

ros2 foxy 运行单目orb slam3


问题描述

编译正常,程序运行时报错如下

Loading ORB Vocabulary. This could take a while...
Vocabulary loaded!

Initialization of Atlas from scratch
Creation of new map with id: 0
Creation of new map with last KF id: 0
Seq. Name:
There are 1 cameras in the atlas
Camera 0 is pinhole
slam changed
============================
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.2.0) /home/ros2/opencv4.4/opencv-4.4.0/modules/highgui/src/window.cpp:634: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvNamedWindow'

 错误解决方案
按照系统给出的解决方案,执行命令
sudo apt-get install libgtk2.0-dev
sudo apt-get install pkg-config
并不能解决问题


原因分析:

问题出在,安装opencv时编译配置出现了问题。

正确的执行命令是:

 

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.4.0/modules ../opencv-4.4.0


解决方案:

opencv目录结构:

The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support,机器人,人工智能

以前的编译命令:

cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.4.0/modules ../opencv-4.4.0

正确的编译执行命令:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.4.0/modules ../opencv-4.4.0

重新编译后运行:

ros2 run orbslam3 mono ~/ros2_ws/src/ORB_SLAM3/Vocabulary/ORBvoc.txt ~/ros2_ws/src/ORB_SLAM3/Examples/Monocular/EuRoC.yaml

The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support,机器人,人工智能

 程序正常运行。

参考博客:

If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config_绿竹巷人的博客-CSDN博客文章来源地址https://www.toymoban.com/news/detail-527035.html

到了这里,关于The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包