Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cmake_minimum_required(VERSION 3.0)
- project(cpp_proj)
- # set(CMAKE_CXX_STANDARD 14)
- find_package(OpenCV REQUIRED)
- add_executable(cpp_proj opencv_cpp.cpp)
- include_directories(${OpenCV_INCLUDE_DIRS})
- target_link_libraries(cpp_proj ${OpenCV_LIBS})
- #include <opencv2/opencv.hpp>
- #include <iostream>
- #include <string>
- #include <opencv2/imgcodecs.hpp>
- #include <opencv2/core/core.hpp>
- #include <opencv2/highgui/highgui.hpp>
- #include <opencv2/imgproc/imgproc.hpp>
- int main() {
- const std::string img_file{"logo.png"};
- // Check if we can open the file
- cv::Mat input = cv::imread(img_file, 1);
- if(!input.data) {
- std::cout << "Can't open file " << img_file << '\n';
- return -1;
- }
- // Convert to gray
- cv::Mat output;
- cvtColor(input, output, cv::COLOR_BGR2GRAY);
- // Show the original and the result
- cv::namedWindow("Original image", cv::WINDOW_AUTOSIZE);
- cv::imshow("Original image", input);
- cv::namedWindow("Gray image", cv::WINDOW_AUTOSIZE);
- cv::imshow("Gray image", output);
- // Wait until the presses any key
- cv::waitKey(0);
- return 0;
- }
- #include <iostream>
- using namespace std;
- int main()
- {
- cout << "Hello you" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement