merge_databases.py
Go to the documentation of this file.
00001 #
00002 # Copyright (c) 2010, Georgia Tech Research Corporation
00003 # All rights reserved.
00004 #
00005 # Redistribution and use in source and binary forms, with or without
00006 # modification, are permitted provided that the following conditions are met:
00007 #     * Redistributions of source code must retain the above copyright
00008 #       notice, this list of conditions and the following disclaimer.
00009 #     * Redistributions in binary form must reproduce the above copyright
00010 #       notice, this list of conditions and the following disclaimer in the
00011 #       documentation and/or other materials provided with the distribution.
00012 #     * Neither the name of the Georgia Tech Research Corporation nor the
00013 #       names of its contributors may be used to endorse or promote products
00014 #       derived from this software without specific prior written permission.
00015 #
00016 # THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''AS IS'' AND
00017 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 # DISCLAIMED. IN NO EVENT SHALL GEORGIA TECH BE LIABLE FOR ANY DIRECT, INDIRECT,
00020 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00021 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00022 # OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00023 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
00024 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00025 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 #
00027 
00028 #  \author Martin Schuster (Healthcare Robotics Lab, Georgia Tech.)
00029 import roslib; roslib.load_manifest('laser_camera_segmentation')
00030 from labeling import label_object, scan_dataset, scans_database
00031 
00032 import copy
00033 
00034 ##WARNING! THIS DOES A PARTIAL COPY OF A DATABASE! BACKUP BEFOREHAND AND KNOW WHAT YOU'RE DOING!!##
00035 
00036 path = '/home/martin/robot1_data/usr/martin/laser_camera_segmentation/labeling'
00037 f1 = 'database_changed.pkl'
00038 db1 = scans_database.scans_database()
00039 db1.load(path, f1)
00040 
00041 f2 = 'database.pkl'
00042 db2 = scans_database.scans_database()
00043 db2.load(path, f2)
00044 
00045 #assume db2 is equal or larger, copy changes from db1 to db2!
00046 d2 = db2.get_first_dataset()
00047 d1 = db1.get_first_dataset()
00048 while False != d1:
00049 
00050     if False != d2 and d1.id == d2.id:
00051         print 'copy', d1.id
00052         d2.dict = copy.deepcopy(d1.dict)
00053         
00054     d2 = db2.get_next_dataset()
00055     d1 = db1.get_next_dataset()
00056 
00057 
00058 
00059 db2.save()


laser_camera_segmentation
Author(s): Martin Schuster, Advisor: Prof. Charlie Kemp, Lab: Healthcare Robotics Lab at Georgia Tech
autogenerated on Wed Nov 27 2013 11:56:44