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.


Topics - chitty1989

Pages: [1]
1
Python and Java API / Marquee select and remove
« on: June 06, 2023, 08:16:37 AM »
Hi i was wondering if there was a script to define a marquee selection across multiple chunks to remove?

2
General / Screenshotting a chunk?
« on: May 24, 2023, 09:04:26 AM »
Hi,

I was just wondering if you take a screenshot of a chunk via a script and incorporate it into a batch script?

3
General / Aligning chunks to base model
« on: September 01, 2022, 11:44:43 PM »
Hi,
I have a project where I have multiple chunks of peoples heads that I need to allign to a base model of a head. Do you have any recommendations as to how to allign them?

Note: I have tried the allign chunks via camera method and used one chunk as the reference chunk to allign the rest. This gets me some of the way there but it still results in a little manual movement.  I was just curious if there is a more accurate method.

Also is there a way to view 2 chunks in the scene at a time. Ie. i want to view the base model and the chunk at the same time.

4
Python and Java API / reset region
« on: June 17, 2022, 09:44:26 AM »
Hey guys i was just hoping someone could help me write a python script that can reset the region box?

Regards,
Andrew

5
Python and Java API / region resize script
« on: March 21, 2022, 09:18:49 AM »
Hey guys i have this script that resizes the region box, however it takes into account points that are outside of the original region box, making the result very large. All i want to do is take the region box the allignment has given me and scale it up by a factor of 2 or whatever scale i give it

Code: [Select]
import Metashape, math

doc = Metashape.app.document
chunk = doc.chunk
region = chunk.region
T = chunk.transform.matrix

m = Metashape.Vector([1E+1, 1E+1, 1E+1])
M = -m

for point in chunk.point_cloud.points:
if not point.valid:
continue
coord = T * point.coord
for i in range(3):
m[i] = min(m[i], coord[i])
M[i] = max(M[i], coord[i])

center = (M + m) / 2
size = M - m
region.center = T.inv().mulp(center)
region.size = size * (2 / T.scale())

region.rot = T.rotation().t()

chunk.region = region
print("Script finished.")

6
Hey guys, Im trying to run a script that does a gradual selection and then a resize region box across multiple chunks

This script runs the gradual selection
Code: [Select]
import PhotoScan
import Metashape
import sys

def_recunc = 15

paramNo = len(sys.argv)

recunc = float(sys.argv[2] if paramNo == 5 else def_recunc)

for chunk in PhotoScan.app.document.chunks:
f = PhotoScan.PointCloud.Filter()
f.init(chunk, Metashape.PointCloud.Filter.ReconstructionUncertainty)
f.removePoints(recunc)


print("ReconstructionUncertainty Level: ")
print(recunc)

and then this script runs the resize region
Code: [Select]
import PhotoScan, math

doc = PhotoScan.app.document
chunk = doc.chunk
region = chunk.region
T = chunk.transform.matrix

m = PhotoScan.Vector([10E+10, 10E+10, 10E+10])
M = -m

for point in chunk.point_cloud.points:
if not point.valid:
continue
coord = T * point.coord
for i in range(3):
m[i] = min(m[i], coord[i])
M[i] = max(M[i], coord[i])

center = (M + m) / 2
size = M - m
region.center = T.inv().mulp(center)
region.size = size * (5 / T.scale())

region.rot = T.rotation().t()

chunk.region = region
print("Script finished.")

Does anyone know how i could combine these scripts to run as one script and make it run as part of a batch->run scripts option?

Pages: [1]