Forum

Author Topic: Invalid argument value: projection  (Read 2670 times)

Ingsayyad

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Invalid argument value: projection
« on: January 23, 2020, 12:24:24 PM »
I am trying to generate multiple Orthomosiac by using script.
Staring point: I have refined Mesh.

Code: [Select]
                m1 = getMarker(chunk, "ms1")
m2 = getMarker(chunk," ms2")
m3 = getMarker(chunk, "ms3")


horizontal = m2.position - m1.position
vertical = m3.position - m1.position
normal = cross(vertical, horizontal)
vertical = cross(horizontal, normal)
horizontal = horizontal.normalized()

R = Metashape.Matrix ([horizontal, vertical, -normal])
proj = Metashape.Matrix().Rotation(R)
print("proj  =", proj )


#build orthomosaic
chunk.buildOrthomosaic(surface_type=Metashape.ModelData, blending = Metashape.MosaicBlending, fill_holes = True, projection = proj)


out:

proj  = Matrix([[-0.9827276862695309, -0.120715591313001, 0.14026418164765703, 0.0],
  [0.1424250150004323, -0.009418997985549706, 0.9897607779554991, 0.0],
      [-0.1181584095249299, 0.9926424474557295, 0.02644923000085686, 0.0],
        [0.0, 0.0, 0.0, 1.0]])

 ValueError: Invalid argument value: projection
2020-01-23 10:21:47 Error: Invalid argument value: projection

This script was working with photoscan but not with Metashape 1.6.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14839
    • View Profile
Re: Invalid argument value: projection
« Reply #1 on: January 25, 2020, 04:48:39 PM »
Hello Ingsayyad,

Please see the example of proper orthomosaic projection definition in Metashape 1.6 below:
Code: [Select]
projection = Metashape.OrthoProjection()
projection.type = Metashape.OrthoProjection.Type.Planar
projection.matrix = proj #the matrix that is calculated based on markers
chunk.buildOrthomosaic(surface_type=Metashape.ModelData, blending = Metashape.MosaicBlending, fill_holes = True, projection = projection)
Best regards,
Alexey Pasumansky,
Agisoft LLC