Forum

Author Topic: Exporting the extent of each camera's coverage of the Orthophoto  (Read 8393 times)

CamMakoJ

  • Newbie
  • *
  • Posts: 15
    • View Profile
Just wondering if anyone has worked on or made a script that would export the extent of each cameras coverage on the orthophoto.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14012
    • View Profile
Re: Exporting the extent of each camera's coverage of the Orthophoto
« Reply #1 on: March 09, 2017, 10:38:57 AM »
Hello CamMakoJ,

Do you mean something like footprints for each camera or the seamlines of the orthomosaic?
Best regards,
Alexey Pasumansky,
Agisoft LLC

CamMakoJ

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Exporting the extent of each camera's coverage of the Orthophoto
« Reply #2 on: March 30, 2017, 07:23:07 PM »
Yes exactly, the 'footprint' of each photo would be awesome

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14012
    • View Profile
Re: Exporting the extent of each camera's coverage of the Orthophoto
« Reply #3 on: March 31, 2017, 04:05:37 PM »
Hello CamMakoJ,

With the version 1.3.1 release I'll publish the script that will be creating footprint shape layer. We've extended API to make the script in more convenient way.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Seboon

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Exporting the extent of each camera's coverage of the Orthophoto
« Reply #4 on: April 06, 2017, 05:51:01 PM »
Hello Alexey,

Could you please tell us when you'll provide this script?

Thanks and regards!
S.Poudroux
Archaeologist - Topographer - Drone remote pilot

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14012
    • View Profile
Re: Exporting the extent of each camera's coverage of the Orthophoto
« Reply #5 on: April 06, 2017, 06:11:39 PM »
Hello Seboon,

The following script should be creating the shape layer with the footprints related to the aligned cameras.

Each footprint would have four vertices.

Code: [Select]
#compatibility PhotoScan Pro 1.3.1
#creates footprint shape layer in the active chunk

import PhotoScan

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

if not chunk.shapes:
chunk.shapes = PhotoScan.Shapes()
chunk.shapes.crs = chunk.crs
T = chunk.transform.matrix
footprints = chunk.shapes.addGroup()
footprints.label = "Footprints"
footprints.color = (30, 239, 30)

if chunk.dense_cloud:
surface = chunk.dense_cloud
elif chunk.model:
surface = chunk.model
else:
surface = chunk.point_cloud

for camera in chunk.cameras:
if not camera.transform:
continue #skipping NA cameras

sensor = camera.sensor
corners = list()
for i in [[0, 0], [sensor.width - 1, 0], [sensor.width - 1, sensor.height - 1], [0, sensor.height - 1]]:
corners.append(surface.pickPoint(camera.center, camera.transform.mulp(sensor.calibration.unproject(PhotoScan.Vector(i)))))
if not corners[-1]:
corners[-1] = chunk.point_cloud.pickPoint(camera.center, camera.transform.mulp(sensor.calibration.unproject(PhotoScan.Vector(i))))
if not corners[-1]:
break
corners[-1] = chunk.crs.project(T.mulp(corners[-1]))

if not all(corners):
print("Skipping camera " + camera.label)
continue

if len(corners) == 4:
shape = chunk.shapes.addShape()
shape.label = camera.label
shape.attributes["Photo"] = camera.label
shape.type = PhotoScan.Shape.Type.Polygon
shape.group = footprints
shape.vertices = corners
shape.has_z = True

PhotoScan.app.update()
print("Script finished")
Best regards,
Alexey Pasumansky,
Agisoft LLC

Seboon

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Exporting the extent of each camera's coverage of the Orthophoto
« Reply #6 on: April 06, 2017, 06:17:04 PM »
Alexey,

Your reactivity is impressive, as always!

Thanks a lot!
S.Poudroux
Archaeologist - Topographer - Drone remote pilot

william

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: Exporting the extent of each camera's coverage of the Orthophoto
« Reply #7 on: April 08, 2017, 01:32:20 AM »
Thank you. I also happen to be very interested in this functionality, and I am very pleased to see the above script!

tkwasnitschka

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: Exporting the extent of each camera's coverage of the Orthophoto
« Reply #8 on: May 03, 2017, 01:20:36 PM »
While it may not be as straightforward as this example, a real help would be the incorporation of masks. It is pretty hard to adjusts masks procedurally without feedback on the resulting coverage.

In other words, I would like to have a preview wether my masks leave holes in the model or the texture, or not.

animesh_PRSD

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Exporting the extent of each camera's coverage of the Orthophoto
« Reply #9 on: June 01, 2017, 05:46:34 PM »
Hello Alexey,

I tried a backdoor modification for Ver. 1.2.6. The console to problem is attached. can you help me identify the problem and mail me same on animesh.ce07@gmail.com

Thanks

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14012
    • View Profile
Re: Exporting the extent of each camera's coverage of the Orthophoto
« Reply #10 on: June 01, 2017, 05:53:31 PM »
Hello animesh_PRSD,

The script cannot be ported to the version 1.2.6 due to the lack of the required functions in the old Python API.

The error in the Console, however, states that proper indentation is not used inside "if" clause.
Best regards,
Alexey Pasumansky,
Agisoft LLC