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(cv::minMaxLoc())OpenCV
- OpenCV(cv::circle())OpenCV
- OpenCv(cv::undistort())OpenCV
- OpenCV(cv::findChessboardCorners())OpenCV
- OpenCV(cv::NAryMatIterator)OpenCV
- OpenCV(cv::bilateralFilter())OpenCVFilter
- OpenCV(cv::Canny())OpenCV
- Opencv學習筆記(3)---紙牌數字識別練習實踐專案OpenCV筆記
- 【OpenCV3】視訊讀寫cv::VideoCapture和cv::VideoWriterOpenCVIDEAPT
- OpenCV(cv::bitwise_not())OpenCV
- OpenCV(cv::convertScaleAbs())OpenCV
- OpenCV(cv::dnn::blobFromImage())OpenCVDNN
- OpenCV(cv::Mat::setTo())OpenCV
- rabbitmq 學習與實踐分享(3)MQ
- opencv 學習OpenCV
- OpenCV學習OpenCV
- 從實踐中學習oracle/sql 1-3章學習OracleSQL
- OpenCV(模板類 cv::Vec<T, cn>)OpenCV
- OpenCV imshow()之後沒有waitKey()無法顯示影象OpenCVAI
- 使用sklearn進行整合學習——實踐
- 快速學習和實踐CSS/CSS3的線上教程CSSS3
- Python-OpenCV:cv2.imread(),cv2.imshow(),cv2.imwrite()PythonOpenCV
- 準備Python環境學習OpenCV的使用PythonOpenCV
- 學習OpenCV——SVMOpenCV
- OpenCV中的CV_EXPORT是什麼意思OpenCVExport
- 排序學習實踐排序
- ReactNative學習實踐:Navigator實踐React
- 學習OpenCV:hu矩OpenCV
- 學習OpenCV:骨架提取OpenCV
- OpenCV(cv::Mat 類的成員函式 ptr<T>())OpenCV函式
- opencv呼叫cv2.dnn_DetectionModel 用法OpenCVDNN
- OpenCV學習筆記(3)——Scalar資料型別理解OpenCV筆記資料型別
- Opencv3 python學習2——視訊基礎OpenCVPython
- 【PWA學習與實踐】(3) 讓你的WebApp離線可用WebAPP
- Composer 學習實踐
- 向敏捷實踐學習,學習敏捷出版敏捷
- 我的OpenCV學習筆記(六):使用支援向量機(SVM)OpenCV筆記