const double scale = 0.2;
glPushMatrix();
glMultMatrixd(gl_mat);
glColor3d(color[0], color[1], color[2]);
glBegin(GL_LINES);
glVertex3f(0.0, 0.0, -scale);
glVertex3f(0.0, 0.0, scale);
glVertex3f(0.0, -scale, 0.0);
glVertex3f(0.0, scale, 0.0);
glVertex3f(-scale, 0.0, 0.0);
glVertex3f(scale, 0.0, 0.0);
glEnd();
glPopMatrix();
}
};
{
static IplImage *rgb = 0;
static IplImage* bg_image = 0;
bool flip_image = (image->origin?true:false);
if (flip_image) {
cvFlip(image);
image->origin = !image->origin;
}
cout<<" [Ok]"<<endl;
} else {
cout<<" [Fail]"<<endl;
}
double p[16];
bg_image->origin = 0;
std::cout<<"Using MultiMarker defined in mmarker.xml."<<std::endl;
} else {
std::cout<<"Couldn't load mmarker.xml. Using default 'SampleMultiMarker' setup."<<std::endl;
}
}
}
if (sfm->
Update(image,
false,
true, 7.f, 15.f)) {
double gl[16];
std::map<int, SimpleSfM::Feature>::iterator iter;
if (iter->second.has_p3d)
{
own_drawable_count++;
}
}
}
if (iter->second.has_p3d)
{
own_drawable_count++;
}
}
}
}
if (image->nChannels == 1) cvCvtColor(image, rgb, CV_GRAY2RGB);
else if (image->nChannels == 3) cvCopy(image, rgb);
cvResize(rgb, bg_image);
if (flip_image) {
cvFlip(image);
image->origin = !image->origin;
}
}
{
if(key == 'r')
{
}
else return key;
return 0;
}
int main(
int argc,
char *argv[])
{
try {
filename = filename.substr(filename.find_last_of('\\') + 1);
std::cout << "SamplePointcloud" << std::endl;
std::cout << "================" << std::endl;
std::cout << std::endl;
std::cout << "Description:" << std::endl;
std::cout << " This example shows simple structure from motion approach that can be "<< std::endl;
std::cout << " used to track environment beyond an multimarker setup. To get this "<< std::endl;
std::cout << " example work properly be sure to calibrate your camera and tune it "<< std::endl;
std::cout << " to have fast framerate without motion blur. "<< std::endl;
std::cout << std::endl;
std::cout << " There are two possible approaches Update() and UpdateRotationsOnly()."<< std::endl;
std::cout << " By default the Update() is used but you can easily uncomment the "<< std::endl;
std::cout << " other one if needed."<< std::endl;
std::cout << std::endl;
std::cout << "Usage:" << std::endl;
std::cout << " " << filename << " [device]" << std::endl;
std::cout << std::endl;
std::cout << " device integer selecting device from enumeration list (default 0)" << std::endl;
std::cout << " highgui capture devices are prefered" << std::endl;
std::cout << std::endl;
std::cout << "Keyboard Shortcuts:" << std::endl;
std::cout << " r: reset" << std::endl;
std::cout << " q: quit" << std::endl;
std::cout << std::endl;
if (plugins.size() < 1) {
std::cout << "Could not find any capture plugins." << std::endl;
return 0;
}
std::cout << "Available Plugins: ";
std::cout << std::endl;
if (devices.size() < 1) {
std::cout << "Could not find any capture devices." << std::endl;
return 0;
}
if (argc > 1) {
selectedDevice = atoi(argv[1]);
}
if (selectedDevice >= (int)devices.size()) {
}
std::cout << "Enumerated Capture Devices:" << std::endl;
std::cout << std::endl;
std::string uniqueName = devices[selectedDevice].uniqueName();
if (cap) {
std::stringstream settingsFilename;
settingsFilename << "camera_settings_" << uniqueName << ".xml";
std::cout << "Loading settings: " << settingsFilename.str() << std::endl;
}
std::stringstream title;
std::cout << "Saving settings: " << settingsFilename.str() << std::endl;
}
delete cap; cap = NULL;
}
}
else {
std::cout << "Could not initialize the selected capture backend." << std::endl;
}
return 0;
}
catch (const std::exception &e) {
std::cout << "Exception: " << e.what() << endl;
}
catch (...) {
std::cout << "Exception: unknown" << std::endl;
}
}