Forum

Author Topic: Create More than 1 chunk  (Read 1564 times)

guicanarin

  • Newbie
  • *
  • Posts: 32
    • View Profile
Create More than 1 chunk
« on: May 03, 2018, 04:30:06 PM »
Hello Guys, i'm using PhotoScan Pro version and i need to create more chunks.
But the problem is, i need to create a chunk with just two photos in each chunk.
for Example, i have 40 photos in the  path that i choose, and i need 20 chunks with 2 photos in each chunk.
I wrote some codes, but doesn't work.
this is my base code.
Thanks!

Code: [Select]
import os, PhotoScan
doc = PhotoScan.app.document
chunk = doc.addChunk()
chunk.label = "Nova Chunk"

path_photos = PhotoScan.app.getExistingDirectory("C:\\Users\lma\Documents\Fotos.jpg")
image_list = os.listdir(path_photos)
photo_list = list()
for photo in image_list:
    if photo.rsplit(".",1)[1].lower() in  ["jpg", "jpeg", "tif", "tiff"]:
        photo_list.append("/".join([path_photos, photo]))

chunk.addPhotos(photo_list)
chunk.detectMarkers(type=PhotoScan.CircularTarget12bit)
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy)
chunk.alignCameras(adaptive_fitting=True)
chunk.buildDepthMaps(quality=PhotoScan.UltraQuality, filter=PhotoScan.AggressiveFiltering)
chunk.buildDenseCloud(point_colors=True)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14855
    • View Profile
Re: Create More than 1 chunk
« Reply #1 on: May 03, 2018, 05:14:59 PM »
Hello guicanarin,

You can try something like the following to create new chunk for each pair of the images from your original list:

Code: [Select]
start = 0
while (start +1 < len(photo_list)):
    chunk = doc.addChunk()
    chunk.addPhotos(photo_list[start:start+1])
    start += 2
Best regards,
Alexey Pasumansky,
Agisoft LLC

guicanarin

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Create More than 1 chunk
« Reply #2 on: May 03, 2018, 06:02:29 PM »
Thank You a lot, Alexey!!
Best regards!