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

Pages: [1] 2 3
General / Re: Selection based on bounding box
« on: May 26, 2020, 12:14:56 AM »
I found a similar solution on the forum from a while back

I converted it to MetaShape in case anyone else needs this functionality

Code: [Select]
import Metashape
import math

# Checking compatibility
compatible_major_version = "1.6"
found_major_version = ".".join('.')[:2])
if found_major_version != compatible_major_version:
    raise Exception("Incompatible Metashape version: {} != {}".format(found_major_version, compatible_major_version))

from PySide2 import QtCore, QtGui, QtWidgets
from multiprocessing.dummy import Pool as ThreadPool ##

def checkFaceTask(face):
global vertices
face_vertices = [vertices[v] for v in face.vertices]
checkFace(face, face_vertices)

class progressDialog(QtWidgets.QDialog):
def __init__(self, parent):

QtWidgets.QDialog.__init__(self, parent)

self.setWindowTitle("Crop mesh by region")
self.btnQuit = QtWidgets.QPushButton("Quit")
self.btnP1 = QtWidgets.QPushButton("Start")
self.pBar = QtWidgets.QProgressBar()
self.pBar.setFixedSize(100, 50)

layout = QtWidgets.QGridLayout()   
layout.addWidget(self.pBar, 0, 0)
layout.addWidget(self.btnP1, 0, 1)
layout.addWidget(self.btnQuit, 0, 2)
self.move(500, 400)

proc_markers = lambda : self.process()
QtCore.QObject.connect(self.btnP1, QtCore.SIGNAL("clicked()"), proc_markers)
QtCore.QObject.connect(self.btnQuit, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("reject()"))

def isReady(self):
for task in self.tasks:
if (not task.done):
return False
return True

def onReady(self, result):
print("on ready")

print("Script finished.")

def process(self):

global doc, app
global region, vertices
chunk = doc.chunk
region = chunk.region
print("\nScript started...")

for i in range(len(chunk.frames)):

chunk.frame = i
frame = chunk.frames[i]
if not frame.model:
vertices = frame.model.vertices
result = ThreadPool().map_async(checkFaceTask, frame.model.faces, callback = self.onReady)

def checkFace(face, face_vertices):

global region
R = region.rot #Bounding box rotation matrix
C = #Bounding box center vector
size = region.size
remove_vertices = 0

for vertex in face_vertices:

v = vertex.coord
v.size = 3
v_c = v - C
v_r = R.t() * v_c

if abs(v_r.x) > abs(size.x / 2.):
remove_vertices += 1
elif abs(v_r.y) > abs(size.y / 2.):
remove_vertices += 1
elif abs(v_r.z) > abs(size.z / 2.):
remove_vertices += 1

if remove_vertices == 3:
face.selected = True

def main():

global doc

global app
app = QtWidgets.QApplication.instance()
parent = app.activeWindow()

dlg = progressDialog(parent)

label = "Custom menu/Crop mesh by bounding box", main)

General / Selection based on bounding box
« on: May 24, 2020, 07:31:25 PM »
Is there any way to select the elements inside a bounding box?

I did a quick search and came up with this post which deletes all points outside bounding box.

I would like to select everything inside the bounding box(mainly mesh elements, but could be useful for all other objects as well).

Can anyone point me in the right direction or suggest how to modify that script?

General / Re: "Unexpected Channel Count" error
« on: January 14, 2019, 03:00:30 AM »
It looks like it was the TIFF files.
Converted them to jpg and the software runs smoothly.

General / Re: "Unexpected Channel Count" error
« on: January 13, 2019, 11:56:03 PM »
Hi Alexey,
What do you mean by extra channels?
How do I check?

These are TIFFs generated by GoPro Fusion software. Images taken with the GoPro Fusion camera.

General / "Unexpected Channel Count" error
« on: January 13, 2019, 09:06:08 PM »
I'm getting a "Unexpected Channel Count" error in Metashape 1.5.0 build 7492 when I run the "Build Dense Cloud" step.
The equirectangular images align just fine.

This only happens when I have Spherical (equirectangular) images in my dataset. The same spherical images worked with no problems in Photoscan 1.4.4 in the Build Dense Cloud step.

Anyone else getting this error related to spherical images?

General / Re: Cesium 3D Tiles - Poor Overview Geometry & Texture Resolution
« on: November 09, 2018, 07:15:39 PM »
Thank you for that Alexey!

I too have recently started using CesiumJS, and this information will come in handy!

General / Re: Increase processing performance by a factor of 2
« on: November 06, 2018, 01:21:55 AM »
Did another test on the i7-6700k system, and split up the "Building" dataset into 4 chunks.
The 4 chunks processed the "Build Mesh" step simultaneously, and finished in 382 sec, 390 sec, 391 sec and 372 sec.

Compared to the 512 sec time for completing the Build Mesh step in one chunk, running the model in 4 chunks (on a i7-6700k) can yield a 1.33 times improvement.
Though the i7-6700k only has 4 cores, so I imagine there's not much to be gained beyond 4 simultaneous chunks.

Which is likely why the TR-1950x with 16 cores did much better with the simultaneous processing. CPUs with more cores are likely to gain much more by parallelazing processing this way.

General / Increase processing performance by a factor of 2
« on: November 06, 2018, 12:52:12 AM »
I've found that I can increase the speed which models are processed if I run multiple simultaneous instances of PhotoScan on the same machine, and achieve over twice the performance increase!

On a TR1950X workstation:
- Ran a dataset, and I got a processing time of 2670 sec for processing the "Build Mesh" step.
- Used the '' python script, and divided up the model into 4 chunks, and saved each chunk as a separate file.
- Opened up 4 instances of Photoscan on the same machine, and loaded one chunck into each instance.
- Started the "Build Mesh" step in all 4 instances at nearly the same time, and got the following processing time for each instance: 577 sec, 1131 sec, 1132 sec, 1273 sec.

Of the 4 chucks running simultaneously , the longest one was 1273 sec. This means that I was able to process the model faster (by a factor of 2.1, which is quite significant) if I split the work between multiple instances.

On a different workstation, running a i7-6700k:
- Ran the "Building" dataset, and got a procesing time of 512 sec for the "Build Mesh" step.
- Split the model into two chunks, and processed the two chunks simultaneously.
- For the "Build Mesh" step, I got 417 sec and 415 sec.

This time the two chunks finished in almost the same time, but still provided a processing time increase of 1.22 times by running multiple simultaneous instances vs one instance of PhotoScan.

Has anyone else noticed this kind of behavior or done any similar testing?

The relationship between increasing number of cores and processing time is far from linerar.
I'm guessing this type of processing makes the best use of the cores/threads available.

I'd encourage others to try this and post their results on their multi-core systems.

General / Re: Optimum texture size
« on: November 03, 2018, 02:09:41 AM »
I realize that all I'm defining is the size of the texture atlas.
That's not what I was asking.

For example, take the "Building" dataset.  There are 50 images, each image being 12.7 megapixels.
Just because I can set a texture atlas of 50 x 16k images, doesn't mean that I'll get that much resolution out of the source data. The source data has much much less info in those images.

So beyond a certain point, increasing the texture atlas any further just wastes space.

I'm just looking for a way to find the optimum texture atlas that projects the original images pixel per pixel (or as close to that as possible) onto the resulting texture.

Is there any way to do that?

General / Optimum texture size
« on: October 30, 2018, 01:20:38 AM »
An image set taken with a 50MPix camera will have more texture detail then the same set of 10MPix images. How do I calculate what my resulting texture should be (texture resolution and number of textures) so that it takes full advantage of the source image resolution.
Is there a feature I missed which can calculate the optimal texture?

I know that in building a tiled mesh, a choice is given to the amount of detail that the user wants in the texture, but nothing similar exists for generating a regular texture.

Are there any tricks or advice?

General / Re: Exporting Cesium Tiled Models lacks GPS location
« on: September 28, 2018, 04:19:16 PM »
Never mind.
The location is saved in the tiled model. I was incorrectly loading it into the Cesium viewer.

General / Exporting Cesium Tiled Models lacks GPS location
« on: September 28, 2018, 03:53:24 PM »
Should the export of a tiled model preserve the model's geo-location?

I have an area scanned with a drone (all images are geo-referenced). When I export the tiled model as a Cesium Tiled Model, the resulting tileset.json file doesn't include the GPS location of the model.

Is this by design?

General / Re: Weird message when aligning
« on: July 21, 2018, 10:15:25 PM »
I get no processing errors, just the warning text in red letters.

General / Meshing settings
« on: June 23, 2018, 11:36:16 PM »
Is the Low/Medium/High/Custom setting in the meshing settings just a setting for the decimation step? Or does the High setting actually generate more polys?

General / Re: Problem with align of forested images
« on: June 22, 2018, 02:12:20 PM »
There is a HUGE difference between what a camera will see from 2000m (6700 ft) and 60m.

If the trees sway randomly by say 1m, from 2000m that movement is invisible, where from 60m, that movement is quite significant!

To the OP,  you need a higher altitude or a day that has zero wind, in order to accurately capture trees.

Pages: [1] 2 3