CMake File Example From Official Guide

Using OpenCV with gcc and CMake

Author posted @ 2013年3月25日 08:46 in C/C++ , 3278 阅读

Create a program using OpenCV

#include <stdio.h>
#include <opencv2/opencv.hpp>

using namespace cv;

int main( int argc, char** argv )
  Mat image;
  image = imread( argv[1], 1 );

  if( argc != 2 || !image.data )
      printf( "No image data \n" );
      return -1;

  namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
  imshow( "Display Image", image );


  return 0;

Create a CMake file

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )

Generate the executable<

cd <DisplayImage_directory>
cmake .

From http://docs.opencv.org/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html

rumah angker 说:
2019年12月05日 14:53

oohhh god thanks so much for helping me. thank you my man for the information

seo 说:
2021年12月28日 09:07

I would really like to try out this door company's services. I heard a lot of great things about Caldwells. Here's the https://www.digitekprinting.com/canvas-prints-2 to their site and I would gladly appreciate your thoughts about them.

SEO 说:
2022年2月10日 01:08

This is my first visit to your web journal! We are a group of volunteers and new activities in the same specialty. Website gave us helpful data to work. https://voyance-tel-avenir.com

Chhattisgarh 11th Pr 说:
2022年8月19日 03:09

Important Model Question Papers for Other Subjects and the Eleventh Standard in Chhattisgarh are Available for Download Based on the Subjects List. The Class 11th Important Model Question Paper 2023 has been distributed Chhattisgarh 11th Previous Paper 2023 in both offline and online formats by the Chhattisgarh Board of Secondary Education (CGBSE). Chhattisgarh Class 11th Significant Important Model Question Paper 2023 are Available on the Official Site as well as Here. Chhattisgarh Higher Secondary Board Important Model Question Paper 2023 Subject-wise are Provided Here. Important Exam Model Question Paper 2023 are used as the Board Assessments' reference materials.

anonymous 说:
2023年7月19日 17:35

In this case you will begin it is important, it again produces a web site a strong significant internet site: Kissimmee Bed Bug Pest Control

登录 *

loading captcha image...
or Ctrl+Enter