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 - stijntje44@hotmail.com

Pages: [1]
1
Python and Java API / Timed interrupt of a loop.
« on: August 26, 2019, 03:04:31 PM »
Hi,
I made an automated script for agisoft Metashape 1.5.0

This script potentially loops indefinitely and I thought it would be nice to give the user the potential to exit the loop after each loop.

The idea was to Metashape.getBool in order to give the user a chance to input a boolean.

IF the user were to not input anything for say, 10 seconds, it would default to False and continue the loop.

However, you cannot do anything while the script is sleeping, and asking for a boolean also halts the process, so I cannot get any temporary pop-up going.

I've tried with multi-threading but it either doesn't work with Agisoft or I am doing something wrong.

I am using windows 10, python 3.6 (I believe).


Thanks for any help,
Stijn Klessens

2
General / Texture projection issues.
« on: May 28, 2019, 02:22:47 PM »
I am trying to build a texture using a retopologized model, however, doing so causes weird artefacts, things are improperly placed, half the face is blurry, etc.

However, it projects correctly on the original model, does anyone know what the issue could be?

I don't think it could be inaccuracy in the model, since that was wrapped automatically and shouldn't have discrepancies of this size. I am using "keep uv" and "mozaic" and have tried other options, same issue.

3
Python and Java API / Re: How do I center my scene on 0,0,0?
« on: May 16, 2019, 12:21:50 PM »
Hi Alexy, thank you for your help.

I eventually managed to shift the position of my scene by subtracting the average location of my markers from the transform matrix.

I also eventually managed to properly orient my scene by calculating the appropriate 3x3 matrix and plugging that into the transform matrix.

However, when I do both, the position is once again wrong and I have no idea why. I've tried doing is sequentially, I've tried getting the old position vector and transforming the coordinates to my new coordinate matrix but not a single combination I can come up with seems to work.

how do you simultaneously adjust the rotation and the translation, and which coordinates are required for the translation? (the coordinates of the 0.0.0 position prior to rotating, the coordinates of the 0.0.0 position AFTER the rotation, or something else?)

Note: if I ONLY input the iM rotation values, the scene is properly oriented. If I ONLY input the locAvg values, the scene is properly positioned. I've tried with locAvg, and with locAvg2 (and also with a locAvg calculated from the regular, non-inversed version of my rotation matrix).


    #Transform locAvg to new matrix coordinates:
    locAvg2 = Metashape.Vector((0, 0, 0))

    locAvg2[0] = locAvg[0] * iM[0, 0] + locAvg[1] * iM[0, 1] + locAvg[2] * iM[0,2]
    locAvg2[1] = locAvg[0] * iM[1, 0] + locAvg[1] * iM[1, 1] + locAvg[2] * iM[1, 2]
    locAvg2[2] = locAvg[0] * iM[2, 0] + locAvg[1] * iM[2, 1] + locAvg[2] * iM[2, 2]

    #Determine adjustment matrix
    chunkAdjust = Metashape.Matrix([[iM[0,0], iM[0,1], iM[0,2], - locAvg[0]],
                                                              [iM[1,0], iM[1,1], iM[1,2], - locAvg[1]],
                                                              [iM[2,0], iM[2,1], iM[2,2], - locAvg[2]],
                                                              [0.0, 0.0, 0.0, 1.0]])

    chunk.transform.matrix = chunkAdjust

    #Other ways to apply new matrix
    #chunk.transform.matrix = Metashape.Matrix().Translation(locAvg) * chunkAdjust
    #chunk.transform.matrix = Metashape.Matrix().Translation(locAvg) * Metashape.Matrix().Rotation(chunkAdjust.rotation())

    chunk.updateTransform()




4
Python and Java API / Re: How do I center my scene on 0,0,0?
« on: April 24, 2019, 09:28:56 AM »
Hello stijntje44,

Do you mean that you wish to translate the origin of the coordinate system to the selected marker, keeping the scale and orientation of the original model?

Indeed, I probably want to change orientation and scale as well, but I figured I'd start with the position, and once I had that figured out, the rest could probably be derived from there, I did some research into how to translate coordinates from one coordinate system to another via matrix calculation but I have no Idea how to actually implement it in agisoft.

I don't know if there is a function that can be used to simple remap the entire coordinate system, or if I have to change the positions and rotations of each camera within the current coordinate system.
Either way, I don't know which function to use.

Any help would be greatly appreciated.

(ps, I want to use the average of two markers as 0,0,0, I have the coordinates, I just don't know how to implement them).

Update: So far I've been able to adjust the location of all cameras individually but doing so makes the entire scene unusable it seems (markers are lost, dense cloud generation results in zero resolution align cameras resets them back to the original position)

5
Python and Java API / Re: How to get Marker coordinates
« on: April 24, 2019, 09:23:50 AM »
Hi

I didn't realize this comment was actually posted, as you can perhaps tell, it was cut off halfway through because I actually managed to fix the issue while writing the post.

Thanks a lot for the help though.

For anyone trying to do the same thing:

   for m in chunk.markers:
      locAll = m.position
      print("The location of ", m, "is", locAll)

In the end, this worked, before this, I tried with several combinations of " chunk.reference.position" and other variations on that, which always gave me a [0, 0, 0]  result, or none.

6
Python and Java API / How do I center my scene on 0,0,0?
« on: April 23, 2019, 05:19:23 PM »
No matter what I do I can't seem to figure this out.


I want to center my scene at 0,0,0 based on location of Markers. I have the marker location, but I can't figure out how to change the scene, I can change the region, but that's about it.


Is there a function that can be used to adjust the rotation and transform of the entire scene, or do I have to apply a matrix multiplication to all individual cameras in the scene?

Any help would be greatly appreciated.

7
Python and Java API / How to get Marker coordinates
« on: April 23, 2019, 03:44:21 PM »
I've been trying to get the coordinates of markers through python.
After detecting the markers I have the following code

for c in chunk.markers:

Pages: [1]