1
Python and Java API / Re: Estimate image quality ignoring masked regions and disable images
« on: May 28, 2018, 08:02:50 AM »
thank you!
it works great.
it works great.
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.
chunk.estimateImageQuality(chunk.cameras)
for camera in chunk.cameras:
if float(camera.photo.meta["Image/Quality"]) < 0.6:
camera.enabled = False
float() argument must be a string or a number, not 'NoneType'
Hello m,
Here's the code that automatically orients the viewpoint to display the bounding box fully in the Model view frame and exports the model to PDF format.Code: [Select]import PhotoScan
from PySide import QtGui
chunk = PhotoScan.app.document.chunk
T = chunk.transform.matrix
viewpoint = PhotoScan.app.viewpoint
main = QtGui.qApp
for wdg in list(main.allWidgets()):
if wdg.inherits('QGLWidget'):
cy = wdg.height()
cx = wdg.width()
break
region = chunk.region
r_center = region.center
r_rotate = region.rot
r_size = region.size
r_vert = list()
for i in range(8): #bounding box corners
r_vert.append(PhotoScan.Vector([0.5 * r_size[0] * ((i & 2) - 1), r_size[1] * ((i & 1) - 0.5), 0.25 * r_size[2] * ((i & 4) - 2)]))
r_vert[i] = r_center + r_rotate * r_vert[i]
height = T.mulv(r_vert[1] - r_vert[0]).norm()
width = T.mulv(r_vert[2] - r_vert[0]).norm()
if width / cx > height /cy:
scale = cx / width
else:
scale = cy / height
PhotoScan.app.viewpoint.coo = T.mulp(chunk.region.center)
PhotoScan.app.viewpoint.mag = scale
PhotoScan.app.viewpoint.rot = chunk.transform.rotation * r_rotate
crs = PhotoScan.CoordinateSystem("LOCAL")
chunk.exportModel(path, format="pdf", projection=crs)
As for the script that should use the coordinates of the bounding box corners, are you planning to specify all eight points or four laying in the plane?