Forum

Author Topic: reset_alignment  (Read 1213 times)

LDBL

  • Newbie
  • *
  • Posts: 15
    • View Profile
reset_alignment
« on: December 22, 2018, 01:49:51 AM »
Hello collective,

I'm trying to emulate the "reset current alignment" option in the GUI.

Essentially, I have a 'base' model I need to rebuild multiple times with different setting via python, but to do so, I need to be able to reset the current alignment each time.

My code thus far is;

Code: [Select]
import PhotoScan
doc = PhotoScan.app.document
doc.open('XXX.psz')
chunk = doc.chunk
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, generic_preselection=True, reference_preselection=False, keypoint_limit=40000, tiepoint_limit=4000)
chunk.alignCameras(reset_alignment=True)
doc.save('XXX.psz')

But this fails. Selecting to reset alignment in the GUI works fine.

Any help please?

Thanks,

Leon

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 11957
    • View Profile
Re: reset_alignment
« Reply #1 on: December 23, 2018, 07:58:30 PM »
Hello Leon,

If reset_alignment parameter doesn't work, please try to use the following code:
Code: [Select]
for camera in chunk.cameras:
    camera.transform = None
But please specify, which version of PhotoScan you are using?
Best regards,
Alexey Pasumansky,
Agisoft LLC

LDBL

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: reset_alignment
« Reply #2 on: January 08, 2019, 12:29:42 PM »
Hi Alexey,

Thanks for your quick reply, and apologies for my slow response.

To confirm, I'm using 1.4.3.

Will try the amended script now.

Cheers,

Leon

LDBL

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: reset_alignment
« Reply #3 on: January 08, 2019, 12:37:13 PM »
OK, so I've amended the code and tried running it and I'm still not getting a rebuild in the same way as with the GUI.

Is there something else I'm missing?!

Code is;

Code: [Select]
import PhotoScan
doc = PhotoScan.app.document
doc.open('/mnt/w/Coverack_PP/C1/C1_base_MA_TPA.psz')
chunk = doc.chunk
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, generic_preselection=True, reference_preselection=False, keypoint_limit=40000, tiepoint_limit=4000)
for camera in chunk.cameras:
    camera.transform = None
doc.save('/mnt/w/Coverack_PP/C1/C1_40k_4k.psz')

Cheers,

Leon

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 11957
    • View Profile
Re: reset_alignment
« Reply #4 on: January 08, 2019, 07:56:01 PM »
Hello Leon,

Please try this:

Code: [Select]
import PhotoScan
doc = PhotoScan.app.document
doc.open('/mnt/w/Coverack_PP/C1/C1_base_MA_TPA.psz')
chunk = doc.chunk
chunk.point_cloud = None
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, generic_preselection=True, reference_preselection=False, keypoint_limit=40000, tiepoint_limit=4000)
for camera in chunk.cameras:
    camera.transform = None
chunk.alignCameras(adaptive_fitting = False)
doc.save('/mnt/w/Coverack_PP/C1/C1_40k_4k.psz')
Best regards,
Alexey Pasumansky,
Agisoft LLC

LDBL

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: reset_alignment
« Reply #5 on: January 08, 2019, 10:01:46 PM »
That's fixed it.

Legend, thank you!

Eckemon

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: reset_alignment
« Reply #6 on: October 16, 2020, 01:08:32 PM »
- fixed -
my fault :)
« Last Edit: October 16, 2020, 03:18:56 PM by Eckemon »