Forum

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 - tforward2

Pages: [1] 2
1
Python and Java API / Build Mesh fails during python script
« on: February 11, 2015, 06:24:04 PM »
When running build mesh it fails and says "Error: bad allocation". What does the mean bad memory allocation? It's using the dense cloud and there are about 261 photos in the chunk.

This is the code I have for building the mesh:

Uses the dense cloud.

Code: [Select]
def build_mesh(chunk, surface, source, interpolation=PhotoScan.EnabledInterpolation, faces=PhotoScan.MediumFaceCount):
print ("\nBuilding ({}, {}) Mesh...\n".format(source, faces))
result = chunk.buildModel(surface, interpolation, faces, source)
return result

Log attached (edited slightly so that it would fit):

Processor:   Intel Xeon CPU E5-2666 v3 @ 2.90 GHz      
Memory:   30 GB      
System Type:   64 bit      
GPU:   N/A      
Operating System:   Windows Server 2012 Standard      

[Edit] Tried Running Manually and same error looks like 261 photos is to many for it to process. Will try splitting into smaller chunks and trying again.

2
Python and Java API / Re: Time to run Mesh
« on: February 11, 2015, 03:02:06 AM »
Does texture_size play a role.

I currently have it set to 4096, is there a way to best auto-determine what the texture size should be for build_texture process or does this not effect speed to much.

3
Python and Java API / Re: Python scripts collection?
« on: February 11, 2015, 03:00:12 AM »
Wouldn't a GIT style environment make more sense? Better collaboration etc.

4
Python and Java API / Time to run Mesh
« on: February 10, 2015, 04:48:39 AM »
I have a project with 100 photos on this system.
Tie Points: 18 000
Dense Cloud: 55 800 000

Processor: Intel Xeon CPU E5-1620 @ 3.60 GHz
Memory: 16 GB
System Type: 64 bit
GPU: Nividia Quadro 2000

It's 3 and a half hours into building the mesh and says it has another 8 and a half to go. Does this seem normal?

I'm using python to automated the processing and maybe one of the steps is causing it to take a very long time to run.

5
General / Re: Agisoft PhotoScan 1.1.0 pre-release
« on: January 07, 2015, 08:03:44 PM »
How did you fix this?

Hi Alexey,

Thanks for the quick response.
I have finished diagnosing this issue this weekend and it is not related to photoscan version 1.1.0.

This behavior is due to remote access of the computer via MS Terminal Services.

Sorry for reporting this before finishing the troubleshooting.


Orpheas

6
Python and Java API / Re: gpu_mask?
« on: January 07, 2015, 07:32:58 PM »
Thanks that is much more clear. Could you add what you just responded with to the API?

7
Python and Java API / Re: Classify ground points
« on: January 07, 2015, 06:48:11 PM »
To build model based on certain classes optional [classes] argument in chunk.buildModel() function should be used, where indices of the point classes should be specified.
Can you give an example of what this looks like?

8
Python and Java API / gpu_mask?
« on: January 07, 2015, 06:38:43 PM »
gpu_mask
GPU device bit mask: 1 - use device, 0 - do not use (i.e. value 5 enables device number 0 and 2).
Type int

1 On, 0 Off that makes sense

"Value 5 enables device 0 and 2" seems complete arbitrary, can someone explain the logic behind this?

What would a value of 7 do?

9
Python and Java API / Re: Problems Import photos into chunks from script
« on: December 30, 2014, 09:37:03 PM »
Note this is for the PhotoScan 1.0.4 build 1847 (64 bit). Have not tested it with hte new API so may no longer work.

Code: [Select]
if json_path != "":
print ("\nImport JSON chunk dictionary...")
print (json_path)
with open(json_path, 'r') as fp:
chunk_dict = json.load(fp)
else:
print ("Skipped importing JSON file.")

align_photos = app.getString(label="Align Photos: yes/no", value="yes")

def json_filepath_generator():
for key, values in chunk_dict.items():
yield key, values

def load_chunks_from_json():
chuck_gen = json_filepath_generator()
app.messageBox("Note: Adding chunks takes time... please be patient.")
print ("\nStart adding chunks...\n")
try:
while True:
chuck_list = next(chuck_gen)
cam = PhotoScan.Camera()

#Open One Path to get info from
cam.open(chuck_list[1][0])
# Load sensor calib
user_calib = PhotoScan.Calibration()
if not(user_calib.load(camera_calibration_file)):
app.messageBox("Loading of calibration file failed!")
sys.exit(1)
# build sensor object
sensor = PhotoScan.Sensor()
sensor.label = "Nikon D800E"
sensor.width = cam.width
sensor.height = cam.height
sensor.fixed = False
sensor.user_calib = user_calib
#New chunk
new_chunk = PhotoScan.Chunk()
new_chunk.crs = crs
new_chunk.projection = crs

new_chunk.label = "Chunk_{}".format(chuck_list[0])
print ("Adding chunk: " + str(new_chunk.label))
new_chunk.sensors.add(sensor)
doc.chunks.add(new_chunk)
for path in chuck_list[1]:
cam = PhotoScan.Camera()
if not(cam.open(path)):
app.messageBox("Loading of image failed: " + path)
cam.label = os.path.basename(path)
cam.sensor = sensor
new_chunk.cameras.add(cam)
new_chunk.enabled = True
new_chunk.ground_control.projection = crs
new_chunk.ground_control.crs = crs
new_chunk.ground_control.loadExif()
new_chunk.ground_control.apply()
print ("Chunk_{} added...".format(chuck_list[0]))
app.update()

#End of item in the Generator.
except StopIteration:
save_project()

10
I ended up building my own solution to this problem.

In short:

- Read EXIF X, Y data from all images
- Project Points to UTM
- Determine best size for chucks (this is more complicated then it sounds, took some trial and error to find something that works mostly used Arcpy tools for doing this)
- Build a JSON file that has the list of chucks and path to the image. (I did not want to move the images to a seperate dir as the copy/paste operation would take along time. Instead I just leave the images where they are but in Agisoft break into smaller chucks by importing the JSON file that tell the program how to chuck the data.)

11
Python and Java API / Re: Problems Import photos into chunks from script
« on: November 18, 2014, 10:47:22 PM »
I figured it out:

Within the GUI when you Select > Add Photos

It does a couple things in the background.

1 - It builds Camera Orientation information from the EXIF data which is what you see on the Ground Control Tab.
2 - It builds Camera Calibration information from the EXIF data which is what you see on the Tools > Camera Calibration window
3 - And adds the actual images to the chunk.

When you try to "Add photos" via python you have to provide it was both the Camera Orientation and Camera Calibration files first. If you don't it won't work as you expect it to.

If this information could be added to the API that would be great!

12
Python and Java API / Problems Import photos into chunks from script
« on: November 18, 2014, 01:32:58 AM »
From the GUI if I go:

>Add Chunk > Add Photos > Select Photos > and Import.

Photos come in fine "Chunk 1 (12 Cameras) [R]" and the blue point in the view window shows up where the points reside.
If I run align photos it works fine and I can see the points in the view window.

I'm trying to to this very step from a script, it does not work.

The cameras come in however they now say "Chunk 1 (12 Cameras)" without the [R] what does this mean?
Also in the view window the blue points are missing, and only appear if I goto:

Ground Control > Import EXIF

If I then perform Align Photos on these it runs through it all but with no real result. Log file below.

What I'm I missing?

projection is WGS84

Code: [Select]
import PhotoScan
import glob

app = PhotoScan.Application()
doc = PhotoScan.app.document
hint = r"Select the JSON file that holds the chunk, images"

# create chunk


# SET COORDINATE SYSTEM
print("---Settings coordinate system...")
# init coordinate system object
CoordinateSystem = PhotoScan.CoordinateSystem()
if not(CoordinateSystem.init("EPSG::4326")):
   app.messageBox("Coordinate system EPSG code not recognized!")
# define coordinate system in chunk

chunk = PhotoScan.Chunk()
chunk.label = "New_Chunk"
doc.chunks.add(chunk)
chunk.crs = CoordinateSystem
chunk.projection = CoordinateSystem

AerialImageFiles = glob.glob(r"G:\Seagate\2014-09-23_4\New folder\*.jpg")

# LOAD CAMERA CALIBRATION
print("---Loading camera calibration...")
# we need to open first image to define image size
cam = PhotoScan.Camera()
cam.open(AerialImageFiles[0])
# Load sensor calib
user_calib = PhotoScan.Calibration()
# build sensor object
sensor = PhotoScan.Sensor()
sensor.label = "MyCamera"
sensor.width = cam.width
sensor.height = cam.height
sensor.fixed = False
sensor.user_calib = user_calib
chunk.sensors.add(sensor)

# LOAD AERIAL IMAGES
print("---Loading images...")
# load each image
for FileName in AerialImageFiles:
   #print("File: " + FileName)
   cam = PhotoScan.Camera()
   if not(cam.open(FileName)):
      app.messageBox("Loading of image failed: " + FileName)
   cam.label = cam.path.rsplit("/", 1)[1]
   cam.sensor = sensor
   chunk.cameras.add(cam)

# LOAD CAMERA ORIENTATIONS
print("---Loading initial photo orientations...")
PhotoScan.app.update()

Quote
---Settings coordinate system...
---Loading camera calibration...
---Loading images...
---Loading initial photo orientations...

Finished adding chunks.
Detecting points...
photo 1: 18391 points
photo 2: 18434 points
photo 3: 18144 points
photo 4: 17929 points
photo 5: 17945 points
photo 6: 18034 points
photo 7: 17942 points
photo 8: 18558 points
photo 9: 18618 points
photo 10: 19493 points
photo 11: 19844 points
photo 12: 20671 points
points detected in 17.863 sec
Selecting pairs...
56192 matches found in 0.781 sec
60 of 66 pairs selected in 0.024 sec
Matching points...
351726 matches found in 7.54 sec
setting point indices... 46083 done in 0.004 sec
removed 1288 multiple projections
removed 3 points
generated 46080 tie points, 3.27598 average projections
finished matching in 26.236 sec
Estimating scene structure...
group size: 12 photos
finished sfm in 0.807 seconds
Finished processing in 27.055 sec (exit code 1)
>>>

13
I have a project area of 21 km by 13 km (13 miles x 8 miles) with about +10000 images covering the area. I need to produce a DEM and Orthophoto for the area. I cannot pass +10000 images to AgiSoft at once to process as will just run out of memory, so we have been manually splitting up the images into smaller 100-150 images chunks and then processing them. This is obviously a time consuming process and we want to ramp up are aerial imagery collection in the Spring. Does anyone have an automated workflow for pre-processing large aerial imagery into smaller workable chunks?

14
Python and Java API / Re: Example code for full processin chain
« on: November 15, 2014, 08:43:09 AM »
One question I have is how do you deal with the initial chunking of the data. You load all images into the tool at once however how do you deal with processing 10000 images at 14 mb per image? If you try to load that many images into the tool you'll have to have one hell of a rig to handle all that data. Are you manually selecting what photos get passed to the tool?

15
All images are in Lat/Long as they are pulled from the GPS. As mentioned the orthophoto still gets created it's just not the world file.

I also explicitly set the coordinate system.
Code: [Select]
crs = PhotoScan.CoordinateSystem()
#WGS84
crs.init("EPSG::4326")

I can manually do it with the GUI just does not really help as as I need it to be an automated process.

Pages: [1] 2