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

Pages: [1]
1
Feature Requests / Zonal statistics from within shapes
« on: April 13, 2023, 02:39:13 AM »
It would be great to be able to calculate zonal statistics for pixel values within the bounds of shapefile features, similar to ArcMap's zonal statistics as table.. It would fit nicely into existing processing workflows

2
Python and Java API / progress callback - issues with dense cloud
« on: January 24, 2023, 08:54:54 AM »
I am trying to use the progress callback option from the Metashape Python API within my scripts for various steps in building an orthomosaic.  I have defined a function for printing the progress as per Alexey's recommendations here: https://www.agisoft.com/forum/index.php?topic=6146.0

Code: [Select]
def progress_bar_print(p):
    global n
    if not 'n' in globals():
        n = datetime.now()
    dif = datetime.now() - n
    # If the last progress print was less than .5 seconds, don't print
    if dif.seconds > .5:
        print('Current task progress: {:.2f}%      '.format(p),end="\r")
        n = datetime.now()
    else:
        return False

This works fine for some processes such as building depth maps:
Code: [Select]
# Dense cloud
dense = Metashape.Tasks.BuildDenseCloud()
dense.keep_depth = False
dense.point_colors = True
dense.point_confidence = False

for i in range(0,len(chunk_dict)):
    st = datetime.now()
    print('Building Depth Maps for {}'.format(doc.chunks[i].label))
    depth.apply(doc.chunks[i], progress=progress_bar_print)
    print('Task Complete                       ')
    fin = datetime.now() - st
    print('Finished {} in {} seconds\n'.format(doc.chunks[i].label, fin.seconds))
    doc.save()

Output: (here the second line keeps getting overwritten as the process proceeds)


But for other processes, such as building the dense cloud, it behaves strangely, and seems to split up into multiple processes:
Code: [Select]
for i in range(0,len(chunk_dict)):
    st = datetime.now()
    print('Building Dense Cloud for {}'.format(doc.chunks[i].label))
    dense.apply(doc.chunks[i], progress=progress_bar_print)
    print('Task Complete                       ')
    fin = datetime.now() - st
    print('Finished {} in {} seconds\n'.format(doc.chunks[i].label, fin.seconds))
    doc.save()

Output: (here the progress doesn't overwrite itself like I'd expect, it seems to add it to the existing text, making things look strange)


I'm not sure if this is a problem with my code (pretty likely) or whether it's to do with the dense cloud function itself but any help from others who have experience with this would be appreciated!

3
I've begun receiving a runtime error when trying to activate Metashape in Jupyter Labs.

Code: [Select]
import Metashape
Metashape.License().activate("xxxx-xxxx-xxxx-xxxx")

The error is:

Code: [Select]
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_13284/4131372149.py in <module>
      1 import Metashape
----> 2 Metashape.License().activate("xxxx-xxxx-xxxx-xxxx")

RuntimeError: Unexpected error occurred

The GUI version of Metashape is working fine, but I cannot access the python API at all..

4
Python and Java API / Select orthophoto at centre of polygon
« on: March 03, 2022, 05:49:18 AM »
I have generated an orthomosaic and would like to automatically select the orthophotos at the geometric centre of a polygon. Would there be a way of doing this as part of the python API?

5
Python and Java API / Run Batch on multiple Psx files
« on: October 01, 2021, 02:19:57 AM »
I have 80 .psx files, each containing multiple chunks. Instead of opening each file individually and running a batch job, is there a way to automatically do this via a python script?

I'm thinking that it would be as simple as iterating over all of the psx files in a folder and initiating the batch, but I can't seem to find the correct function in the API to do this. I can see resume batch and pause batch, but not start batch.. I'm sure I'm just missing a basic detail. 

Code: [Select]
import os, MetaShape

dir_projects = 'E:/...//' #Directory folders with pictures

foldernames = os.listdir(dir_projects)


for i in range (0,len(foldernames)):
   
   doc=PhotoScan.app.document
   
   chunk = doc.addChunk()

  # Implement Batch Here
 
   doc.save()
   
   doc.clear()

6
General / Proper protocol for Calibrate Reflectance
« on: September 04, 2021, 12:00:42 PM »
I use a Micasense Altum and the calibration panel that came with the sensor. When importing my photos Agisoft automatically places photos of the panel into the calibration images folder. Just wondering what the correct order of processes for calibration would be? Normally I'd click locate panels, then select use reflectance panels and then press ok. Problem is that Agisoft seems to search through all of the photos, even though the calibration images have already been identified. Is there a way to only locate panels and mask them for the photos that were automatically identified as calibration images?

I also seem to be getting an error where the masks for the calibration panel are incorrect (image attached).


7
Feature Requests / Better Marker Auto detection documentation
« on: August 18, 2021, 03:26:40 PM »
Having better documentation for tolerance and residuals settings within the detect markers dialogue would make things clearer. What do these settings mean? How do you optimize marker detection depending on the resolution of the imagery and size of the markers within that imagery? I don't see any specific documentation on this in the manual.

8
General / Auto detect GCP tolerance
« on: June 04, 2021, 09:01:08 AM »
I'm trying to use the Auto Detect GCPs function for Agisoft and it seems to be detecting circles much smaller than the ones I want it to detect. A photo is attached for reference, I guess it's probably not working because the circle is dirty. Nonetheless, what exactly does the tolerance and maximum residual settings do? For this detection I had maximum residual set to 5 and tolerance set to 50. I have painted the GCP so hopefully their cleanliness won't be a problem for my next flight...

It would be nice if Agisoft had a setting that put an upper and lower limit on the diameter of the GCPs in question..

Any help would be appreciated!


9
General / lining up GCPs with Multispectral orthomosaics
« on: March 26, 2021, 05:43:30 AM »
I use a phantom 4 multispectral UAV to produce orthomosaics in Metashape 1.6.4. The particular surveys I am interested were flown at 20m height with 80% front and side overlap. When importing GCPs manually, I've noticed that switching the primary channel from default to any other band causes markers to turn from green to white, and often the predicted center point moves up to 20cm from the middle of the marker that I've manually set in the default primary channel.

Does this mean that if manually importing GCPs it is necessary to place them for each individual band?  Unfortunately I haven't been able to get the auto detect option to work well with my GCPs, I think because they are not dark enough..





10
General / Optimal tolerance value for GCP auto detection
« on: December 08, 2020, 12:35:55 PM »
Hi I've made up a stencil for 12 bit circular GCPs with a 54cm outer diameter. I have a Phantom 4 pro and a Phantom 4 multispec, and  use both drones to survey agricultural field trials.

I'm wondering if anyone can tell me how to optimise the tolerance value in the auto detection menu of Metashape pro? I can't seem to find any documentation on this, but assume it's a function of the GSD?

The altitude with which we fly is generally between 20m and 40m, meaning the GSD of the P4pro falls between 0.55 and 1.1cm, whilst the P4m GSD is between 1.05 and 2.10cm.. I've attached a picture of the test GCP i made up, obviously purple isn't ideal, but Agisoft didn't seem to have troubles detecting it with the P4Pro, haven't finished aligning the multispec to test whether it works on that yet though..


11
General / Phantom 4 multispectral sunlight sensor
« on: May 20, 2020, 03:11:12 AM »
Hi, just wondering if anyone using the phantom 4 multispectral has been able to incorporate the gain settings captured from the sunlight sensor for radiometric calibration? I can't tell if metashape automatically utilises this data or not!

Pages: [1]