您的位置:首页 > 教育 > 锐评 > 标书制作需要学多久_广告网站设计公司_比百度好用的搜索引擎_温州最好的seo

标书制作需要学多久_广告网站设计公司_比百度好用的搜索引擎_温州最好的seo

2025/4/20 22:57:24 来源:https://blog.csdn.net/2303_78438820/article/details/147256986  浏览:    关键词:标书制作需要学多久_广告网站设计公司_比百度好用的搜索引擎_温州最好的seo
标书制作需要学多久_广告网站设计公司_比百度好用的搜索引擎_温州最好的seo

1.先将图片放到桌面上

2.打开终端ctrl+alt+T,查看自己是否已安装opencv

3.创建工作环境

4.进入工作目录并创建ROS2包添加OpenCV依赖项

5.进入/home/kong/opencv_ws/opencv_use/src目录创建.cpp文件并编辑

6.代码如下

my_opencv.cpp
#include <cstdio>
#include <opencv2/opencv.hpp>using namespace cv;int main(int argc, char ** argv)
{(void) argc;(void) argv;Mat src = imread("/home/kong/Desktop/image.png");if(src.empty()){printf("无法读取图片,请检查图片路径是否正确。\n");}imshow("src",src);waitKey(0);printf("hello world opencv_use package\n");return 0;
}
CMakeLists.txt
cmake_minimum_required(VERSION 3.8)
project(opencv_use)if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")add_compile_options(-Wall -Wextra -Wpedantic)
endif()# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(OpenCV REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(image_transport REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})add_executable(my_opencv src/my_opencv.cpp)
target_link_libraries(my_opencv ${OpenCV_LIBRARIES})
target_include_directories(my_opencv PUBLIC$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>$<INSTALL_INTERFACE:include>)
target_compile_features(my_opencv PUBLIC c_std_99 cxx_std_17)  # Require C99 and C++17
ament_target_dependencies(my_opencv"rclcpp""OpenCV""sensor_msgs""cv_bridge""image_transport"
)install(TARGETS my_opencvDESTINATION lib/${PROJECT_NAME})if(BUILD_TESTING)find_package(ament_lint_auto REQUIRED)# the following line skips the linter which checks for copyrights# comment the line when a copyright and license is added to all source filesset(ament_cmake_copyright_FOUND TRUE)# the following line skips cpplint (only works in a git repo)# comment the line when this package is in a git repo and when# a copyright and license is added to all source filesset(ament_cmake_cpplint_FOUND TRUE)ament_lint_auto_find_test_dependencies()
endif()ament_package()

7.编译运行

现象

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com