Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: nickc on January 08, 2015, 06:44:33 PM

Title: Meet Talus... plus some questions
Post by: nickc on January 08, 2015, 06:44:33 PM
Hello everyone

I would like you to meet Talus...who has many talents.  :)
One of which is providing us with very accurate camera array.

The Shoe image provided below is one of our first tests and the results are exciting.

(http://www.nickculpin.com/other/Talus.JPG)

(http://www.nickculpin.com/other/Shoe.JPG)

As you can imagine, having a robot means we are trying to automate as much of our pipeline as possible. I've been putting together a bunch scripts to interact with various other aspects of our pipeline (most of which are proprietary). Eventually we would like to have a single click to photograph & process all of our data but for now we are really happy to just see things up and running properly.

I do have a few questions regarding the python API...I've been hitting some walls. The Script seems to get as far as chunk.matchPhotos() but then fails when it gets into photo alignment. If anyone has ideas on ways I can improve this I would very much appreciate it.

I am using Agisoft PhotoScan Professional Edition version 1.1.0 build 2004 (64)

Here is my current script...:

Code: [Select]
import os
import PhotoScan

# Define: Home Directory
Home = "C:\\raw\\tiff\\"
os.chdir(Home)
print ("home: " + Home)

# Set Application Objects
doc = PhotoScan.app.document
print ("Script Started")

# Define Chunk
chunk = PhotoScan.app.document.addChunk()
chunk.label = "MainChunk"

# Find Images
ImageFiles = []
for photo in os.listdir (Home):
if photo.endswith('.tif'):
ImageFiles.append(photo)
print (ImageFiles)

# Load Image Files into Chunk Camera
chunk.addPhotos(ImageFiles)
chunk.importMasks(path='',method='alpha')
camera = chunk.cameras[0]

# Match Photos
chunk.matchPhotos()

# Align Photos
chunk.photoAlign()

# Build Dense Cloud
chunk.buildDenseCloud()

#Build Model
chunk.buildModel()

# Build UVs
chunk.buildUV()

# Build Texture
chunk.buildTexture()
doc.save()




Anyways thanks everyone...and special thanks to the agisoft team for being so responsive.
Take Care!

-nick-
Title: Re: Meet Talus... plus some questions
Post by: Alexey Pasumansky on January 08, 2015, 06:50:17 PM
Hello Nick,

After chunk.matchPhotos() you need to use chunk.alignCameras(), otherwise you do not have any estimated camera positions, unless you have used importCameras option, but in the latter case you'll need to use chunk.buildPoints() function.
Title: Re: Meet Talus... plus some questions
Post by: nickc on January 08, 2015, 10:28:27 PM
Awesome that worked!

i was using chunk.alightPhotos() before and that didnt work...whats the difference?
Title: Re: Meet Talus... plus some questions
Post by: nickc on January 08, 2015, 10:31:45 PM
Also...it seems that i'm dropping some camera data thats held in the .tif file somewhere? The cameras are stacking up on each other.

edit - Ah... i noticed i was loading the masks but not actually using them. all good now. thanks again!
Title: Re: Meet Talus... plus some questions
Post by: Alexey Pasumansky on January 11, 2015, 02:58:29 PM
Hello Nick,

There's no .alignPhotos() method in Python API of PhotoScan Pro 1.1.0.
Title: Re: Meet Talus... plus some questions
Post by: nickc on January 12, 2015, 05:29:12 PM
Ah! thanks!
Title: Re: Meet Talus... plus some questions
Post by: Kiesel on January 12, 2015, 10:43:56 PM
Hello Nick,

interesting construction - your Talus!

Do you have tried it also the other way around with fixed camera and moved object by your robot? I think this would also be good for camera calibration, moved target =>  known camera positions.

Karsten
Title: Re: Meet Talus... plus some questions
Post by: nickc on January 12, 2015, 11:24:21 PM
@ keisel - thanks! This is certainly a work in progress. It is still an option to move the product over the camera but the set up isn't just used as a photogrammetry platform so it needed to be flexible enough to photograph a large range of product. (lots of shapes and sizes)