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 - pablorov

Pages: [1]
1
thank you!
it works great.

2
Hi, I try to estimate the image quality and disable those that have a quality lower than 0.6, I have tried with the following code:

Code: [Select]
chunk.estimateImageQuality(chunk.cameras)
    for camera in chunk.cameras:
        if float(camera.photo.meta["Image/Quality"]) < 0.6:
            camera.enabled = False

However, the console reports the following error:

Code: [Select]
float() argument must be a string or a number, not 'NoneType'
What would be the correct code?

Also I would like to know if there is a parameter for the estimation to be carried out ignoring the masked areas, I reviewed the phyton agisoft guide but I did not find anything.

Thanks a lot

3
Python and Java API / Re: Update view and bounding box for each chunk
« on: March 04, 2017, 08:27:33 AM »
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?

What modifications should I make in this code to be compatible with version 1.3.0?

Pages: [1]