Community Forum

Author Topic: Add photos to the chunk  (Read 4386 times)

NougierEva

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Add photos to the chunk
« Reply #45 on: December 02, 2017, 12:06:32 AM »
Hi,

Thanks for your answer.
When I import the file with the coordinate of my point, I would like to specify the coordinate system.
My chunk has a coordinate system specify by the user. My file contains points with a coordinate system, the same as the chunk.
I would like when the file is downloaded that the coordinate system of this input file is not the default coordinate system of PhotoScan (WGS84) but the same as the chunk specify by the user.

If I don't specify the coordinate system when I import my file, there are not at their right position and the model comport very high error because of this coordinate system problem.

In my current script, I already arrive to reoptimize the cameras but I don't arrive to precise the coordinate system for the input coordinate points.
This sentence doesn't work and makes error :
chunk.loadReference(path_csv, format = PhotoScan.ReferenceFormatCSV, columns = "nxyz", delimiter = ",", coordinate_system=crs)

I hope I'm more clear in what I want to obtain,

Really thanks for your useful help,
Eva

NougierEva

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Add photos to the chunk
« Reply #46 on: December 05, 2017, 10:50:18 PM »
Hi,

I try to resolve my problem of coordinate system of my GCP but it didn't find a solution.
It's the same problem, I have an error message specify that my sentence is wrong.
I would like to specify the coordinate system when  I import the file with the coordinate of my point.
The same thing when I ask the user to specify the coordinate system of the chunk.

My current script has not really improved because I'm stuck with this problem of coordinate.
So, my current expression is wrong but I can't find how to modify this :
chunk.loadReference(path_csv, format = PhotoScan.ReferenceFormatCSV, columns = "nxyz", delimiter = ",", coordinate_system=crs)

Thanks for your help,
I'm a lit bit lost !

Eva

magic

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: Add photos to the chunk
« Reply #47 on: December 18, 2017, 05:25:39 PM »
Hi Alexey
Iv got some small problem again , now I try to load the cameras to my chunk and the cameras are in main directory and I have sub-folders inside it is possible to get the cameras and load them to new cameras group for each sub-folder ??
Iv tried thats but dsnt work as i would to

doc = PhotoScan.app.document
chunk = doc.addChunk()
chunk.label = "New Chunk"

# Ajout de photos -add photos 1st chunk
path_photos = PhotoScan.app.getExistingDirectory("main folder:")
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)
print("- Photos ajoutées")

group = chunk.addCameraGroup()
for img in image_list:
    camera = chunk.cameras[0]
    group = chunk.addCameraGroup()
    camera.group = group
    group.type = PhotoScan.CameraGroup.Station

Any suggestion Alexey ??

magic

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: Add photos to the chunk
« Reply #48 on: December 19, 2017, 10:49:40 AM »
Hi Alexey
Iv got some small problem again , now I try to load the cameras to my chunk and the cameras are in main directory and I have sub-folders inside it is possible to get the cameras and load them to new cameras group for each sub-folder ??
Iv tried thats but dsnt work as i would to

Code: [Select]
doc = PhotoScan.app.document
chunk = doc.addChunk()
new_group = chunk.addCameraGroup()

# Ajout de photos -add photos 1st chunk
path_photos = PhotoScan.app.getExistingDirectory("main folder:")
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)
print("- Photos ajoutées")

for camera in list(chunk.cameras):
camera.group = new_group
Its better but still dsnt work
Any suggestion Alexey ??
« Last Edit: December 19, 2017, 12:16:13 PM by magic »

magic

  • Newbie
  • *
  • Posts: 40
    • View Profile
Re: Add photos to the chunk
« Reply #49 on: December 19, 2017, 02:06:34 PM »
Anybody here ??

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 8558
    • View Profile
Re: Add photos to the chunk
« Reply #50 on: December 20, 2017, 05:45:47 PM »
Hello magic,

Please try this code to load the images from the sub-directories of the user-defined master folder to separate camera groups in the same chunk:
Code: [Select]
import PhotoScan, os

doc = PhotoScan.app.document
chunk = doc.addChunk()

path_master = PhotoScan.app.getExistingDirectory("Main folder:")
sub_folders = os.listdir(path_master)
for folder in sub_folders:
folder = os.path.join(path_master, folder)
if not os.path.isdir(folder):
continue

image_list = os.listdir(folder)
photo_list = list()
new_group = chunk.addCameraGroup()
new_group.label = os.path.basename(folder)
for photo in image_list:
if photo.rsplit(".",1)[1].lower() in  ["jpg", "jpeg", "tif", "tiff"]:
photo_list.append(os.path.join(folder, photo))
chunk.addPhotos(photo_list)
for camera in chunk.cameras:
if not camera.group:
camera.group = new_group
Best regards,
Alexey Pasumansky,
AgiSoft LLC