Forum

Author Topic: Is Chunk Aligned?  (Read 3039 times)

DrewFulton

  • Newbie
  • *
  • Posts: 9
    • View Profile
Is Chunk Aligned?
« on: July 12, 2017, 04:20:53 PM »
I am writing a batch script in Python to process a whole bunch of big projects while I am traveling over the next few weeks and don't need my computer.  I am new to the PhotoScan API so thought I'd ask here.  Is there a way to determine if matchPhotos and/or alignCameras has previously been run on the active chunk?  I don't want to have to rerun them if I have already done them previously.  I can check to see if things like a model exist to prevent rerunning those files but not sure about the align cameras functions.

Thanks!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14851
    • View Profile
Re: Is Chunk Aligned?
« Reply #1 on: July 12, 2017, 05:13:28 PM »
Hello DrewFulton,

You can check if there is at least one aligned camera in the chunk (providing that you are not using Import Cameras function).

Checking if camera is aligned can be done in the following way:
Code: [Select]
flag = False
for camera in chunk.cameras:
      if camera.transform:
            print("Found first aligned camera")
            flag = True
            break
if not flag:
      print("no aligned cameras found")
Best regards,
Alexey Pasumansky,
Agisoft LLC

DrewFulton

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Is Chunk Aligned?
« Reply #2 on: July 12, 2017, 05:27:07 PM »
Thanks Alexey!

I was trying something similar and looking for a camera that had a center location value.  I like yours better.

Drew

DrewFulton

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Is Chunk Aligned?
« Reply #3 on: July 12, 2017, 06:55:54 PM »
Any ideas on how to check if buildUV or buildTexture has been run?  Those are the last two steps I need to verify if possible.

Thanks!
Drew

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14851
    • View Profile
Re: Is Chunk Aligned?
« Reply #4 on: July 12, 2017, 07:15:13 PM »
Hello Drew,

I think you can check if chunk.model.tex_vertices and chunk.model.texture() are not None.
Best regards,
Alexey Pasumansky,
Agisoft LLC

DrewFulton

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Is Chunk Aligned?
« Reply #5 on: July 12, 2017, 07:18:55 PM »
Thanks!  I'll give it a try.