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

Pages: [1]
Python and Java API / Re: CRS coordinates to Region coordinates
« on: March 30, 2021, 04:12:45 PM »
As always, thank you very much Alexey, that was very helpful! The code worked perfectly, but I noticed that it is also required to scale the region size. The complete working code, for anyone who might be interested is as follows:

Code: [Select]
def placeRegion(center,size,angle):
crs =
T = chunk.transform.matrix
center = Metashape.Vector((center[0],center[1],center[2]))
center = T.inv().mulp(crs.unproject(center))
m = crs.localframe(T.mulp(center)) * T
R = m.rotation() * (1. / m.scale())
size = Metashape.Vector((size[0],size[1],size[2])) / m.scale()  # scaling the size is required
angle = np.radians(angle)
rot = Metashape.Matrix([[np.cos(angle), -np.sin(angle), 0], [np.sin(angle), np.cos(angle), 0], [0, 0, 1]])
rotation = R.t() * rot

chunk.region.rot = rotation = center
chunk.region.size = size


Code: [Select]
center = (X,Y,Z) # in CRS coordinates
size = (width,depth,height) # in meters
angle = float # rotation angle of the region (in degrees)

Python and Java API / CRS coordinates to Region coordinates
« on: March 29, 2021, 01:23:50 PM »
Hello everyone,

I have a bunding box of which the following quantities are known: center coordinates (northing and easting), width, height and rotation angle, as shown below:

The problem is that all the quantities (center, size) are expressed in the chunk's geographic coordinate system (in this case EPSG:7416).

I would like to set the reconstruction region (chunk.region) using this rectangle, but the units need to be converted to the local reference system first. Furthermore, the rotation angle needs to be converted into a rotation matrix, by assuming that the rotation around the other axes is zero (there is rotation only on the xy plane).

Does anyone have any idea of how to perform (using Python) this conversion, so that I can set:
  • chunk.region.size
  • chunk.region.rot

starting from a rectangle expressed in the geographic CRS?

The region center.z value, and the size.z value should remain unchanged, only the xy values must be changed according to the rectangle.

I would like to thank anyone in advance,


Python and Java API / Re: buildTiledModel() optimal parameters
« on: March 24, 2021, 10:26:46 PM »
Thank you Alexey,

as always very helpful

Python and Java API / Re: buildTiledModel() optimal parameters
« on: March 24, 2021, 10:20:23 PM »
Thank you Alexey,

that was really useful. I would also like to ask what is the purpose of the "keep_depth" parameter: if I try to use the function buildTiledModel() with depth maps as data source (source_data = Metashape.DataSource.DepthMapsData), I get the error "Null depth maps", so I guess we need to compute the depth maps manually before computing the tiled model, by using the buildDepthMaps() function
So, in this sense, what is the role of the "keep_depth" parameter in the buildTiledModel() function, since the depth maps have to be computed in advance?

Once again thank you very much,


Python and Java API / buildTiledModel() optimal parameters
« on: March 24, 2021, 01:39:29 PM »
Hello everyone,

when we build a Tiled Model from the GUI, the "Pixel Size" parameter is calculated automatically, and the "Face Count" parameter can be one of [High,Medium or Low].
I was wondering what are the equivalent parameters that we should pass to the  buildTiledModel() Python function? How can we calculate the pixel_size number automatically, as it is in the GUI, and set the face_count number so that it is equivalent to "High" in the GUI?

Thank you very much in advance,


Thank you Alexey,

that was very informative


Thank you Alexey,

so if I understood correctly, we could use this new feature to build a Tiled Model inside a certain reconstruction region, then move the region a bit and build another Tiled Model that will be merged with the previous one, in order to build a huge Tiled Model by processing small regions at the time. Is that correct?

Are you planning in the future to enable the possibility of selecting different tiled models, right clicking on them, and merging them, like with the standard non tiled models?

Thank you


General / Info about new "Merge tiled model" option in version 1.7.2
« on: March 22, 2021, 04:43:34 PM »
Hello everyone,

I was wondering what is the purpose, and how to use, the new "Merge tiled model" option in the "Build Tiled Model" dialog window. I tried searching for it in the manual, but it hasn't been updated yet.
Thank you in advance,


Python and Java API / Re: Render image from camera reference location
« on: March 18, 2021, 10:03:45 PM »
Thank you Paulo! That is really impressive, there is no way I could have come up with that. I just checked and it works flawlessly  :)

Python and Java API / Render image from camera reference location
« on: March 18, 2021, 05:52:54 PM »
Hi everyone,

I am trying to render an image of a tiled model, using the tiled_model.renderImage method. I would like to render from the camera reference positions (not the estimated ones), of which I know the easting, northing, altitude and yaw, pitch, roll angles. The camera reference values and the tiled model are expressed in the same geographic CRS.

The question is: how can I construct the transformation matrix to use in the tiled_model.renderImage() function, using the reference X,Y,Z and Y,P,R values of the cameras?

I tried constructing a 4x4 transformation matrix by computing a rotation matrix from the euler angles, and concatenating it with the [X.Y.Z] column and adding a [0,0,0,1] row, but I am getting an all-black render...

Thank you in advance,


General / Re: Optimum texture size
« on: March 03, 2021, 06:29:46 PM »
Hi outsider,

did you finally find a solution to this problem? I'm also trying to figure out a smart way to choose the optimal texture size/count for the model so that it uses all the information of the source images.

General / Re: Capture distance vs reference Altitude
« on: February 23, 2021, 06:42:08 PM »
Hi Alexey,

thank you very much for the answer! Regarding the multi-camera approach: do you think that it would be possible to use it (with the GUI and/or with Python), even though I have some locations where some of the pictures are not available, like is shown in the attached image?

In case that is not possible, because the multi-camera system requires all the images in every location, what approach would you then suggest to use instead?

Thank you


General / Capture distance vs reference Altitude
« on: February 17, 2021, 07:34:16 PM »
I am in the process of building a 3D model of a city, using a set o aerial images. The images are acquired by an airplane, using a camera rig with 5 cameras: one looking down (nadir) and four looking obliquely (N,S,W and E) with a tilting angle of -45 degrees.
By reading the documentation, I found that in order to improve the speed of the camera alignment process, it is helpful to use the "Reference Preselection" setting, so that the algorithm knows which cameras are more likely to have matching points. Furthermore, it is recommended, in case of oblique images, to set the average altitude of the cameras in the "Capture distance" option of the reference settings.

My question is: is it necessary to set this "capture distance" option, in the case when the images altitude is already present in the reference panel? Is the images altitude already taken into account during the alignment process, or do I have to set the average altitude anyway? My fear is that the image-wise altitude is more precise than an average, so by overriding it with an average one I'm afraid to lose some accuracy.

Thank you


Pages: [1]