beverley-gorry/colmap-vslamlab
0
1# Copyright (c), ETH Zurich and UNC Chapel Hill.2# All rights reserved.3#4# Redistribution and use in source and binary forms, with or without5# modification, are permitted provided that the following conditions are met:6#7# * Redistributions of source code must retain the above copyright8# notice, this list of conditions and the following disclaimer.9#10# * Redistributions in binary form must reproduce the above copyright11# notice, this list of conditions and the following disclaimer in the12# documentation and/or other materials provided with the distribution.13#14# * Neither the name of ETH Zurich and UNC Chapel Hill nor the names of15# its contributors may be used to endorse or promote products derived16# from this software without specific prior written permission.17#18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"19# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE21# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE22# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR23# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF24# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS25# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN26# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)27# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE28# POSSIBILITY OF SUCH DAMAGE.29 30 31import filecmp32 33from read_write_fused_vis import read_fused, write_fused34 35 36def main():37 import sys38 39 if len(sys.argv) != 5:40 print(41 "Usage: python test_read_write_fused_vis.py "42 "path/to/input_fused.ply path/to/input_fused.ply.vis "43 "path/to/output_fused.ply path/to/output_fused.ply.vis"44 )45 return46 47 print(48 "Checking consistency of reading and writing fused.ply and fused.ply.vis files ..."49 )50 51 path_to_fused_ply_input = sys.argv[1]52 path_to_fused_ply_vis_input = sys.argv[2]53 path_to_fused_ply_output = sys.argv[3]54 path_to_fused_ply_vis_output = sys.argv[4]55 56 mesh_points = read_fused(57 path_to_fused_ply_input, path_to_fused_ply_vis_input58 )59 write_fused(60 mesh_points, path_to_fused_ply_output, path_to_fused_ply_vis_output61 )62 63 assert filecmp.cmp(path_to_fused_ply_input, path_to_fused_ply_output)64 assert filecmp.cmp(65 path_to_fused_ply_vis_input, path_to_fused_ply_vis_output66 )67 68 print("... Results are equal.")69 70 71if __name__ == "__main__":72 main()73 