Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - StevenF

Pages: 1 [2] 3
I don't know why CloudCompare is rescaling the data, but it's also changing the point data format. Both of these changes are going to making your las files bulkier than necessary. Even 0.001 (1mm) is too high for aerial collections. Your data probably doesn't have that level of accuracy.

I'd recommend using lastools to rescale and change the point format of your data to make it more compact.  See this lastools posting on fixing crappy las files.!searchin/lastools/crappy$20las/lastools/oK81EEr7W3Y/pYBvwTzKOugJ.

General / Re: Agisoft PhotoScan 1.1.0 pre-release
« on: December 04, 2014, 08:49:38 PM »
Hi Alexey,
Copying chunks appears to work in the new build for Linux 64 bit Pro. Thank you.

General / Re: Crash - how much Ram is recommended? I have 20 gigs
« on: December 04, 2014, 08:12:00 PM »
Hello Brit,

Script samples for the version 1.0.4 and 1.1.0 are published in the following thread:

I've been using a modified version of this script and it's working great. But the process has taken over a week to run so far.  I made some minor modifications to export the dense cloud of each tile and to save the tile to a new document which can help in saving your progress in case a crash occurs. You can merge the tile documents into a single document using the merge_tiles function listed near the top. Here is the script that works with version 1.1.0 build 1985:

Code: [Select]
## Splits active chunk into user defined grid of sub-chunks (images are kept but bounding box is split)
## after chunk being split, for every smaller chunk mesh is generated based on the dense cloud, then dense cloud is removed from smaller chunks
##additional stripes will be generated and exported

#arguments - X and Y grid sizes

#compatibility PhotoScan Professional 1.1.0
#script v5.3
# Obtained from Alexey at Agisoft on 11/17/14
# Modified by Steven F

# Build dense cloud in main chunk but perform save as after every tile

import PhotoScan
import sys

doc =
orig_path = doc.path
chunk = doc.chunk

def dist(v0, v1):
Calculate distance between two points defined as vectors
distance = (v1 - v0)
return distance.norm() #**2

# take a folder of photoscan documents and merge them into one document then save
def merge_tiles(doc_tile_folder, merged_file):
import glob
tile_docs = glob.glob(doc_tile_folder + "*.psz")
merged_doc = PhotoScan.Document()
for doc in tile_docs:
tile = PhotoScan.Document()

#parts of the model, 3 by default
partsX = 20   
partsY = 20
if len(sys.argv) == 2:   
parts = int(sys.argv[1])
partsX = partsY = parts
elif len(sys.argv) == 3:
partsX = int(sys.argv[1])
partsY = int(sys.argv[2])
print("Script started...")

# dense cloud settings
quality = PhotoScan.UltraQuality
filter = PhotoScan.MildFiltering
reuse_depth = False

# tile doc save and dense cloud export paths
tile_basename = "tileUltra"
las_tile_folder = "/project/ultra_las/"
doc_tile_folder = "/project/ultra_docs/"
las_basepath = las_tile_folder + tile_basename
doc_basepath = doc_tile_folder + tile_basename

# get existing chunk region
region = chunk.region
r_center =
r_rotate = region.rot
r_size = region.size

# part size based on existing chunk region and number of parts
x_scale = r_size.x / partsX   
y_scale = r_size.y / partsY   
z_scale = r_size.z 

# Offset between parts. I don't understand why it wouldn't just be the size,
# but they use center and rotate as well.
offset = r_center - r_rotate * r_size /2.

# Create a dense cloud for each part in a seperate chunk
for j in range(1, partsY + 1): 
for i in range(1, partsX + 1):
print("Starting tile x", i, "y", j)

chunk.label = "Chunk "+ str(i)+ "\\" + str(j)

# set the region for the part
new_region = PhotoScan.Region()
new_rot = r_rotate
new_center = PhotoScan.Vector([(i - 0.5) * x_scale, (j - 0.5) * y_scale, 0.5 * z_scale])
new_center = offset + new_rot * new_center
new_size = PhotoScan.Vector([x_scale, y_scale, z_scale])
new_region.size = new_size = new_center
new_region.rot = new_rot

chunk.region = new_region

# print region center
print("Region center = ",

# create a dense cloud for the part
denseStatus = chunk.buildDenseCloud(quality = quality,
filter = filter,
reuse_depth = reuse_depth)

# # export dense points to LAS
if denseStatus == True:
print ("Dense cloud generation successful. Exporting LAS tile")
las_file = las_basepath + "_x" + str(i) + "y" + str(j) + ".las"
exportPoints = chunk.exportPoints(las_file,
  source = PhotoScan.PointsSource.DensePoints,
  format = "las",
  projection =
print("Point export successful?", str(exportPoints))

print("Dense cloud generation failed. Nothing to export.")

# # save as a new document
new_doc = doc_basepath + "_x" + str(i) + "y" + str(j) + ".psz"

# remove depth map, dense cloud, and model to save memory
chunk.depth_maps = None
chunk.dense_cloud = None
chunk.model = None

print("Finished with tile x", i, "y", j)

print("Script finished...")

You'll want to change a number of these settings of course: partsX, partsY, quality, filter, reuse_depth, tile_basename, las_tile_folder, doc_tile_folder

Lately I've been thinking that it would be nice if this process could be sped up by only calculating a depth map once for each image using every image it overlaps. This would probably require a significant change in the way PhotoScan is programmed, but it would remove the need to recalculate depth for an image that overlaps multiple tiles.

General / Dense Cloud Not Using All Cameras?
« on: November 21, 2014, 09:11:11 PM »
When I click on a point and select "Filter Photos by Point" I get a list of 17 photos, but when I run Build Dense Cloud over the same area the console readout says: "Selected 7 cameras."
Why is PhotoScan not including all cameras that overlap the region when building the dense cloud?

General / Re: Agisoft PhotoScan 1.1.0 pre-release
« on: November 19, 2014, 01:53:12 AM »
Hello Steven,

Thanks for reporting, however, we haven't been able to reproduce the problem with crashes.

But as for the creating duplicated copies of chunks and adding them to the existing document, we will try to implement this functionality in Python API.

Hi Alexey,
It could be my install. I'm working with the 64-bit Linux version which fails on the chunk.copy() command. I just downloaded the Windows 64-bit version and it worked fine. I load in a project and execute the following at the console:
import PhotoScan
doc =
chunk = doc.chunk
chunk2 = chunk.copy()

General / Re: Build Depth Maps Without Creating Dense Cloud?
« on: November 18, 2014, 08:10:18 PM »
I have 48gb of RAM and I'm working with 944 images that are 7680x13824. So I'm going to have tile the whole process. It will probably take quite awhile, but it works.

General / Re: Build Depth Maps Without Creating Dense Cloud?
« on: November 18, 2014, 07:01:30 AM »
I'm running out of memory during Load Photos. I tried the approach of building depth maps then tiling the dense cloud production on a smaller project area. It turns out the size of my test area was in the sweet spot where I could load photos, reconstruct geometry and only run out of memory during dense cloud construction. I thought the approach would scale up but quickly found out that it didn't. I'll have to run the whole process in small tiles.

General / Build Depth Maps Without Creating Dense Cloud?
« on: November 18, 2014, 02:02:32 AM »
Is it possible to create and save depth maps from the Build Dense Cloud process without going on to construct a dense cloud from the depth maps?
This post references a "Build Depth Map" option in the photo pane context menu:
I can't seem to find this option. Has it been removed?

The reason I ask is that my machine seems to be capable of "Reconstructing Geometry" (aka building depth maps) during the Build Dense Cloud process, but then it runs out of memory when it actually goes to make a point cloud from the depth maps. I'm running on linux so the OOM killer kills the process when "accumulating data..." for too many cameras.

If I could build the depth maps separately then I could later construct dense clouds in smaller tiles to avoid running out of memory. This would be much faster than tiling the whole build dense cloud process (i.e. reconstructing geometry + constructing point cloud). I tested this out.

I tried tiling the whole Build Dense Cloud with a small data set on medium quality and it took about 30 minutes. If I start the Build Dense cloud process for the entire project area and cancel it after depth maps have been created then I can reuse the depth maps to tile the dense cloud construction step. This method only takes about 7 minutes, but I have to cancel the Build Dense Cloud process right after it's done constructing depth maps or I risk crashing Photoscan and losing everything. This could be days worth of processing for large projects!

General / Re: Agisoft PhotoScan 1.1.0 pre-release
« on: November 18, 2014, 01:14:34 AM »
PhotoScan.Chunk.copy() is causing PhotoScan to crash on v 1.1.0 build 1985 (64 bit). I submitted a crash report.
Here is a simple work around in case anyone else working with the beta is having this problem:

doc =

# create a copy of the document
doc2 = PhotoScan.Document()

# append to current document

# remove unwanted chunks if necessary

Feature Requests / Re: Extremely large projects 1000+ photos
« on: November 15, 2014, 11:42:44 PM »
This is a very old topic but seems to me like an excellent idea. Has anything like this been implemented yet in Photoscan? I'm currently trying to implement my own "bounding box splitter" in the Python API, but I would love it if there was already a good solution.

Hi Andy,
You can set the bounding region using the Python API as discussed in the following forum post:

The bounding region uses an arbitrary coordinate system so you need to transform back and forth between this coordinate system and a geographic coordinate system if you want to set the region using geographic coordinates. I just started working a python script to process a chunk in tiles by resizing and moving the region throughout the project area. I'll post it up as an example when I'm done.

General / Tiled Processing by Changing Region Extent
« on: November 10, 2014, 08:56:01 AM »
I'm attempting to generate a dense cloud with 1000 large photos (~112 MP) from a large format metric camera (Z/I DMC-1). My machine has 48 gb of RAM so it's not possible to generate a dense cloud on High or Ultra High with this many images as a single large chunk or even a handful of smaller chunks.  I would probably have to create more than 50 chunks to process this many large images so I'm considering an alternative tiling process.

This process would involve the following steps:
1. Decrease the size of the region bounding box to cover an area that could be handled with my available memory (maybe 5 km^2)
2. Identify and align this small region to the geographic northwest corner of the bounding box for the whole project
3. Generate a dense cloud with Quality = High or Ultra High for this small region
4. Export the dense cloud to LAS
5. Move the region over to the next tile ( ~5km east) and repeat the process until all tiles have an exported LAS

I think the two primary benefits of this approach over chunking would be (1) a removal of the need to manually break up chunks and (2) a removal of duplicate points in the overlapping areas that are created when using multiple overlapping chunks. The obvious downside is that I couldn't generate a complete mesh or orthomosaic within photoscan, but I have external software that I could use for these processes. 

So my questions are:
Are there any other drawbacks to this approach that I'm overlooking?
Is chunking a better approach if all I want is a dense cloud?
Has anyone tried this process or implemented it in a python script that they'd be willing to share?

General / Re: Omega phi kappa import
« on: October 31, 2014, 07:51:24 PM »
I have a follow up question.
If you have omega-phi-kappa is it better to match this to roll pitch and yaw in photoscan or exclude it entirely?

I've been importing as: Pitch = Omega, Roll = Phi, and Yaw = Kappa. I know they aren't actually equivalent, so is it better to not load orientation and simply let Photoscan solve these parameters? I'd still like to use XYZ camera coordinates to aid in the initial alignment.

General / Re: Problem with orthophoto seamlines!!
« on: September 25, 2014, 04:44:30 PM »
Hi Nadar, You can already do this by disabling all but one camera and then using export orthophoto. This process can be automated with the python api.

I'm just saying that exporting individual orthophotos and mosaicing them in other software is an option. Currently, it's what you need to do if you want control over seamlines, but I think there are workarounds to seamline control in Photoscan using masks.

I know ArcGIS is capable of mosaicing and seamline editing but I actually haven't tried it yet. I've mainly worked with Socet Set and Erdas Imagine for orthomosacing. I'm sure there are other free programs that are capable of it though. GRASS, QGIS, Orfeo Toolbox, and SAGA GIS are a few possibilities worth looking into.

Pages: 1 [2] 3