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

Pages: [1] 2
1
General / Re: MicaSense RedEdge-MX - Calibration Panels
« on: April 26, 2020, 06:40:02 AM »
Thank you for the clarification Alexey.

2
General / Re: MicaSense RedEdge-MX - Calibration Panels
« on: April 23, 2020, 10:54:52 PM »
Hello jmgc,

Yes, Metashape considers the timestaps, if there are calibration images of the panel available before and after the flight.

Any word on this Alexey? Is Metashape interpolating values or is it using the panel that is closest in time for a given image?

3
I would try importing following file specifying that it is USGS camera calibration format...

Thank you for your effort on this Paul, I'll definitely give this a shot. Would you suggest fixing the values here, at least at first, and letting the "0" values be calculated by metashape?

4
Attached here are some screen shots from a terrestrial calibration certificate for the camera that captured images I'm using in Metashape.

Can someone help me translate the relevant parameters into a calibration file that metashape can read (I'm guessing USGS format since some of those values are already in the certificate)?

Thank you

5
Python and Java API / Re: Python script crashes Metashape
« on: November 12, 2019, 08:54:47 PM »
Thanks for the reply Alexey.

I've just sent an email with a download link to the .psz file and the script.

I've just recreated the crash using the script, checked the Applications section of the Event Viewer and found nothing.

6
Python and Java API / Python script crashes Metashape
« on: November 11, 2019, 09:06:53 PM »
I need help understanding why the script attached here is crashing Metashape. It covers gradual selection and optimization and there is essentially three parts: reconstruction uncertainty, projection accuracy and reprojection error in that order. Executing reporjection error isnt as straight forward as I need the script to check total camera error and stop if it is already below some threshold (20cm) and not let the program iterate the process more than 4 times.

The reconstruction uncertainty and projection accuracy sections together run just fine. It's when I add the reporjection error section that Metashape crashes. I've also attached here the log file of the crash. It stops before recalculating and reporting camera error in the for-loop in the script. I believe something here is causing it to crash.

Do you have any ideas on how to fix this issue?

Script:

Code: [Select]
import Metashape, math, sys


doc = Metashape.app.document #specifies open document
chunk = doc.chunk #specifies active chunk
T = chunk.transform.matrix
crs = chunk.crs
pc = chunk.point_cloud #PointCloud object of sparse cloud points
pc_init = len(pc.points) #returns integer of number of sparse cloud points
print("****Number of starting points:", pc_init) #prints initial point number in raw sparse cloud

# Below starts the gradual selection, filtering and optimization process

#Reconstrution Uncertainty
threshold = 15
f = Metashape.PointCloud.Filter()
f.init(pc, criterion = Metashape.PointCloud.Filter.ReconstructionUncertainty)
values = f.values.copy()
values.sort()
thresh = values[int(len(values) * (1-threshold/100))]
f.selectPoints(thresh)
nselected = len([p for p in pc.points if p.selected])
pc.removeSelectedPoints()
print("****", nselected, " points removed during reconstuction uncertainty filtering")
#Camera optimization
chunk.optimizeCameras(fit_f=True, fit_cx=True, fit_cy=True, fit_b1=False, fit_b2=False, fit_k1=True,
fit_k2=True, fit_k3=True, fit_k4=False, fit_p1=True, fit_p2=True, fit_p3=False,
fit_p4=False, adaptive_fitting=False, tiepoint_covariance=False)
#Report Total Camera Error
sums = 0
num = 0
for camera in chunk.cameras:
    if not camera.transform:
         continue
    if not camera.reference.location:
         continue

    estimated_geoc = chunk.transform.matrix.mulp(camera.center)
    error = chunk.crs.unproject(camera.reference.location) - estimated_geoc
    error = error.norm()
    sums += error**2
    num += 1
print("****Total Camera Error: ", round(math.sqrt(sums / num),3))
#doc.save()

#Projection Accuracy
threshold = 15
f = Metashape.PointCloud.Filter()
f.init(pc, criterion = Metashape.PointCloud.Filter.ProjectionAccuracy)
values = f.values.copy()
values.sort()
thresh = values[int(len(values) * (1-threshold/100))]
f.selectPoints(thresh)
nselected = len([p for p in pc.points if p.selected])
pc.removeSelectedPoints()
print("****", nselected, " points removed during projection accuracy filtering")
#Camera optimization
chunk.optimizeCameras(fit_f=True, fit_cx=True, fit_cy=True, fit_b1=False, fit_b2=False, fit_k1=True,
fit_k2=True, fit_k3=True, fit_k4=False, fit_p1=True, fit_p2=True, fit_p3=False,
fit_p4=False, adaptive_fitting=False, tiepoint_covariance=False)
#Report Total Camera Error
sums = 0
num = 0
for camera in chunk.cameras:
    if not camera.transform:
         continue
    if not camera.reference.location:
         continue

    estimated_geoc = chunk.transform.matrix.mulp(camera.center)
    error = chunk.crs.unproject(camera.reference.location) - estimated_geoc
    error = error.norm()
    sums += error**2
    num += 1
print("****Total Camera Error: ", round(math.sqrt(sums / num),3))
#doc.save()

# Reprojection Error
# This step needs to be iterated until until camera accuracy reaches 20cm. Should
# sucessive iterations not decrease that number for some reason, this step will be
# limitted to 4 iterations.

for i in range(4):
if (round(math.sqrt(sums / num))) <= 0.20:
sys.exit('****Camera error has reached ~20cm')
#doc.save()
else:
threshold = 10
f = Metashape.PointCloud.Filter()
f.init(pc, criterion = Metashape.PointCloud.Filter.ReprojectionError)
values = f.values.copy()
values.sort()
thresh = values[int(len(values) * (1-threshold/100))]
f.selectPoints(thresh)
nselected = len([p for p in pc.points if p.selected])
pc.removeSelectedPoints()
print("****", nselected, " points removed during reprojection error filtering")
#Camera optimization
chunk.optimizeCameras(fit_f=True, fit_cx=True, fit_cy=True, fit_b1=True, fit_b2=True, fit_k1=True,
fit_k2=True, fit_k3=True, fit_k4=True, fit_p1=True, fit_p2=True, fit_p3=True,
fit_p4=True, adaptive_fitting=True, tiepoint_covariance=True)
#Report Total Camera Error
sums = 0
num = 0
for camera in chunk.cameras:
    if not camera.transform:
         continue
    if not camera.reference.location:
         continue

    estimated_geoc = chunk.transform.matrix.mulp(camera.center)
    error = chunk.crs.unproject(camera.reference.location) - estimated_geoc
    error = error.norm()
    sums += error**2
    num += 1
print("****Total Camera Error: ", round(math.sqrt(sums / num),3))
#doc.save()

Log File:
Code: [Select]
2019-11-11 09:54:50 Agisoft Metashape Professional Version: 1.5.2 build 7838 (64 bit)
2019-11-11 09:54:50 Platform: Windows
2019-11-11 09:54:50 CPU: Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz (laptop)
2019-11-11 09:54:50 CPU family: 6 model: 158 signature: 906E9h
2019-11-11 09:54:50 RAM: 31.9 GB
2019-11-11 09:54:51 OpenGL Vendor: NVIDIA Corporation
2019-11-11 09:54:51 OpenGL Renderer: Quadro M1200/PCIe/SSE2
2019-11-11 09:54:51 OpenGL Version: 4.6.0 NVIDIA 431.70
2019-11-11 09:54:51 Maximum Texture Size: 16384
2019-11-11 09:54:51 Quad Buffered Stereo: not enabled
2019-11-11 09:54:51 ARB_vertex_buffer_object: supported
2019-11-11 09:54:51 ARB_texture_non_power_of_two: supported
2019-11-11 09:54:51 Using simple console. Rich console can be enabled in Preferences dialog.
2019-11-11 09:54:51 LoadProject: path = C:/Users/smescarzaga/Google Drive/Thesis _ Proposal/CREST/NERTO/NPS_SfM_Scripting/AK2017_OB_Deadhorse_Job_East_delta.psx
2019-11-11 09:54:51 loaded project in 0.057 sec
2019-11-11 09:54:52 Finished processing in 0.058 sec (exit code 1)
2019-11-11 09:55:10 ****Number of starting points: 57847
2019-11-11 09:55:10 Analyzing point cloud...
2019-11-11 09:55:11 Finished processing in 0.198 sec (exit code 1)
2019-11-11 09:55:11 **** 8677  points removed during reconstuction uncertainty filtering
2019-11-11 09:55:11 OptimizeCameras: f, cx, cy, k1-k3, p1, p2, adaptive fitting = 0
2019-11-11 09:55:11 Optimizing camera locations...
2019-11-11 09:55:11 removed 60 cameras: 1115, 1116, 1117, 1118, 1119, 1120, 1122, 1123, 1124, 1125, 1126, 1135, 1136, 1137, 1148, 1149, 1150, 1151, 1152, 1154, 1155, 1156, 1157, 1158, 1159, 180, 181, 185, 186, 187, 188, 189, 190, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222, 223, 226, 889, 890, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923
2019-11-11 09:55:11 removed 60 stations
2019-11-11 09:55:11 adjusting: xxxx 0.197437 -> 0.197061
2019-11-11 09:55:13 coordinates applied in 0 sec
2019-11-11 09:55:13 Finished processing in 1.652 sec (exit code 1)
2019-11-11 09:55:13 ****Total Camera Error:  0.509
2019-11-11 09:55:13 Analyzing point cloud...
2019-11-11 09:55:13 Finished processing in 0.061 sec (exit code 1)
2019-11-11 09:55:13 **** 7375  points removed during projection accuracy filtering
2019-11-11 09:55:13 OptimizeCameras: f, cx, cy, k1-k3, p1, p2, adaptive fitting = 0
2019-11-11 09:55:13 Optimizing camera locations...
2019-11-11 09:55:14 adjusting: xxx 0.203232 -> 0.20322
2019-11-11 09:55:14 coordinates applied in 0 sec
2019-11-11 09:55:14 Finished processing in 1.054 sec (exit code 1)
2019-11-11 09:55:14 ****Total Camera Error:  0.507
2019-11-11 09:55:14 Analyzing point cloud...
2019-11-11 09:55:15 Finished processing in 0.067 sec (exit code 1)
2019-11-11 09:55:15 **** 4179  points removed during reprojection error filtering
2019-11-11 09:55:15 OptimizeCameras: f, cx, cy, b1, b2, k1-k4, p1-p4, adaptive fitting = 1
2019-11-11 09:55:15 Optimizing camera locations...
2019-11-11 09:55:15 adjusting: xxxxx 0.182986 -> 0.1827
2019-11-11 09:55:16 adjusting: x 0.182714 -> 0.182714
2019-11-11 09:55:16 coordinates applied in 0 sec

7
General / Opinions on perpendicular (key) flight lines
« on: August 08, 2019, 03:59:53 AM »
Hi folks,

I'm working with a group now who conducts manned, fixed-wing SfM missions for coastal regions. This means AOIs tend to be thin and oblong, although not quite like corridor mapping. The current operation procedure stresses the collection of images in 1-3 flight lines perpendicular the main flight lines. Conceptually, I can understand how that might strengthen the geometry of the model during reconstruction.

However, I've yet to find anything in the literature that recommends this as a procedure for airborne SfM. Furthermore, this publication (https://www.sciencedirect.com/science/article/pii/S0924271618302727#t0005) seems to suggest that they received better results without the use of this perpendicular flight line.

What is the opinion of those in this forum? This is simply just not a hard and fast rule? Do perpendicular flight lines only help strengthen the model in corridor-like surveys? Can you point me to anything on this subject in the literature?

Thank you!
Stephen

8
Python and Java API / Re: How to return total camera error
« on: July 06, 2019, 06:09:50 AM »
Great, thanks once again Alexey!

9
Python and Java API / How to return total camera error
« on: July 03, 2019, 10:56:13 PM »
For Metashape 1.5.2 python API, is there any easy way to simply return the "Total Error" value that is reported at the bottom of the camera reference window?

I'm having trouble getting some of the scripts I've seen in this forum posted for early versions of Photoscan that calculate the difference between actual and estimated camera positions to work in Metashape. It seems like value should be something that is directly access through the API without doing these calculations.

10
This works great! Thank you Alexey!

11
I'm trying to automate a workflow that calls for the selection of a percentage of the sparse cloud at each iteration, rather than at some threshold of reconstruction uncertainty, projection error, etc. I've seen below where a threshold variable is passed into a gradual selection

Code: [Select]
fltr = ps.PointCloud.Filter()
    fltr.init(chunk, ps.PointCloud.Filter.ReconstructionUncertainty)
    fltr.selectPoints(2 * thresh)


How I can I specify in the script to select a percentage of the initial points?

EDIT: As a clarification, I'd like the filter to select a percentage of the points in my cloud based on reconstruction uncertainty.

12
General / Re: Systematic Z Error in Proportion to Altitude (Phantom 4 RTK)
« on: February 13, 2019, 08:57:50 AM »
Dragline,

it would be very interesting to have some data set to test it... Using RTK to just fix the camera perspective centers can often bring a problem in elevation as focal is directly correlated to flight altitude... So the higher you are from ground, the Z error will increase relative to some error in focal…..

Paulo,

Can you elaborate a bit on this for me? What do you mean "RTK to just fix the camera perspective centers?

Thanks,
S

13
General / Phantom 4 RTK with Micasense Integrated?
« on: February 09, 2019, 01:25:36 AM »
Has anyone tried this yet? Are the RTK solutions or PPK data acquired in a way that can be applied to Micasense imagery (assuming you've worked out your lever arm offsets)?

Thanks,
S

14
General / Issues with viewing RGB ortho using MicaSense imagery
« on: November 22, 2018, 02:33:40 AM »
Hello,

I've followed the short Agisoft guide for importing and processing multispectral imagery with no issues. I'm able to cycle between primary channels and view the different camera calibrations for each band of the camera (so it seems that Agisoft is reading each band's metadata and know's which is which). However, when I got to view my final orthomosaic, I can only view one band at a time as opposed to and RGB. Can anybody give me some guidance on this?

Many thanks,

S

15
James,

Thanks for your contribution. This certainly helps in my understanding!

S

Pages: [1] 2