c++文件操作——输入文件包含矩阵形式的数据,输出为vector
CMake File Example From Official Guide

Using OpenCV with gcc and CMake

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

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 );

  waitKey(0);

  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 .
make

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


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter