//---------------------------------------------------------------
    void DocumentExporter::exportMaxScene()
    {
        mStreamWriter.startDocument();

		createExporters();

		exportAsset();
		exportEffects();
		exportMaterials();
		exportGeometries();
		exportControllers();
		exportCameras();
		exportLights();
		exportImages();
		exportVisualScenes();
		if ( mOptions.getExportAnimations() )
			exportAnimations();
		exportScene();

		deleteExporters();

        mStreamWriter.endDocument();

		const ExportSceneGraph::XRefSceneGraphList& sceneGraphList = mExportSceneGraph->getXRefSceneGraphList();

		for ( ExportSceneGraph::XRefSceneGraphList::const_iterator it = sceneGraphList.begin(); it!=sceneGraphList.end(); ++it )
		{
			NativeString outputFileName(NativeString(getXRefOutputPath(*it)));
			DocumentExporter document(mMaxInterface, it->exportSceneGraph, outputFileName, mOptions, mExportOnlySelected);
			document.exportMaxScene();
		}
    }
示例#2
0
void SimpleViewer::slotProcess()
{
    if (d->canceled)
        return;

    if (!d->canceled && !createExportDirectories())
    {
            d->progressWdg->addedAction(i18n("Failed to create export directories"),
                                       ErrorMessage);
        return;
    }

    if (!d->canceled && !exportImages())
    {
        d->progressWdg->addedAction(i18n("Failed to export the images"),
                                   ErrorMessage);
        return;
    }

    if (!d->canceled && !createIndex())
    {
        d->progressWdg->addedAction(i18n("Failed to create index.html"),
                                   ErrorMessage);
        return;
    }

    if (!d->canceled && !copySimpleViewer())
    {
        d->progressWdg->addedAction(i18n("Failed to copy SimpleViewer files"),
                                   ErrorMessage);
        return;
    }

    if (!d->canceled && !upload())
    {
        d->progressWdg->addedAction(i18n("Failed to upload the gallery"),
                                   ErrorMessage);
        return;
    }

    if (d->canceled)
    {

        int ret = QMessageBox::warning(QApplication::activeWindow(),
                                       i18n("Export was canceled"),
                                       i18n("Do you want to delete files in %1 that have already been created?",
                                            d->settings->exportPath),
                                       QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::No));
        if (ret == QMessageBox::Yes)
        {
            QDir delDir(d->settings->exportPath);
            delDir.removeRecursively();
        }
    }

    if (!d->canceled)
    {
        d->progressWdg->addedAction(i18nc("Flash export has finished", "Finished..."),
                                    SuccessMessage);
        emit signalProcessingDone();

        if (d->settings->openInBrowser)
            QDesktopServices::openUrl(QUrl::fromLocalFile(d->settings->exportPath + QLatin1String("index.html")));
    }
}
void CCalibrateKinect::mainFunc ( const boost::filesystem::path& cFullPath_ )
{
    parseControlYAML();

    //load images
    if ( 1 == _nLoadRGB )
    {
        loadImages ( cFullPath_, _vstrRGBPathName, &_vRGBs );
        _nCols = _vImageResolution ( 0 ) = _vRGBs[0].cols;
        _nRows = _vImageResolution ( 1 ) = _vRGBs[0].rows;
        std::cout << "rgb images loaded.\n";
    }

    if ( 1 == _nLoadIR )
    {
        //PRINT( _vstrIRPathName );
        loadImages ( cFullPath_, _vstrIRPathName, &_vIRs );
        std::cout << "ir images loaded.\n";
    }

    if ( 1 == _nLoadUndistortedRGB )
    {
        loadImages ( cFullPath_, _vstrUndistortedRGBPathName, &_vRGBUndistorted );
        std::cout << "undistorted rgb images loaded.\n";
    }

    if ( 1 == _nLoadUndistortedIR )
    {
        loadImages ( cFullPath_, _vstrUndistortedIRPathName, &_vIRUndistorted );
        std::cout << "undistorted ir images loaded.\n";
    }

    if ( 1 == _nCalibrate )
    {
        //find corners
        locate2DCorners ( _vRGBs, _NUM_CORNERS_X, _NUM_CORNERS_Y, &_vvRGB2DCorners, _nPatternType );
        locate2DCorners ( _vIRs,  _NUM_CORNERS_X, _NUM_CORNERS_Y, &_vvIR2DCorners, _nPatternType );
        std::cout << "2d corners located \n" ;
        //PRINT( _vvIR2DCorners );

        definePattern ( _X, _Y, _NUM_CORNERS_X, _NUM_CORNERS_Y, _nPatternType, &_vPatterCorners3D );
        //PRINT( _vPatterCorners3D );
        std::cout << "define pattern \n";
        define3DCorners ( _vPatterCorners3D, views(), &_vv3DCorners );
        std::cout << "3d corners defined \n" ;

        //calibration
        calibrate();
        std::cout << "camera calibrated \n" ;

        //convert rotation std::vectors to rotation matrices
        convertRV2RM ( _vmRGBRotationVectors, &_vmRGBRotationMatrices );
        convertRV2RM ( _vmIRRotationVectors, &_vmIRRotationMatrices );

        std::cout << "convertRV2RM() executed \n" ;
    }

    //remove radical distortions
    if ( 1 == _nUndistortImages )
    {

        undistortImages ( _vRGBs, _mRGBK, _mRGBInvK, _mRGBDistCoeffs,  &_vRGBUndistorted );
        undistortImages ( _vIRs,  _mIRK,  _mIRInvK,  _mIRDistCoeffs,   &_vIRUndistorted );
        std::cout << "image undistorted.\n";
    }

    if ( 1 == _nExportUndistortedRGB )
    {
        exportImages ( cFullPath_, _vstrUndistortedRGBPathName,  _vRGBUndistorted );
        std::cout << " Undistorted rgb image exported. \n";
    }

    if ( 1 == _nExportUndistortedDepth )
    {
        exportImages ( cFullPath_, _vstrUndistortedIRPathName,  _vIRUndistorted );
        std::cout << " Undistorted depth image exported. \n";
    }

    if ( 1 == _nSerializeToXML )
    {
        save();
        std::cout << "serialized to XML \n" ;
    }

    if ( 1 == _nSerializeFromXML )
    {
        load();
        std::cout << "serialized from XML \n" ;
    }

    exportKinectIntrinsics();
    std::cout << " intrinsics exported \n" ;
    //importKinectIntrinsics();//obsolete
    importKinectIntrinsicsYML();
    std::cout << " intrinsics imported \n" ;
    return;
}