Difference between revisions of "OpenCV/IO/WriteImage"
From ProgrammingExamples
< OpenCV
Daviddoria (Talk | contribs) (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…') |
Daviddoria (Talk | contribs) m (→CMakeLists.txt) |
||
| Line 30: | Line 30: | ||
ADD_EXECUTABLE(WriteImage WriteImage.cxx) | ADD_EXECUTABLE(WriteImage WriteImage.cxx) | ||
| − | TARGET_LINK_LIBRARIES(WriteImage | + | TARGET_LINK_LIBRARIES(WriteImage ${OpenCV_LIBS}) |
| − | + | ||
| − | + | ||
| − | ) | + | |
</source> | </source> | ||
Latest revision as of 15:47, 21 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_LIBS})