#include <Base/Image/ImageConvert.hh>
#include <OpenGLFramework/RenderingContext/glfPBuffer.hh>
#include <OpenGLFramework/SpecializedBatches/MultipleDepthWarp.hh>
#include <OpenGLFramework/Base/glfException.hh>
#include <Utils/Param.hh>
#include <Utils/IOUtils.hh>
#include <Base/Image/ImageIO.hh>
#include <Base/Image/Image.hh>
#include <Image/Camera.hh>
#include <Filter/Gauss.hh>
#include <Base/Debug/TimeMeasure.hh>
#include <OpenGLFramework/SpecializedBatches/DisparityInterpolator.hh>
#include <OpenGLFramework/SpecializedBatches/SeparabelBoxFilter.hh>
#include <Filter/Rescale.hh>
#include <Filter/Median.hh>
#include <Gui/biasgl.h>
using namespace std;
using namespace BIAS;
unsigned int width, height;
cout << ppp->
GetK() << endl;
HomgPoint2D rightBottom((
double)width-0.5, (
double) height - 0.5,1);
d1 = (d1 / d1[2]) * distFromCam;
d1[0] -= shift;
d2 = (d2 / d2[2]) * distFromCam;
d2[0] -= shift;
cout << ppp->
GetK() << endl;
}
int main(int argc, char* argv[]) {
string* firstDepthImageName = params.
AddParamString(
"firstDepthImage",
"image of first source camera", "", 'f');
string* secondDepthImageName = params.
AddParamString(
"secondDepthImage",
"image of second source camera", "", 's');
string* textureForTheFirstSourceProj = params.
AddParamString(
"projectiveTexture",
"texture for the first source proj", "", 'p');
"projection with params of target perspective cam", "", 't');
string* firstSourceProjName = params.
AddParamString(
"firstSourceProj",
"projection with params of first source cam", "", 'a');
string* secondSourceProjName = params.
AddParamString(
"secondSourceProj",
"projection with params of second source cam", "", 'b');
if (!IOUtils::ParseCommandLineEvalHelp(params, argc, argv))
return 0;
vector<ProjectionParametersPerspectiveDepth> pmdParams;
vector<Projection> sourceProjs;
if ((*firstSourceProjName).compare("")!=0) {
if (sourceProjs.back().Load(*firstSourceProjName) != 0) {
BIASERR("Could not load source tof projection: "<<*firstSourceProjName);
return -1;
}
}
if ((*secondSourceProjName).compare("")!=0) {
if (sourceProjs.back().Load(*secondSourceProjName) != 0) {
BIASERR("Could not load source tof projection: "<<*secondSourceProjName);
return -1;
}
}
if (targetProj.
Load(*targetProjName) != 0) {
BIASERR("Could not load target tof projection:"<<*targetProjName);
return -1;
}
if ((*firstDepthImageName).compare("")!=0) {
if (ImageIO::Load(*firstDepthImageName, firstDepthMap)) {
BIASERR("Could not load first depth map :"<< *firstDepthImageName);
return -1;
}
}
if ((*secondDepthImageName).compare("")!=0) {
if (ImageIO::Load(*secondDepthImageName, secondDepthMap)) {
BIASERR("Could not load second depth map :"<< *secondDepthImageName);
}
}
if ((*textureForTheFirstSourceProj).compare("")!=0) {
if (ImageIO::Load(*textureForTheFirstSourceProj, projTexture)) {
BIASERR("Could not load second depth map :"<< *textureForTheFirstSourceProj);
return -1;
}
}
ppp->
Rescale((
unsigned int)960, (
unsigned int) 540);
source0_ppp->
Rescale((
unsigned int) 960, (
unsigned int) 540);
if (ppp == NULL) {
BIASERR("target parameters are not from type perspective");
return -1;
}
gaussFilter.
Filter(firstDepthMap,tmpDepthMap);
firstDepthMap = tmpDepthMap;
try {
mpmdWarp.
Init(*ppp, sourceProjs);
cout <<
"frame rate = " << (1000.0 / (tm.
GetRealTime() / 1000000.0)) << endl;
((*textures)[0])->CopyToImage(warpedColor);
ImageIO::Save("colorImage1.png",warpedColor);
return -1;
}
return 0;
}