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 - jurijs.jeshkins

Pages: [1]
1
Python and Java API / Re: Filtering photos by shape from Python API
« on: April 09, 2020, 04:08:59 PM »
I found a workaround through placing markers on the shape and looking at projections. Seems to work.

Code: [Select]
import Metashape
import csv

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

dir_path = "C:/"


with open(dir_path + 'shape_cameras.txt', "w") as f:
fwriter = csv.writer(f, dialect='excel-tab', lineterminator='\n', delimiter = ";")

for shape in chunk.shapes:
marker = chunk.addMarker(T.inv().mulp(shape.vertices[0]))
projections = marker.projections.items()
for proj in projections:
camera = proj[0]
vector = proj[1]
fwriter.writerow([shape.label, camera.photo.path, vector.coord.x, vector.coord.y])
chunk.remove(marker)
f.close()
print("Finished")

2
Python and Java API / Filtering photos by shape from Python API
« on: April 09, 2020, 02:09:01 PM »
Hi!

I have a layer with points, which I imported into the chunk as shapes. I want to filter my photos by this points and get at least list of photos used for point cloud generation under the shapes. The bonus would be to get the coordinates of the point on each photo as well. I see, that it is possible to do it from the interface, but I have thousands of points. Is it somehow possible from Python API?

3
Bug Reports / A breakpoint has been reached
« on: March 04, 2020, 10:57:16 AM »
I am doing multiple iterations of sparse cloud optimization (~1000) and usually after about a half of all iterations I get this message (see in attachment). The error appears to be random and I don't know why it appears. Google says, that it can be occuring also in other applications. Any thoughts?

4
Python and Java API / Re: Object is not a sequence on camera.project
« on: February 27, 2020, 11:30:56 AM »
Yes, I have tried to put try-catch block and print out point. There was a value, which had coordinates. It was not None.

The project is quite big, I will try to reduce it somehow and I will put somewhere to the cloud.

5
Python and Java API / Re: Object is not a sequence on camera.project
« on: February 26, 2020, 03:08:17 PM »
It looks to me, that this error appears only on old projects, that were made with Photoscan. I have tried now to run the same script on another similar project and everything works as expected. The only difference is, that the new project was made with Metashape 1.6.0.

6
Python and Java API / Object is not a sequence on camera.project
« on: February 26, 2020, 02:33:51 PM »
I am trying to adjust the script for making precision maps for UAV surveys, published by James, 2017 "Precision maps and 3-D uncertainty-based topographic change detection with structure-frommotion photogrammetry". The script was written for PhotoScan and there are some issues with the API reference. I managed to correct all the issues, but I have problems with camera.project() function.

Code: [Select]
original_points = original_chunk.point_cloud.points
original_point_proj = original_chunk.point_cloud.projections
npoints = len(original_points)
for camera in original_chunk.cameras:
if not camera.transform:
continue

point_index = 0
for original_proj in original_point_proj[camera]:
track_id = original_proj.track_id
while point_index < npoints and original_points[point_index].track_id < track_id:
point_index += 1
if point_index < npoints and original_points[point_index].track_id == track_id:
if not original_points[point_index].valid:
continue
original_proj.coord = camera.project(original_points[point_index].coord)

# Set the original marker points be zero error, from which we can add simulated error
# Note, need to set from chunk because original_marker.position will be continuously updated
for markerIDx, original_marker in enumerate(original_chunk.markers):
if (not original_marker.projections[camera]) or (not chunk.markers[markerIDx].position):
continue
original_marker.projections[camera].coord = camera.project(chunk.markers[markerIDx].position)

While iterating through cameras i get "object is not a sequence" error on line
Code: [Select]
original_proj.coord = camera.project(original_points[point_index].coord)
Previously I have succesfully used the script with Metashape 1.6.0 and didn't had any issues with it. Maybe my mistake is obvious and I don't see it?

7
General / Re: Strange artifact after DEM creation
« on: March 06, 2019, 01:11:07 PM »
Ok, I will try to do General preselection with all the cameras turned off. If this won't work, I will look for another method.

8
General / Strange artifact after DEM creation
« on: March 05, 2019, 04:42:47 PM »
I have very strange artifact after DEM creation. You can see in attached file, that a strange crack appeared. As it is seen in the profile line, there is a ~2m gap between 2 parts of the DEM.

I combined pictures, that were acquired during 3 days of the expedition to the glacier. During all days GCPs were used. Lighting conditions vary between days, as well as flight altitude (because glacier is somewhat steep and UAV calculates altitude from the home point and stays on that altitude).

I have 2 questions:
1) What can I do with the pictures or project to eliminate this artifact?
2) What should I do better next time, when I will be doing UAV projects like this?

Pages: [1]