Forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Pablosg8

Pages: [1]
1
Python and Java API / Re: Export textures from independent cameras
« on: October 14, 2017, 12:47:01 AM »
I have tested and finally it was all my mistake in naming the folder. The script could not find the folder to save the photos.

I confirm that it works well with version 1.4.0.

Sorry for the confusion and thanks for your quick response.

2
Python and Java API / Re: Export textures from independent cameras
« on: October 12, 2017, 01:59:44 AM »
Hi Alexey,

I have tried the new version 1.4 and I have verified that the script does not work and gives me error. What has changed in the new version so that it does not work ?.

It can be fixed?

Thank you very much for your help.

3
Python and Java API / Re: Export textures from independent cameras
« on: January 31, 2017, 03:42:15 PM »
Thank you very much, it works perfectly.
If I can do something for you let me know.

I write the code below in case I could be helpful for someone:

Code: [Select]
import PhotoScan, os

print("Script started")

chunk = PhotoScan.app.document.chunk

for camera in chunk.cameras:
camera.enabled = False

for camera in chunk.cameras:
camera.enabled = True
chunk.buildTexture(blending=PhotoScan.DisabledBlending, size=4096)
image = chunk.model.texture()
image.save('C:/Users/' + camera.label[:-4] + '_texture.tif')
camera.enabled = False

print("OK.")

4
Python and Java API / Re: Export textures from independent cameras
« on: January 31, 2017, 01:42:11 PM »
Thanks for answering.

I have been solving my problem with your code. But, I have stopped in this code:


Code: [Select]
import PhotoScan, os

print("Script started")

for camera in chunk.cameras:
camera.enabled = False

for camera in chunk.cameras:
camera.enabled = True
chunk.buildTexture(blending=PhotoScan.DisabledBlending, size=4096)
image = chunk.model.texture()
image.save('C:/Users/Photo.tif')

print("OK.")


I started a file with a 3D mesh, a UV map and a series of cameras ready to be projected. But, I don’t have advanced programming skills and I have two problems, that I don’t know how to solve.

1.  At the begining, the cameras was deselectioned and later they was activating. But they don’t do it one by one. I never have only one camera activated, because the cameras was joining. Thus, I can’t save it one by one.

2.  The saved textures are overwritten because I do not know a way to save it with the same name for each projected camera. Is this possible? To named each texture as the name of its camera.

Thank you very much, I think that soon it will work.

5
Python and Java API / Re: Export textures from independent cameras
« on: January 31, 2017, 01:41:35 AM »
Thanks for your reply Alexey.

My project already has mapUV in the 3D mesh. I am able to export a TIF texture per camera manually. The problem is that in some projects I have more than 200 cameras and I have to do the work by hand. I have to select a camera, create the texture and export it (so hundreds of times).

My question is if it is possible for a script to solve that problem ...

6
Python and Java API / Export textures from independent cameras
« on: January 30, 2017, 10:48:16 PM »
Hello, I have a "Photoscan" file with a 3D mesh and a series of cameras prepared to be projected onto the mesh. I need to export each texture generated by each camera to a separate "TIF" file. Is this possible?. I have only been able to automatically export the union of all textures.

Would appreciate any help ...


Code: [Select]
import PhotoScan, os

path = PhotoScan.app.getExistingDirectory("Please choose the folder with .psz files:")

print("Script started")
doc = PhotoScan.app.document
doc.clear()
project_list = os.listdir(path)

for project_name in project_list:
if ".PSZ" in project_name.upper():
doc.open(path + "/" + project_name)
chunk = doc.chunks[0]

chunk.buildTexture(blending=PhotoScan.DisabledBlending, size=4096)

print("Processed project: " + project_name)

chunk.exportModel(path + "/" + project_name[:-3] + "obj", texture_format = 'tif', texture = True, format = "obj")


print("Script finished.")


Pages: [1]