Saturday, November 22, 2014

05 儲存圖片

使用OpenCV 改變圖片的顏色成為灰色,並將資料儲存在檔案中,以及顯示在畫面上。



#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>
#include <string.h>
#include <fstream>

using namespace cv;

int main( int argc, char** argv )

char* imageName = argv[1];
Mat image;
image = imread( imageName, 1 );
if( argc != 2

編譯時的指令:

g++ main.cpp -o main -I/opt/local/include -L/opt/local/lib -lopencv_core.2.4.10


執行結果:
Screen Shot 2014-11-23 at 1.46.50 PM



05 儲存圖片

No comments:

Post a Comment