Package: photo4d
Photo4D: open-source time-lapse photogrammetryContributors by alphabetical orders:Simon Filhol (simon.filhol@geo.uio.no)Luc Girod (luc.girod@geo.uio.no)Alexis Perret (aperret2010@hotmail.fr)Guillaume Sutter (sutterguigui@gmail.com)DescriptionThis project consists of an automated program to generate point cloud from time-lapse set of images from independent cameras. The software:sorts images by timestamps,assess the image quality based on lumincace and bluriness,identify automatically GCPs through the stacks of images,run Micmac to compute point clouds, andconvert point cloud to rasters. (not implemented)The project should be based on open-source libraries, for public release.Installationinstall the latest version ofmicmacinstall python 3.6, and with anaconda, create a virtual environment with the following packages:opencvpandasmatplotliblxmlpillowpyxif(that needs to be downloaded fromhttps://github.com/zenwerk/Pyxif)wgethttps://github.com/zenwerk/Pyxif/archive/master.zip
unzipPyxif-master.zipcdPyxif-master
pythonsetup.pyinstallPDALjsonThe package is available via Pypipipinstallphoto4dUsage1. prepare your environment:- create a Python >= 3.6 virtual environment in which you install the required libraries (see above)
  - create a folder for the project with inside the project folder a folder called Images containing itself one folder per
  - Organize your photo with one folder per camera. For instance folder /cam1 constains all the images from Camera 1.
   camera├──Project└──Images├──Cam1├──Cam2├──Cam3└──Cam...2. Use the Photo4d class to process the images through MicMacSet the path correctly in the file MicmacApp/Class_photo4D.py, and follow these steps############################################################## Part 1importphoto4dasp4d# Create a new photo4d object by indicating the Project pathmyproj=p4d.Photo4d(project_path="point to project folder /Project")# Algorithm to sort images in triplets, and create the reference table with sets :date, valid set, image namesmyproj.sort_picture()# Algorithm to check picture quality (exposure and blurriness)myproj.check_picture_quality()############################################################## Part 2: Estimate camera orientation# Compute camera orientation using the timeSIFT method:myproj.timeSIFT_orientation()# Convert a text file containing the GCP coordinates to the proper format (.xml) for Micmacmyproj.prepare_gcp_files(path_to_GCP_file,file_format="N_X_Y_Z")# Select a set to input GCPsmyproj.set_selected_set("DSC02728.JPG")# Input GCPs in 3 steps# first select 3 to five GCPs to pre-orient the imagesmyproj.pick_initial_gcps()# Apply transformation based on the few GCPs previously pickedmyproj.compute_transform()# Pick additionnal GCPs, that are now pre-estimatedmyproj.pick_all_gcps()############################################################## Part2, optional: pick GCPs on extre image set## If you need to pick GCPs on another set of images, change selected set (this can be repeated n times):#myproj.compute_transform()#myproj.set_selected_set("DSC02871.JPG")#myproj.pick_all_gcps()# Compute final transform using all picked GCPsmyproj.compute_transform(doCampari=True)## FUNCTION TO CHANGE FOR TIMESIFT# myproj.create_mask() #To be finished############################################################## Part3: Compute point clouds# Compute point cloud, correlation matrix, and depth matrix for each set of imagemyproj.process_all_timesteps()# Clean (remove) the temporary working directionmyproj.clean_up_tmp()3. Process the point clouds withPDALCurrently Under DevelopmentPDALis a python library to process point cloud. It has an extensive library of algorithms available, and here we wrapped a general method to filter and extract Digital Elevation Models (DEMs) from the point clouds derived in the previous step.Micmac produces point clouds in the format.ply. The functions in the python classpcl_process()can convert, filter and crop the.plypoint clouds and save them as.lasfiles. Then the functionconvert_all_pcl2dem()will convert all point clouds stored inmy_pcl.las_pcl_flistto DEMs.With the functionmy_pcl.custom_pipeline(), it is possible to build custom processing pipeline following the PDAL JSON syntax. This pipeline can then be executed by running the functionmy_pcl.apply_custom_pipeline().See the source fileClass_pcl_processing.pyfor more details.# Create a pcl_class object, indication the path to the photo4d projectmy_pcl=p4d.pcl_process(project_path="path_to_project_folder")my_pcl.resolution=1# set the resolution of the final DEMs# Set the bounding box the Region of Interest (ROI)my_pcl.crop_xmin=416100my_pcl.crop_xmax=416900my_pcl.crop_ymin=6715900my_pcl.crop_ymax=6716700my_pcl.nodata=-9999# add path og the .ply point cloud files to the python classmy_pcl.add_ply_pcl()# filter the point clouds with pdal routine, and save resulting point clouds as .las filemy_pcl.filter_all_pcl()# add path of the .las filesmy_pcl.add_las_pcl()# conver the .las point clouds to DEMs (geotiff)my_pcl.convert_all_pcl2dem()# Extract Value orthophoto from RGBmy_pcl.extract_all_ortho_value()After this section you have clean point clouds, as well as DEMs in GeoTiff ready!RessourcesMicmac:http://micmac.ensg.eu/index.php/AccueilImage processing images: skimage, openCV, Pillowpython package to read exif data:https://pip.pypa.io/en/latest/user_guide/DevelopmentMessage us to be added as a contributor, then if you can also modify the code to your own convenience with the following steps:To work on a development version and keep using the latest change install it with the followinggitclonegit@github.com:ArcticSnow/photo4D.git
pipinstall-e[path2folder/photo4D]and to upload latest change to Pypi.org, simply:change the version number in the filephoto4d/__version__.pyrun from a terminal from the photo4D folder, given your $HOME/.pyc is correctly set:pythonsetup.pyupload