Forum

Author Topic: BuildTexture Fails on Update [solved]  (Read 3395 times)

nickc

  • Newbie
  • *
  • Posts: 25
    • View Profile
BuildTexture Fails on Update [solved]
« on: February 10, 2015, 12:54:39 AM »
I am getting positive feedback telling me that the texture is being built but the viewport does not reflect the status.  Only started to occur after I updated to 1.1.2, unless i missed something?


Here is my code;

Code: [Select]
import PhotoScan
import os
import sys

from PySide.QtGui import QPixmap, QApplication
import time

import getpass
import subprocess


# Get User
username = getpass.getuser()

def Custom():

# Define: Home Directory
path = os.getcwd()
print ("Home Directory: ", path)

ImageDirectory = path+"\\raw\\tiff\\"
os.chdir(ImageDirectory)
print ("Image Directory: ", ImageDirectory)

print("Running")
print ("Script Location: C:\Program Files\Agisoft\PhotoScan Pro\scripts")

# Set Application Objects
doc = PhotoScan.app.document
print ("Processing Images...")

# Define Chunk
chunk = PhotoScan.app.document.addChunk()
chunk.label = "MainChunk"

# Find Images
ImageFiles = []
for photo in os.listdir (ImageDirectory):
if photo.endswith('.tif'):
ImageFiles.append(photo)
if len(ImageFiles)>0:
print(ImageFiles)
if len(ImageFiles)==0:
print('no images found!')

# Load Image Files into Chunk Camera
chunk.addPhotos(ImageFiles)
chunk.importMasks(path='',method='alpha')
camera = chunk.cameras[0]

# match Photos
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy,preselection=PhotoScan.GenericPreselection, filter_mask=True)

# align Photos
chunk.alignCameras()

# Build Dense Cloud
chunk.buildDenseCloud(quality=PhotoScan.MediumQuality)

#Build Model
chunk.buildModel(surface=PhotoScan.Arbitrary,interpolation=PhotoScan.EnabledInterpolation)

# Build UVs
chunk.buildUV(mapping=PhotoScan.GenericMapping)

# Build Texture
chunk.buildTexture(blending=PhotoScan.MosaicBlending, size=4096)

# Decimate Model
#chunk.decimateModel(100000)

modelname = path+"\\output\\model.obj"

#Export Model & Save Doc
chunk.exportModel(modelname,texture_format="tif", texture=True,format="obj")

time.sleep(5)
doc.save("AgisoftProject.psz")
time.sleep(5)
sys.exit()
quit()

return 1

label = "Custom/Run"
PhotoScan.app.addMenuItem(label, Custom, "r")

print("Custom Menu Added")
print ("press r to run")

any help would be greatly appreciated... not sure what I missed or broke.
« Last Edit: February 18, 2015, 07:41:04 PM by nickc »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: BuildTexture Fails on Update
« Reply #1 on: February 10, 2015, 01:19:59 AM »
Hello Nick,

And are there any errors in the Console pane?
Best regards,
Alexey Pasumansky,
Agisoft LLC

nickc

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: BuildTexture Fails on Update
« Reply #2 on: February 10, 2015, 05:33:58 PM »
Hey Alexey...There were no printed console errors for this.

I was able to figure it out though, I think it was missing the (interpolation=PhotoScan.EnabledInterpolation) from the buildModel line. It didnt have anything to do with buildTexture.