Forum

Author Topic: Ortho projection to exact plane  (Read 12348 times)

Daddazio

  • Newbie
  • *
  • Posts: 4
    • View Profile
Ortho projection to exact plane
« on: January 09, 2015, 01:58:32 AM »
Hello,
first of all congratulations for the great software!
I have the situation described in attached screenshot.
I've already written a script to export single photo in ortho mode:

Code: [Select]
import PhotoScan
import os
import sys
app = PhotoScan.Application()
doc = PhotoScan.app.document
chunk = PhotoScan.app.document.chunk
folder = PhotoScan.app.getExistingDirectory("Select folder where to export ortho photos")
folder = os.path.normpath(folder) + os.sep
app.messageBox("Photo number: " + str(len(chunk.cameras)))

for camera in chunk.cameras:
X = camera.key
camera.enabled = True
path = folder + str(X) + ".tif"
chunk.exportOrthophoto(path, format="tif", blending=PhotoScan.MosaicBlending, color_correction=False, write_kml=False, write_world=False)
camera.enabled = False

app.messageBox("All photos exported")

The question is: how to orient exactly the plane (and cameras) with the XY plane, or is it possible to directly project photo orthogonal to my imported plane in python?

Thank you for help,
Matteo.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15354
    • View Profile
Re: Ortho projection to exact plane
« Reply #1 on: January 11, 2015, 03:10:20 PM »
Hello Matteo,

You can use custom projection plane for orthophoto export. To do that you need specify "projection" argument for the .exportOrthophoto() function and specify valid 3x3 normalized matrix.

Matrices for the predefined views are given in the following thread:
http://www.agisoft.com/forum/index.php?topic=1322.msg15758#msg15758
But if you have any special case, let me know if you require some assistance for custom matrix creation.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Daddazio

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Ortho projection to exact plane
« Reply #2 on: January 12, 2015, 12:54:06 AM »
Hello Alexey,
thank you for the reply.
I already have the plane where to project photos.
But, how to build a matrix picking 3 point from that plane?
Also, in general, how the matrix works? Is there a docs where is explained? :)

Thank you again.
Matteo

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15354
    • View Profile
Re: Ortho projection to exact plane
« Reply #3 on: January 12, 2015, 01:23:43 AM »
Hello Matteo,

Each row of matrix is vector defining coordinate system axis orientation: horizontal, vertical and depth (normal to both of them). All vectors should be, of course, normal to each other and normalized (to avoid additional scaling).
Best regards,
Alexey Pasumansky,
Agisoft LLC

Daddazio

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Ortho projection to exact plane
« Reply #4 on: January 14, 2015, 12:55:19 PM »
Thank you! :)
The last question about the matrix: why the matrix has 4 vectors of four coordinates?

Matteo.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15354
    • View Profile
Re: Ortho projection to exact plane
« Reply #5 on: January 14, 2015, 12:58:37 PM »
Hello Matteo,

They are extended to 4x4 matrix, just zeros as fourth element in the first three rows and the last row is [0, 0, 0, 1].
Best regards,
Alexey Pasumansky,
Agisoft LLC

Daddazio

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Ortho projection to exact plane
« Reply #6 on: January 17, 2015, 01:32:30 PM »
Thank you! :)

giancan

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Ortho projection to exact plane
« Reply #7 on: September 30, 2015, 02:21:49 PM »
Hi Alexey,
for some reason, when I use this script from certain angles it seems that I have a section of the building more then a view from "outside".
Is it something to do with the depth of field (close and far field)?
I tried also to expand the bounding box in case it was too tight, but nothing changed.

Thanks a lot,
G.

lorso

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Ortho projection to exact plane
« Reply #8 on: October 06, 2015, 05:03:32 PM »
Dear, Alexey Pasumansky
Can you write the script for the ortho projection on a plane right?
Maybe by example?
Thanks a lot.

Lorenzo