Forum

Author Topic: Deleting Cameras and Markers in a merged chunk  (Read 2514 times)

Morka

  • Newbie
  • *
  • Posts: 2
    • View Profile
Deleting Cameras and Markers in a merged chunk
« on: June 10, 2019, 01:42:51 PM »
Hello people,

Some people have asked this before https://www.agisoft.com/forum/index.php?topic=8587.0;prev_next=prev#new, but I am still interested how to deal with duplicated cameras and chunks in an automated manner.

I have created one chunk with approximately 700 cameras, aligned them and then split into chunks with 20% overlap.
After Dense Point Clouds were created in invidual chunks I merged them back and received a really nice result except that together with my dense point cloud I received an extra portion of cameras and markers.

As I understand I will not loose any tie points if I will delete duplicated cameras and/or markers as my cameras alignment was made in a single chunk, am I right?

I suggest that it is possible to use a script that would do the job, something similar to this:

import PhotoScan
chunk = PhotoScan.app.document.chunk #active chunk
photos_list = set()

for camera in chunk.cameras:
   if camera.enabled:
      if camera.photo.path in photos_list:
         camera.enabled = False
      else:
         photos_list.add(camera.photo.path)
print("Script finished.")

But together with enabling undesirable cameras it would also remove them.

As I am a Agisoft and Python newbie I would like to ask for a script that could do the job if someone is able to make one.

Thank you and have a nice day

Morka

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Deleting Cameras and Markers in a merged chunk
« Reply #1 on: June 10, 2019, 02:16:57 PM »
Forget to mention that Agisoft Photoscan pro 1.4.5 is being used here.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Deleting Cameras and Markers in a merged chunk
« Reply #2 on: June 20, 2019, 08:07:53 PM »
Hello Morka,

You can check the way how the splitting into chunks is performed in a similar script:
https://github.com/agisoft-llc/metashape-scripts/blob/master/src/split_in_chunks_dialog.py

If the merging operation is selected, the cameras from all but one chunks are removed and after that the merging operation is applied. Thus the single set of the cameras is used and the tie points cloud is not affected (since the complete set of aligned cameras is kept).
Removing the duplicates according to the file paths could affect the matching points, since the cameras from the different chunks have no common points, despite being the duplicates.

Same operation could be applied to the markers, but it would happen automatically, if you remove the cameras prior to the merging - the projections of the markers would be removed. In this case you can either remove the markers prior to merging to enable merge_markers option (in the latter case the markers with the identical labels from the different chunks would be merged to the single marker instance in the merged chunk).
Best regards,
Alexey Pasumansky,
Agisoft LLC