Difference between revisions of "OpenCV/IO/WriteImage"

From ProgrammingExamples
Jump to: navigation, search
(Created page with '==WriteImage.cxx== <source lang="cpp"> #include "opencv2/highgui/highgui.hpp" #include <iostream> #include <string> int main( int argc, char* argv[]) { std::string inputFileN…')
(No difference)

Revision as of 19:26, 20 January 2011

WriteImage.cxx

#include "opencv2/highgui/highgui.hpp"
 
#include <iostream>
#include <string>
 
int main( int argc, char* argv[])
{
  std::string inputFileName = argv[1];
  std::string outputFileName = argv[2];
 
  cv::Mat image = cv::imread(inputFileName, 1);
 
  cv::imwrite(outputFileName, image);
 
  return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
 
PROJECT(WriteImage)
 
FIND_PACKAGE(OpenCV REQUIRED )
INCLUDE_DIRECTORIES( ${OPENCV_INCLUDE_DIR} )
 
ADD_EXECUTABLE(WriteImage WriteImage.cxx)
TARGET_LINK_LIBRARIES(WriteImage opencv_core opencv_highgui
opencv_flann opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_objdetect
          opencv_features2d opencv_calib3d opencv_legacy opencv_contrib
)