opencv學習實踐(3) cv::waitKey()的使用
本文為測試cv::waitKey()的觸發條件
1.程式準備
mkdir -p opencv_test/src
cv opencv_test/src
catkin_create_pkg commandlineparse std_msgs rospy roscpp cv_bridge
# meng @ meng in ~/my_learning/opencv_test [16:13:15]
$ tree
.
└── src
├── CMakeLists.txt -> /opt/ros/kinetic/share/catkin/cmake/toplevel.cmake
└── commandlineparse
├── CMakeLists.txt
├── include
│ └── commandlineparse
├── package.xml
└── src
├── commandlineparse_node.cpp
└── tulip.jpg 大連無痛人流哪家好
5 directories, 5 files
如上所述,新增檔案commandlineparse_node.cpp(上面倒數第三行),修改CMakeLists.txt(上面commandlineparse資料夾內的)
commandlineparse_node.cpp,main函式內第二行為本地圖片的絕對路徑
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core.hpp"
#include "opencv2/imgcodecs.hpp"
#include "iostream"
#include "ros/ros.h"
using namespace cv;
using namespace std;
int main(int argc,char** argv){
Mat src;
src=imread("/home/meng/my_learning/opencv/opencv_ws1/src/commandLineParse/src/tulip.jpg",1);
namedWindow("my_window",WINDOW_NORMAL);
imshow("my_window",src);
waitKey(0);
return 0;
}
CMakeLists.txt
cmake_minimum_required(VERSION 3.0.2)
project(commandlineparse)
find_package(catkin REQUIRED COMPONENTS
cv_bridge
roscpp
rospy
std_msgs
)
find_package(OpenCV REQUIRED)
catkin_package()
include_directories(
${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} )
add_executable(commandlineparse_node src/commandlineparse_node.cpp)
target_link_libraries(commandlineparse_node
${catkin_LIBRARIES} ${OpenCV_LIBS} )
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70005147/viewspace-2788139/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- OpenCV(cv::Point、cv::Rect、cv::Mat)OpenCV
- Opencv學習筆記(3)---紙牌數字識別練習實踐專案OpenCV筆記
- OpenCV(cv::minMaxLoc())OpenCV
- OpenCV(cv::convertScaleAbs())OpenCV
- OpenCV(cv::Canny())OpenCV
- OpenCV(cv::bilateralFilter())OpenCVFilter
- OpenCV(cv::circle())OpenCV
- OpenCV(cv::NAryMatIterator)OpenCV
- OpenCv(cv::undistort())OpenCV
- OpenCV(cv::findChessboardCorners())OpenCV
- OpenCV(cv::bitwise_not())OpenCV
- OpenCV(cv::dnn::blobFromImage())OpenCVDNN
- OpenCV(cv::Mat::setTo())OpenCV
- rabbitmq 學習與實踐分享(3)MQ
- 準備Python環境學習OpenCV的使用PythonOpenCV
- opencv 學習OpenCV
- Python-OpenCV:cv2.imread(),cv2.imshow(),cv2.imwrite()PythonOpenCV
- OpenCV(模板類 cv::Vec<T, cn>)OpenCV
- opencv呼叫cv2.dnn_DetectionModel 用法OpenCVDNN
- 【PWA學習與實踐】(3) 讓你的WebApp離線可用WebAPP
- Composer 學習實踐
- OpenCV(cv::Mat 類的成員函式 ptr<T>())OpenCV函式
- 學習OpenCV:骨架提取OpenCV
- 學習OpenCV:hu矩OpenCV
- OpenCV學習筆記(3)——Scalar資料型別理解OpenCV筆記資料型別
- 基於OpenCV和YOLOv3深度學習的目標檢測OpenCVYOLO深度學習
- 轉:python使用opencv(cv2)在影像上繪製點線等PythonOpenCV
- 深度學習的應用與實踐深度學習
- opencv學習筆記(一)OpenCV筆記
- opencv學習之基礎OpenCV
- opencv-python學習之旅OpenCVPython
- 【PWA學習與實踐】(2) 使用Manifest,讓你的WebApp更“Native”WebAPP
- ThreadLoop實踐學習筆記threadOOP筆記
- Nacos入門學習&實踐
- 基於 KubeVela 的機器學習實踐機器學習
- Android學習之活動的最佳實踐Android
- OpenCv查詢輪廓-cv2.findContours()函式OpenCV函式
- 雲上深度學習實踐分享——雲上MXNet實踐深度學習