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

Pages: [1]
1
Python and Java API / Marker Coordinate System Transformation
« on: August 14, 2019, 08:41:28 PM »
Hello all,
I am trying to understand the behavior of adding markers using the Python API. When I add a marker using a 3-component vector of x (longitude), y (latitude) and z (altitude in meters), the marker does not end up where I expect. For example:

Code: [Select]
>>> new_vector = Metashape.Vector([-122.271735905, 45.805843149900014, 420.87088799965164])
>>> current_chunk.addMarker(new_vector)
2019-08-14 10:31:43 <Marker 'point 1'>
>>> current_chunk.markers[0].reference.location
2019-08-14 10:31:59 Vector([-122.28440570982855, 45.79698588468747, 2408.9266198698947])

What causes the coordinates to change after adding a marker? Am I confusing two different coordinate systems? And most importantly, what is the correct way to add a marker with geographic coordinates?

2
Python and Java API / Marker.Projection coords
« on: December 20, 2018, 11:18:26 PM »
Hi there,
I'm trying to understand how to interact with markers through the python API. My first question is about the Marker.Projection class, and the "coord" variable.
Does it define pixel XY coordinates for a marker in a specific image? And if so, how do I choose what frame I'm viewing coordinates for?
Eventually, I'd like to assign marker positions using XY coordinates in a few images (e.g., Marker_1.add_reference(DJI_0001.jpg, X=1999, Y=2004) or something like that). Feel free to point me to an existing thread if one already exists.

Thanks very much.

3
Python and Java API / Re: Behavior of Document.save()
« on: April 04, 2018, 11:17:16 PM »
Aha! I understand now. Thanks Alexey, that's just what I needed.

4
Python and Java API / Re: Behavior of Document.save()
« on: April 04, 2018, 07:39:02 PM »
Hi Alexey,
Thanks for the quick response.
If I convert the doc.save(path=...) function to one without arguments, I get this error:

2018-04-04 09:31:47 Traceback (most recent call last):
2018-04-04 09:31:47   File "//dnrfsoly110/uas_data/scripts/mmic490/FullyAutomated/PhotoScan_InitializeProject.py", line 52, in <module>
2018-04-04 09:31:47     current_doc.save()
2018-04-04 09:31:47 RuntimeError: Can't replace file or directory: Access is denied (5): C:/Program Files/Agisoft/PhotoScan Pro
2018-04-04 09:31:47 Error: Can't replace file or directory: Access is denied (5): C:/Program Files/Agisoft/PhotoScan Pro

I'm not sure I've understood correctly how I should be reassigning variables after using doc.save(path). Here's my code to the point of the above error:
Code: [Select]
    current_doc = PhotoScan.Document()
    current_chunk = current_doc.chunk
    if current_chunk == None:
        print("Adding chunk")
        current_chunk = current_doc.addChunk()
    current_doc.save(path=project_doc, chunks=[current_chunk])
    current_chunk = current_doc.chunk

    #Add photos
    photo_list = []
    for photo in os.listdir(input_folder):
        photo_list.append(os.path.join(input_folder, photo))
    print("Adding {} photos".format(len(photo_list)))
    current_chunk.addPhotos(photo_list)
##    current_doc.save(path=project_doc, chunks=[current_chunk])
    current_doc.save()

5
Python and Java API / Behavior of Document.save()
« on: April 04, 2018, 06:32:21 PM »
Hi there,
I have a question about the correct use of the Document.save() function in 1.4.x. In a script, I’m creating a new PhotoScan.Document() instance, and saving it to a path:
Code: [Select]
current_doc = PhotoScan.Document()
    current_chunk = current_doc.chunk
    if current_chunk == None:
        current_chunk = current_doc.addChunk()
    current_doc.save(path=project_doc, chunks=[current_chunk])

The script aligns the images (and saves, using the same command), and then tries to build a DEM, but I keep getting an “Empty Frame Path: Please save in .PSX format” error. I’ve tried just using current_doc.save(), using PhotoScan.app.document as current_doc, and pretty much every permutation of .save() I can think of, without success.

I’ve noticed that, if I’m just opening a previously created document, using .save() works the way I would expect, but when I’ve created a new document and saved it using (path=…), it doesn’t.

How can I create a new document and save it in a way that .buildDem() can recognize?

Thanks! And apologies if this is a novice question.

Pages: [1]