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

Pages: [1]
1
Python and Java API / Duplicate DEM
« on: November 08, 2019, 01:08:34 PM »
Hello,

How to duplicate DEM using python api? I want to make this section of metashape instruction automatically:

Quote
In case you want to save current DEM instance and edit its copy, right-click on
DEM and choose "Duplicate" option.

I've tried appending existing elevation model to the list of chunk elevations models, but it hasn't worked.

Code: [Select]
dem=chunk.elevation
chunk.elevations.append(dem)


2
General / Set "invalid" tie points as "valid"
« on: April 11, 2019, 04:11:57 PM »
Hello,

I need to align some scanned, archival photographs in Metashape. Tie points extracting works well on this dataset, but for some pair of photos Metashape set hundreds of tie points as "invalid". Is it possible to set "invalid" tie points as "valid" for these pairs using python scripting?

I've tried to change tie points accuracy in the chunk settings panel, but it doesn't help.

Best regards,
Adam

3
Bug Reports / Filter photos by marker - problem
« on: August 20, 2018, 01:31:36 PM »
Hello,

In Agisoft 1.4.3 filter photos by marker function doesn't work for unchecked marker. I am convinced that this function worked for both types of markers in the previous version of Agisoft. This is very troublesome, because after the distribution of points on Check / Control I do not know if the unchecked marker is outside the test area.

I hope this is a bug, not the functionality introduced in the new version of the software.

Best regards,
Adam

4
Python and Java API / Choosing rotating angles types
« on: June 06, 2018, 01:48:03 PM »
Hello,

Is it possible to choose rotation angles type (i mean i want to choose Omega,Phi,Kappa) in python script? I loaded EO from a csv file, but angles were loaded as pitch,roll,yaw by default. In GUI version of agisoft i have the possibility to change angles type in the "Import CSV" window.

Best regards,
Adam

5
General / YPR to omega,phi,kappa
« on: April 12, 2018, 02:41:16 PM »
Hello,

Api functions: "ypr2mat" and "mat2opk" works great, so i decide to ask you about formulas, whose you are using to calculate rotation matrixes. Could you provide some equations? I'm trying to develop a function in Python to calculate omega,phi,kappa directly after my UAV landing into EPSG: 2178 projection. I based on this paper: "New Calibration and Computing Method for Direct Georeferencing of Image and Scanner Data Using.pdf", but my results are not correct comparing to yours in Agisoft :( According to this paper, could you explain me the origin P0 of the tangent plane system? Should it be calculated for each image separately or single set of geographic coordinates for whole photogrammetric block?



I've got longitude,latitude and angles (yaw, pitch, roll) extracted from XMP info for each image (captured by dji phantom).

Code: [Select]
import numpy as np

fi = np.deg2rad(52.113742)
lam = np.deg2rad(21.397086)

roll = np.deg2rad(-0.875)
pitch = np.deg2rad(-0.825)
yaw = np.deg2rad(65.318)


def Cnb(yaw, pitch, roll):

    Rz1 = np.array([[np.cos(yaw), -np.sin(yaw), 0],
                   [np.sin(yaw), np.cos(yaw), 0],
                   [0, 0, 1]])

    Ry1 = np.array([[np.cos(pitch), 0, np.sin(pitch)],
                   [0, 1, 0],
                   [-np.sin(pitch), 0, np.cos(pitch)]])

    Rx1 = np.array([[1, 0, 0],
                   [0, np.cos(roll), -np.sin(roll)],
                   [0, np.sin(roll), np.cos(roll)]])

    Cnb = np.matmul(np.matmul(Rz1,Ry1), Rx1)

    return Cnb


def Cne(fi, lam):

    Ry = np.array([[np.cos(fi+(np.pi/2)), 0, np.sin(fi+(np.pi/2))],
                   [0,1,0],
                   [-np.sin(fi+(np.pi/2)), 0, np.cos(fi+(np.pi/2))]])

    Rz = np.array([[np.cos(lam), -np.sin(lam), 0],
                   [-np.sin(lam), np.cos(lam), 0],
                   [0, 0, 1]])

    Cne = np.matmul(Ry, Rz)

    return Cne


def Cnn(fi, lam, fi0, lam0, lam0GK):
    en = (lam-lam0)*np.cos(fi)*-1
    ee = fi-fi0
    ev = (lam-lam0GK)*np.sin(fi)

    Cnn = np.array([[1, ev, -ee],
                    [-ev, 1, en],
                    [ee, -en, 1]])
    return Cnn


TBb = np.array([[-1,0,0],
                [0,1,0],
                [0,0,-1]])

TEn = np.array([[0,1,0],
                [1,0,0],
                [0,0,-1]])


def CBE(yaw, pitch, roll, fi, lam, fi0, lam0, lam0GK):
    Cnn0 = Cnn(fi, lam, fi0, lam0, lam0GK)
    Cn0e = Cne(fi0, lam0)
    Cnie = Cne(fi, lam)
    Cnib = Cnb(yaw, pitch, roll)

    C = np.matmul(np.matmul(np.matmul(Cnn0, Cn0e), Cnie.transpose()), Cnib)
    return np.matmul(np.matmul(TBb, C.transpose()), TEn.transpose())




#c = CBE(yaw, pitch, roll, fi, lam, fi0=np.deg2rad(0), lam0=np.deg2rad(21), lam0GK=np.deg2rad(21))
b = CBE(yaw, pitch, roll, fi, lam, fi0=fi, lam0=lam, lam0GK=np.deg2rad(21))
c = b.transpose()
print (c)
f = np.rad2deg(np.arctan(c[0,2]/((c[1,2]**2+c[2,2]**2)**0.5)))
omega = np.rad2deg(np.arctan(-c[1,2]/c[2,2]))
kappa = np.rad2deg(np.arctan(-c[0,1]/c[0,0]))

print ('omega = ', omega)
print ('phi = ', f)
print ('kappa = ', kappa)


Best regards,
Adam

6
Python and Java API / GCPs loading error
« on: March 22, 2018, 12:46:01 PM »
Hello,

I'm trying to load reference data (GCPs) and i would like to create markers for missing entries. Additionally, i would like to specify coordinate system for input. Unfortunately, i receive the below error...

Code: [Select]
chunk.loadReference(tupla_zmiennych[3], PhotoScan.ReferenceFormatCSV, columns="nxyz", skip_rows=4, delimiter=",", crs=PhotoScan.CoordinateSystem("EPSG::2180"), create_markers=True)
I receive error:
TypeError: function takes at most 6 arguments (7 given)

When i deleted one argument ("crs") i receive this kind of error:

"TypeError: 'create_markers' is an invalid keyword argument for this function".

tupla_zmiennych[3] is a file directory and it works fine

Anyone could help me?

Best regards,
Adam



Pages: [1]