Forum

Author Topic: Exporting a JPG texture after a succesfull buildTexture seems failing  (Read 4516 times)

siufa

  • Newbie
  • *
  • Posts: 2
    • View Profile
Hi,

This is my very first entry. :)

I get  a RuntimeError: Model.exportTexture(): model has no texture

when I try to export after a successful buildTexture command.
It works fine from the menu, but the python saveTexture gives me error.


Please help.
thanks
James


Code: [Select]
import PhotoScan
doc = PhotoScan.app.document
doc.open('C:/Users/User/Desktop/ref/001/scene.psz')
model = PhotoScan.Model()
model.load('C:/Users/User/Desktop/ref/001/uvedGeo.obj','obj')

chunk = doc.activeChunk
chunk.model = model
chunk.buildTexture(mapping="current", blending="average",size=2048,count=1)

# executing the following line ends with error
model.saveTexture('C:/Users/User/Desktop/testing.jpg')

# RuntimeError: Model.exportTexture(): model has no texture

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Exporting a JPG texture after a succesfull buildTexture seems failing
« Reply #1 on: April 12, 2014, 09:35:21 AM »
Hello James,

I think that the problem is in fact that you are building texture for the chunk.model object, while model variable is unchanged.
So you need either to use chunk.model.saveTexture() or reassign model variable after building the texture as follows: model = chunk.model.

Also it might be a better idea to use chunk.importModel() function.
« Last Edit: April 12, 2014, 01:51:08 PM by Alexey Pasumansky »
Best regards,
Alexey Pasumansky,
Agisoft LLC

siufa

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Exporting a JPG texture after a succesfull buildTexture seems failing
« Reply #2 on: April 12, 2014, 05:17:18 PM »
Thats great help. Worked flawlessly.

:) thanks again.