static_virtual_camera.cpp
Go to the documentation of this file.
00001 /*
00002  * static_virtual_camera.cpp
00003  *
00004  *  Created on: Aug 23, 2010
00005  *      Author: petrito1@cmp.felk.cvut.cz
00006  *
00007  * Test program for LadybugVirtualCamera.
00008  * Loads mesh, alphamasks and images, and outputs rendered virtual view image.
00009  *
00010  * Usage: static_virtual_camera <mesh file> <alphamask prefix> <image prefix>
00011  */
00012 
00013 #include <stdio.h>
00014 
00015 #include <GL/glew.h>
00016 #include <GL/gl.h>
00017 #include <GL/glut.h>
00018 #include <opencv2/core/core.hpp>
00019 #include <opencv2/highgui/highgui.hpp>
00020 
00021 #include "LadybugVirtualCamera.h"
00022 
00023 using std::string;
00024 
00025 using cv::Mat;
00026 
00027 using nifti::ladybug::LadybugVirtualCamera;
00028 
00029 int main(int argc, char **argv) {
00030   if (argc < 4) {
00031     return -1;
00032   }
00033 
00034   glutInit(&argc, argv);
00035 
00036   string meshFile = string(argv[1]);
00037   string alphamaskPrefix = string(argv[2]);
00038   string imagePrefix = string(argv[3]);
00039 
00040   LadybugVirtualCamera virtualCamera;
00041   virtualCamera.loadMesh(meshFile);
00042   virtualCamera.loadAlphamask(alphamaskPrefix);
00043 
00044   const int nCams = 6;
00045   for (int iCam = 0; iCam < nCams; iCam++) {
00046     char imagePathBuffer[128];
00047     sprintf(imagePathBuffer, "%s%d%s", imagePrefix.data(), iCam, ".ppm");
00048     Mat image = cv::imread(string(imagePathBuffer));
00049     virtualCamera.setImage(iCam, image);
00050   }
00051 
00052   Mat view;
00053   virtualCamera.renderView(view);
00054   cv::imwrite("view.png", view);
00055 }
00056 
 All Classes Namespaces Files Functions Variables Typedefs Defines


omnicamera
Author(s): Tomas Petricek / petrito1@cmp.felk.cvut.cz
autogenerated on Tue Dec 10 2013 14:26:53