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

Pages: [1]
1
using filename template:  image_{filenum:04}.png

2
Python and Java API / how to set the viewpoint by python script
« on: December 16, 2021, 06:46:47 AM »
I want to captureView  in the camera position
this is my script
Code: [Select]
import Metashape as ms
chunk = ms.app.document.chunk
camera = chunk .cameras[0]
mv = ms.app.model_view
vp = mv.viewpoint
vp.fov = 90
vp.rot = chunk.transform.matrix.rotation() * camera.transform.rotation() * ms.Matrix.Diag([1, -1, -1])
center = (chunk.transform.matrix * camera.transform).translation()
vp.coo = ?
vp.mag = ?
mv.captureView(1024, 1024, True, True).save(r'd:\t.jpg')

I want the viewpoint is the same with "look though" on the camera.
but i do not know how to set vp.coo and vp.mag  parameter.   it seems that the vp.coo is a little different with vp.center.

can anyone help me.


3
I want to do  matchphoto  task using the defined list of camera pairs by python script.
this is my scripts:

Code: [Select]
import Metashape as ms
chunk = ms.app.document.chunk
task = ms.Tasks.MatchPhotos()
for idx in range(len(chunk.cameras) - 1):
    pairs.append((chunk.cameras.key, chunk.cameras[idx + 1].key))
task.pairs = pairs
# task.apply(chunk)  # it is ok when run in local computer
# convert to network  task
nt = task.toNetworkTask(chunk)
client = ms.NetworkClient()
client.connect('192.168.1.10')
proj_path = ms.app.document.path
batch_id = client.createBatch(proj_path[proj_path.find(":") + 2:], [nt])
client.resumeBatch(batch_id)

It is ok when task is not  network task
but when  convert to network task,  network will crash.
if  task.pairs  parameter is not assigned.   network task is ok

metashpe version is 1.7.1

Pages: [1]