00001 /********************************************************************* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2009, Willow Garage, Inc. 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * * Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the following 00015 * disclaimer in the documentation and/or other materials provided 00016 * with the distribution. 00017 * * Neither the name of the Willow Garage nor the names of its 00018 * contributors may be used to endorse or promote products derived 00019 * from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 *********************************************************************/ 00034 00035 // convert a file in Freiburg's VERTEX / EDGE format into a set of constraints 00036 00037 #ifndef SBA_READ_SPA_H 00038 #define SBA_READ_SPA_H 00039 00040 #ifndef EIGEN_USE_NEW_STDVECTOR 00041 #define EIGEN_USE_NEW_STDVECTOR 00042 #endif // EIGEN_USE_NEW_STDVECTOR 00043 00044 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat(10) 00045 #include <Eigen/Eigen> 00046 #include <vector> 00047 00048 struct tinfo 00049 { 00050 int pn; // index of point 00051 int fn0, fn1; // index of frames 00052 int fpn0, fpn1; // local point index in frame 00053 double x0,y0,z0,u0,v0; // local XYZ coords and projection 00054 double x1,y1,z1,u1,v1; // local XYZ coords and projection 00055 }; 00056 00057 int 00058 ReadSPAFile(char *fin, // input file 00059 // node translation 00060 std::vector< Eigen::Vector3d, Eigen::aligned_allocator<Eigen::Vector3d> > &ntrans, 00061 // node rotation 00062 std::vector< Eigen::Vector4d, Eigen::aligned_allocator<Eigen::Vector4d> > &nqrot, 00063 // constraint indices 00064 std::vector< Eigen::Vector2i, Eigen::aligned_allocator<Eigen::Vector2i> > &cind, 00065 // constraint local translation 00066 std::vector< Eigen::Vector3d, Eigen::aligned_allocator<Eigen::Vector3d> > &ctrans, 00067 // constraint local rotation as quaternion 00068 std::vector< Eigen::Vector4d, Eigen::aligned_allocator<Eigen::Vector4d> > &cqrot, 00069 // constraint covariance 00070 std::vector< Eigen::Matrix<double,6,6>, Eigen::aligned_allocator<Eigen::Matrix<double,6,6> > > &cvar, 00071 // track info: point projections, see format description in IntelSeattle files 00072 std::vector<struct tinfo> &tracks 00073 ); 00074 00075 int 00076 ReadSPA2dFile(char *fin, // input file 00077 // node translation 00078 std::vector< Eigen::Vector2d, Eigen::aligned_allocator<Eigen::Vector2d> > &ntrans, 00079 // node rotation 00080 std::vector< double > &nqrot, 00081 // constraint indices 00082 std::vector< Eigen::Vector2i, Eigen::aligned_allocator<Eigen::Vector2i> > &cind, 00083 // constraint local translation 00084 std::vector< Eigen::Vector2d, Eigen::aligned_allocator<Eigen::Vector2d> > &ctrans, 00085 // constraint local rotation as quaternion 00086 std::vector< double > &cqrot, 00087 // constraint covariance 00088 std::vector< Eigen::Matrix<double,3,3>, Eigen::aligned_allocator<Eigen::Matrix<double,3,3> > > &cvar, 00089 // scan points 00090 std::vector< std::vector< Eigen::Vector2d, Eigen::aligned_allocator<Eigen::Vector2d> > > &scans 00091 ); 00092 00093 #endif