페이지

2013년 1월 16일 수요일

프로그램 실행 시간 측정하기

#include <mmsystem.h>
DWORD dwStartTime = timeGetTime();
DWORD dwEndTime = timeGetTime();
printf("%d ms\n", dwEndTime-dwStartTime);
참조 라이브러리에 winmm.lib를 추가

2013년 1월 2일 수요일

파노라마(Panorama)

OpenCV 2.4 버전에는 stitcher 라는 클래스가 있어서 너무나 쉽게 파노라마 영상을 만들 수 있다.

간단하게 vector<Mat>를 하나 만든 다음 영상을 추가하고 실행하기만 하면 파노라마 영상을 손쉽게 만들 수 있다.
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/stitching/stitcher.hpp"

using namespace cv;
using namespace std;

int main(int argc, char* argv[])
{

 vector<Mat> images;
 Mat panorama;
 
 images.push_back(imread("Picture 1.jpg", CV_LOAD_IMAGE_COLOR));
 images.push_back(imread("Picture 2.jpg", CV_LOAD_IMAGE_COLOR));
 images.push_back(imread("Picture 3.jpg", CV_LOAD_IMAGE_COLOR));
 images.push_back(imread("Picture 4.jpg", CV_LOAD_IMAGE_COLOR)); 

 Stitcher stitcher = Stitcher::createDefault();
 stitcher.stitch(images, panorama);
 imshow("panorama", panorama);
 waitKey(0); 
 
 return 0;
 
}