Forum

Author Topic: Exporting the extent of each camera's coverage of the Orthophoto  (Read 9506 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: 14813
    • 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: 14813
    • 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: 72
    • 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: 14813
    • 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: 72
    • 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: 66
    • 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: 14813
    • 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

jkova96

  • Full Member
  • ***
  • Posts: 146
    • View Profile
Re: Exporting the extent of each camera's coverage of the Orthophoto
« Reply #11 on: February 29, 2024, 10:24:03 AM »
Hi Alexey,

My company just buy software Agisoft Metashape, version 2.1 (newer version).
I have similar request, let's say that's similar.
So, state geodetic department of Croatia ask us to send them coordinates of 4 corners of each image footprint - to be visible in images EXIF. They also specified image format in which photos should be exported - .tif format.

Is there a way how to perform that if possible, it not can I somehow
get .txt file where 4 corners of image footprint are stored.

Thank you forwards!

Bye :)

J.K.


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Exporting the extent of each camera's coverage of the Orthophoto
« Reply #12 on: February 29, 2024, 05:50:29 PM »
Hello jkova96,

Do you have an example of the text file that you would like to save?  Or it is just camera name and additional eight columns (XY coordinates for 4 corners of image footprint)?

As for the EXIF - what tags should be used to include additional meta data to the images?
Best regards,
Alexey Pasumansky,
Agisoft LLC