Created
February 3, 2014 08:41
-
-
Save dotchang/8780606 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include "GigECameraCap.h" | |
#include "opencv2/opencv.hpp" | |
#ifdef _DEBUG | |
#pragma comment(lib, "FlyCapture2d.lib") | |
#pragma comment(lib, "opencv_core248d.lib") | |
#pragma comment(lib, "opencv_highgui248d.lib") | |
#else | |
#pragma comment(lib, "FlyCapture2.lib") | |
#pragma comment(lib, "opencv_core248.lib") | |
#pragma comment(lib, "opencv_highgui248.lib") | |
#endif | |
using namespace FlyCapture2; | |
using namespace cv; | |
int main(int argc, char* argv[]) | |
{ | |
// Setup GigE Bus | |
GigEBusManager bus; | |
bus.Init(); | |
// Setup GigE Camera | |
GigECameraCap *cam = new GigECameraCap[bus.num_cameras()]; | |
for(unsigned int i=0; i<bus.num_cameras(); i++){ | |
cam[i].Init(bus.guid(i)); | |
} | |
Mat *show = new Mat[bus.num_cameras()]; | |
int num_of_rec = 0; | |
for(;;){ | |
// Capture | |
#ifdef _OPENMP | |
#pragma omp parallel for | |
#endif | |
for(int j=0; j<(int)bus.num_cameras(); j++){ | |
cam[j].grap(show[j]); | |
} | |
// Show | |
for(unsigned int j=0; j<bus.num_cameras(); j++){ | |
char winname[256]; | |
sprintf(winname,"cam%d",j); | |
imshow(winname,show[j]); | |
} | |
// Key Input | |
char c=waitKey(1); | |
if (c == '\x1b') break; | |
else if (c == 'r'){ | |
cout << "save " << num_of_rec << endl; | |
for(int j=0; j<(int)bus.num_cameras(); j++){ | |
char filename[1024]; | |
sprintf_s(filename, 1024, "calib%d_%02d.ppm", j, num_of_rec); | |
imwrite(filename,show[j]); | |
} | |
num_of_rec+=1; | |
} | |
} | |
delete [] show; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, @dotchang.
Thanks for your code. nice works ~.
And then,
How about using the cuFFT instead using of OpenMP?
In OpenCV3.0 there are 2D phase_correlation function is implemented very fast performance without CUDA.
But there is no 1D phase_correlation function not yet.
What is the principle of speediness of OpenCV3's POC ?
I wonder.