Forum

Author Topic: exporting orthophotos [solved]  (Read 5156 times)

July

  • Newbie
  • *
  • Posts: 2
    • View Profile
exporting orthophotos [solved]
« on: March 01, 2015, 01:27:02 PM »
Hi,

I would like to extract scaled orthophotos of the 6 faces of an object.
I used the script proposed in this topic: http://www.agisoft.com/forum/index.php?topic=1322.msg15755#msg15755

old code:
import PhotoScan

doc = PhotoScan.app.document
chunk = doc.activeChunk

bloc = "bloc_name"

type ="jpg"

path_file = "D:/Bureau/......./" + bloc + "/Elevation/"

views = ["Top","Bottom","Front","Back","Right","Left"]

matrices = [[[1, 0, 0, 0],[0, 1, 0, 0],[0, 0, 1, 0],[0, 0, 0, 1]],
                  [[1, 0, 0, 0],[-0, -1, -0, 0],[0, 0, -1, 0],[0, 0, 0, 1]],
                  [[1, 0, 0, 0],[0, 0, 1, 0],[0, -1, 0, 0],[0, 0, 0, 1]],
                  [[-1, -0, -0, 0],[0, 0, 1, 0],[0, 1, 0, 0],[0, 0, 0, 1]],
                  [[-0, -1, -0, 0],[0, 0, 1, 0],[-1, 0, 0, 0],[0, 0, 0, 1]],
                  [[0, 1, 0, 0],[0, 0, 1, 0],[1, 0, 0, 0],[0, 0, 0, 1]]]

d_x = d_y = 0.00103106

for i in range(len(views)):
   chunk.exportOrthophoto((path_file + views + ".jpg"), type, "mosaic", projection = PhotoScan.Matrix(matrices), dx = d_x, dy = d_y)






But since update 1.1.0, this script doesn't work anymore ... I tried to experiment with the new api but when I launch my command, PhotoScan does not recognize the blending mode.

Can someone help me?



new code (not working for now):
import PhotoScan

chunk = PhotoScan.app.document.chunk

bloc = "bloc_name"

type ="jpg"

path_file = "D:/Bureau/........../" + bloc + "/Elevation/"

views = ["Top","Bottom","Front","Back","Right","Left"]

matrices = [[[1, 0, 0, 0],[0, 1, 0, 0],[0, 0, 1, 0],[0, 0, 0, 1]],
                  [[1, 0, 0, 0],[-0, -1, -0, 0],[0, 0, -1, 0],[0, 0, 0, 1]],
                  [[1, 0, 0, 0],[0, 0, 1, 0],[0, -1, 0, 0],[0, 0, 0, 1]],
                  [[-1, -0, -0, 0],[0, 0, 1, 0],[0, 1, 0, 0],[0, 0, 0, 1]],
                  [[-0, -1, -0, 0],[0, 0, 1, 0],[-1, 0, 0, 0],[0, 0, 0, 1]],
                  [[0, 1, 0, 0],[0, 0, 1, 0],[1, 0, 0, 0],[0, 0, 0, 1]]]

d_x = d_y = 0.00103106

for i in range(len(views)):
   chunk.exportOrthophoto((path_file + views + ".jpg"), type, blending = MosaicBlending, projection = PhotoScan.Matrix(matrices), dx = d_x, dy = d_y)


thanks a lot
« Last Edit: March 01, 2015, 07:04:28 PM by July »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: exporting orthophotos
« Reply #1 on: March 01, 2015, 04:26:33 PM »
Hello July,

It would be PhotoScan.BlendingMode.MosaicBlending or just PhotoScan.MosaicBlending.

But I'm not sure that using projection as a list of matrices would work. Probably, you've ment  "projection = PhotoScan.Matrix(matrices)"?
Best regards,
Alexey Pasumansky,
Agisoft LLC

July

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: exporting orthophotos
« Reply #2 on: March 01, 2015, 07:03:23 PM »
Thanks a lot Alexey  :D
 I used "blending = PhotoScan.BlendingMode.MosaicBlending" and it works.

ThomasVD

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: exporting orthophotos [solved]
« Reply #3 on: October 21, 2015, 02:34:15 PM »
Hi Alexey,

Being a noob at Python scripting I'm wondering how I can use this script to export 6 faces of an object as 1:1 or 1:10 scaled orthophotos. The object in question is scaled using known measurements and aligned to bounding box.

I'm assuming I can't just save the script described below, open the PhotoScan file in question and run the script?

Any help is as always much appreciated!

Tom

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: exporting orthophotos [solved]
« Reply #4 on: October 21, 2015, 02:45:40 PM »
Hello Tom,

I think it should work, just after some adjustments:

Code: [Select]
for i in range(len(views)):
   chunk.exportOrthophoto(path = path_file + "\\" + views[i] + ".tif", type = "tif", PhotoScan.BlendingMode.MosaicBlending, projection = PhotoScan.Matrix(matrices[i]), dx = d_x, dy = d_y)
   chunk.exportOrthophoto(path = path_file + "\\" + views[i] + ".tif", type = "tif", PhotoScan.BlendingMode.MosaicBlending, projection = PhotoScan.Matrix(matrices[i]), dx = d_x * 10, dy = d_y * 10)
Best regards,
Alexey Pasumansky,
Agisoft LLC

ThomasVD

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: exporting orthophotos [solved]
« Reply #5 on: October 21, 2015, 03:10:19 PM »
Thanks Alexey, super-fast reaction as always haha.

So should I append one of your lines to July's script as follows?
Code: [Select]
import PhotoScan

chunk = PhotoScan.app.document.chunk

bloc = "bloc_name"

type ="jpg"

path_file = "F:/Ubi3D projects/........../" + bloc + "/Ortho exports/"

views = ["Top","Bottom","Front","Back","Right","Left"]

matrices = [[[1, 0, 0, 0],[0, 1, 0, 0],[0, 0, 1, 0],[0, 0, 0, 1]],
                  [[1, 0, 0, 0],[-0, -1, -0, 0],[0, 0, -1, 0],[0, 0, 0, 1]],
                  [[1, 0, 0, 0],[0, 0, 1, 0],[0, -1, 0, 0],[0, 0, 0, 1]],
                  [[-1, -0, -0, 0],[0, 0, 1, 0],[0, 1, 0, 0],[0, 0, 0, 1]],
                  [[-0, -1, -0, 0],[0, 0, 1, 0],[-1, 0, 0, 0],[0, 0, 0, 1]],
                  [[0, 1, 0, 0],[0, 0, 1, 0],[1, 0, 0, 0],[0, 0, 0, 1]]]

d_x = d_y = 0.00103106

for i in range(len(views)):
   chunk.exportOrthophoto(path = path_file + "\\" + views[i] + ".jpg", type = "jpg", PhotoScan.BlendingMode.MosaicBlending, projection = PhotoScan.Matrix(matrices[i]), dx = d_x, dy = d_y)

Resulting message is "SyntaxError: non-keyword arg after keyword arg" - I'm sure I'm doing something stupid wrong :)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: exporting orthophotos [solved]
« Reply #6 on: October 21, 2015, 03:17:26 PM »
Hello Tom,

When blending is specified in the exportOrthophoto() function you should put "blending = ".
Best regards,
Alexey Pasumansky,
Agisoft LLC