이미지 읽고,처리,저장,보여주기(영상처리 기본)

OpenCV/example 2013. 6. 15. 12:42

stdafx.h

#include <iostream>


using namespace std;

stdOCV.h

#include <opencv2/core/core.hpp>

#include <opencv2/highgui/highgui.hpp>

#include <opencv2/imgproc/imgproc.hpp>


using namespace cv;

main.cpp

#include "stdafx.h"
#include "stdOCV.h"

int main()
{
Mat originImg, resultImg;
originImg = imread("lena.tif"); //읽기
//cvtColor(originImg,resultImg,CV_RGB2GRAY);//처리, 컬러->그레이
resultImg = ~originImg; //반전
imwrite("resulteImg.jpg", resultImg); //저장
imshow("resulteImg", resultImg); //보여주기
waitKey(0);
return 0;
}




반응형