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

Pages: 1 2 3 [4] 5
46
Python and Java API / Re: Creating and Managing Multiple Chunks
« on: December 18, 2017, 07:44:54 PM »
I made some tests using geotagged photos (from the drone's onboard GPS system) regarding preselection.

With these parameters:
High Accuracy (keeps 100% of each image, not upscales or dowscales)
Total cameras (photos): 155 geotagged
Key points = 10,000 (not that much to optimize time in the processing)
Tie points = 0

-----------------------------------------------------
No preselection
-----------------------------------------------------
148 aligned cameras of 155
Points 50,476 of 55,628

RMS reprojection error: 0.115293 (0.602434 pix)
Max reprojection error: 0.348031 (19.6074 pix)
Mean key point size: 4.19666 pix

Effective overlap 2.58956

Match time: 00:23:56
Align time: 00:01:46
Total time: 00:25:42 -- compatible time with the Reference preselection only

-----------------------------------------------------
Generic preselection only
-----------------------------------------------------
148 of 155 aligned cameras
Points 50,780 of a total of 54,274 possible

RMS reprojection error: 0.115442 (0.60689 pix)
Max reprojection error: 0.348413 (19.5868 pix)
Mean key point size: 4.19952 pix

Effective overlap: 2.59327

Matching time: 00:37:49
Alignment time: 00:01:49
Total time: 00:39:38

-----------------------------------------------------
Reference preselection only
-----------------------------------------------------
148 of 155 aligned
Points 50,670 of 54,789

RMS reprojection error: 0.115329 (0.610028 pix)
Max reprojection error: 0.348384 (20.2262 pix)
Mean key point size: 4.19839 pix

Effective overlap: 2.59209

Matching time: 00:23:48
Alignment time: 00:01:49
Total time: 00:25:37

-----------------------------------------------------
Generic + Reference both selected!
-----------------------------------------------------
148 of 155 aligned
Points 50,790 of 54,269

RMS reprojection error: 0.115142 (0.605183 pix)
Max reprojection error: 0.347645 (19.5746 pix)
Mean key point size: 4.19816 pix

Effective overlap: 2.59146

Matching time: 00:18:39
Alignment time: 00:02:07
Total time: 00:20:46

That justifies the code to use generic + reference if there's geotagged photos. And if not, no preselection.

47
Python and Java API / Re: Creating and Managing Multiple Chunks
« on: December 18, 2017, 04:31:09 PM »
Based on the information collected in another forum post by Alexey for the Exif tags: (sorry didn't get the address)
Quote
PhotoScan reads the following EXIF tags:
FocalLength - that is put to the corresponding field of the Camera Calibration window. Whereas for the Sensor Pixel Size uses either a pair of the following tags:
FocalPlaneXResolution and FocalPlaneYResolution, or if they are missing, uses the next one: FocalLengthIn35mmFilm.
The parameters mentioned above are used to define the initial values for the autocalibration procedure.

Also GPS tags are read:
GPSAltitude, GPSLatitude and GPSLongitude.

Made the following code to implement preselection based on photo's Exif information existence. And the from the PhotoScan 1.3 manual:

Quote
Pair preselection
The alignment process of large photo sets can take a long time.
A significant portion of this time period is spent on matching of detected features across the photos. Image pair preselection option may speed up this process due to selection of a subset of image pairs to be matched.

--> In the Generic preselection mode the overlapping pairs of photos are selected by matching photos using lower accuracy setting first.

--> In the Reference preselection mode the overlapping pairs of photos are selected based on the measured camera locations (if present).
[...]


Code: [Select]
    # check if images in every chunk added have Exif reference to use
    # Reference Preselection as a plus to optimize image alignment
    for i in range_chunks:
        camera = chunk.cameras[i]
        if camera.photo.meta["Exif/GPSLatitude"]:  # check for Lat info on Exif
            # generic preselection [True, False]
            gnr_pslc = True
            # reference prelection [True, False]
            ref_pslc = True
        else:  # if there's no exif information then use No Preselection enabled
            gnr_pslc = False
            ref_pslc = False

The code was based on a test that's shown bellow for the best performance regarding time and errors.

48
General / Re: PhotoScan Handling Different Flights
« on: December 16, 2017, 03:23:15 AM »
Thank you for the reply SAV!

Once I process all and both flights I'll have a better picture of this and I'll post it here.

49
General / PhotoScan Handling Different Flights
« on: December 15, 2017, 03:29:00 AM »
Hello!

I would like to know how PhotoScan handles two flights with different altitude above ground.  I have two flights with good overlap between them as I'm able to process them together. I also have GCP for the imaged area but they are unable to be used in separate processing (have good coverage for the whole area but not for the individual flight's coverage). So what PhotoScan does:

1. In terms of GSD as it depends on the altitude when processing it all together?
2. When generating reports for the whole project (including both flights) it outputs a mean value for all?

How can I assess if their overlap or different GSDs contributes somehow to the error/accuracy for the point cloud?
Any comments, suggestions, ideas, experiences?

Thanks!
L.Fernando

50
Python and Java API / Re: Creating and Managing Multiple Chunks
« on: December 12, 2017, 06:22:04 PM »
Thank you, Alexey! That works now!

And that's my code:

Code: [Select]
    try:
        nchunks = (len(doc.chunks))  # returns number of chunks
        range_chunks = range(0, nchunks)  # gives range of a number of chunks
        for i in range_chunks:  # adding the labels to each chunk
            lbl_formatting = "Chunk: {} / 0".format(int(list_labels[i] / 1000))
            doc.chunks[i].label = lbl_formatting
        print("Chunk labels modified!")
    except Exception as exc2:
        print("Error:{}".format(exc2))

UPDATE: added the code for labeling every chunk in workspace based on a list

51
Python and Java API / Re: Creating and Managing Multiple Chunks
« on: December 12, 2017, 02:21:14 PM »
doc = PhotoScan.app.document
for i in range(len(doc.chunks)):
    doc.chunks.label =  "Chunk: " + str(int(list_labels/1000)) + " / 0"

The code gives this error: "Error: 'list' object has no attribute 'label'"


52
Python and Java API / Re: Creating and Managing Multiple Chunks
« on: December 11, 2017, 05:42:06 PM »
Now I'm getting trouble with assigning each chunk a new label based on a list:
Code: [Select]
    for chunk in doc.chunks:
        for values in range(len(list_labels)):
            for label in chunk.label:
                labels = "Chunk: " + str(int(values / 1000)) + " / 0"
            chunk.label = labels
Any help would be appreciated!

53
Python and Java API / Creating and Managing Multiple Chunks
« on: December 11, 2017, 03:46:28 PM »
Hello!

I'm finding difficulty to add a large number of chunks in loop.
 
Code: [Select]
    from_range = 1000
    to_range = 351000
    interval = 1000

    list_labels = list(range(from_range, to_range, interval))
    lenght = len(list_labels)
    print("Will be created {} chunks for this process".format(lenght))

    chunk = PS.app.document.chunks
    for chunk in range(lenght):
        doc.addChunk()
 
UPDATED: managed to create multiple chunks...

54
Python and Java API / Re: Coordinate System Problem
« on: December 07, 2017, 01:45:43 PM »
Eva, try this code:

Code: [Select]
   print('Converting project to GCP coordinate system')
   chunk = doc.chunk
   #new coordinate system: substitute for the EPSG code of interest
   #n_crs = PhotoScan.CoordinateSystem("EPSG::31983") #enable if you want to set without prompt drop-down menu
   n_crs = PhotoScan.app.getCoordinateSystem("Select Coordinate System", doc.chunk.crs) #enable if you want a prompt to choose coordinate system from drop-down menu
   for camera in chunk.cameras:
      camera.reference.location = PhotoScan.CoordinateSystem.transform(camera.reference.location, chunk.crs, n_crs)

   #Update
   PhotoScan.app.update()

For me this works. Don't know if it will with your workflow.

55
Thank you Alexey! I'll try this try-except convention instead. Updated the code above to insert it.

What about this (got from the Python API):


Quote
importMarkers(path)
   Import markers.
   Parameters path (string) – Path to the file


Code: [Select]
try:
    chunk.importMarkers(path)
except:
    print("something happened")

I read on the post I referred to that loadReference() is for the import function from the Reference Pane not from Tools > Import > Import Markers... Actually that is what you've posted there.

http://www.agisoft.com/forum/index.php?topic=5073.msg25218
UPDATE: the code found in the above post is outdated (v1.2) as Alexey mentions bellow.

Anyway the above code with the loadReference() function gives the except error message. It won't import the *.xml file for markers.

I also have found an old version code to import markers as stated on the following post:
http://www.agisoft.com/forum/index.php?topic=3844.0

56
Thank you Alexey! So it would look like the below code?

UPDATE: updated the code without the boolean output using the suggestion from Alexey's below comment to use try-except convention
Code: [Select]
   import_markersXML = PhotoScan.app.getOpenFileName ("Add your PhotoScan Markers XML file:")
      if not import_markersXML:
             print("Script aborted")
             return 0   

   chunk = PhotoScan.app.document.chunk

try:
    chunk.loadReference(import_markersXML, format=PhotoScan.ReferenceFormatXML)
except:
    print("something happened")
 
   #update
   chunk.updateTransform()
   PhotoScan.app.update()


57
Found out here!

http://www.agisoft.com/forum/index.php?topic=5073.msg25218
UPDATE: the code found in the above post is outdated (v1.2) as Alexey mentions bellow.

58
Python and Java API / Re: Coordinate System Problem
« on: December 06, 2017, 08:10:15 PM »
Dear everyone,

I have a realy problem with my coordinate of my projet in my python script  :'(.
My goal is to precise the coordinate of my GCP file.
How to specify the coordinate system of the GCP file ?

Or can you give me a link where there is informations about coordinate system of a CSV file ?

My script is in attached file,

In advance, thanks for your help,
Have a nice end of week,

Eva

Eva, I did the following to solve my coordinate system problem.

Code: [Select]
   print('Converting project to GCP coordinate system')
   chunk = doc.chunk
   #new coordinate system: substitute for the EPSG code of interest
   n_crs = PhotoScan.CoordinateSystem("EPSG::31983")
   for camera in chunk.cameras:
      camera.reference.location = PhotoScan.CoordinateSystem.transform(camera.reference.location, chunk.crs, n_crs)

Hope it helps despite not actually being done by selecting in a drop-down menu. And the best guy to help you out is Alexey.

59
Hello Vincent,

Currently there's no Import Markers function equivalent in Python API, so this feature is to be added in one of the next updates.

Any news on this matter? I have an Agisoft Markers file (*.xml) I would like to import via Python scripting.

60
General / Re: Workflow and Errors
« on: December 04, 2017, 04:58:48 PM »
One of my previous posts which explains an 'optimised processing workflow" might be quite useful for you:
http://www.agisoft.com/forum/index.php?topic=7851.msg37494#msg37494

Thank you for your reply SAV! Really appreciated!
So let me update my workflow with your post recommendations (seen above):

1. Add chunk;

2. Add photography (outliers already removed -- too blurred, from take off and landing);

3. Convert photos coordinates (WGS84) to the GCP coordinate system (my case SIRGAS 2000;
  3.1 Some ways to improve the GPS from photos (http://www.agisoft.com/forum/index.php?topic=4986.msg40010#msg40010)

4. Estimate image quality and disable all photos bellow 0.70;

5. When using python you can compensate for rolling shutter before alignment (http://www.agisoft.com/forum/index.php?topic=8124.msg39976#msg39976)

6. Photos alignment (highest quality, adaptative camera model fitting, generic + reference pair preselection);

7. Import markers (*xml Agisoft markers previously done with the photos) - that gives the markers photo's positioning;
  7.1 Can be done locating the markers in the photos (filter by markers);

8. Update, transform;

9. Uncheck the photos in the reference pane (in case of good GCP coverage) and uncheck some markers for check point error along with control points error;

10. Sparse point cloud filtering (Gradual selection > Reprojection errors [bellow 1.0] - Reconstruction Uncertainty);

11. Adjust bounding box to the sparse cloud;

12. Compensate rolling shutter + Optimize camera alignment;

13. Build dense cloud (ultra high quality + depth filtering disabled);



Regarding photos checked/uncheck in reference pane. If you have chosen appropriate accuracy settings for your camera, then you can leave them checked. PhotoScan's default value for camera accuracy is 10m. If you used a UAV with RTK/PPK capabilities that can measure camera locations at cm accuracy, then you would adjust these settings.

My photography is based on the DJI Phantom 4. So I guess the accuracy of 10m is ok. Also considering what you said about about the DJI's vertical accuracy. RTK/PPK not enabled just PPK GCP for me.

If you have a series of highly accurate ground control points (e.g., measured by RTK GPS, cm-accuracy), then you can probably uncheck all photos in the reference pane because they won't add much to the general accuracy because their locations are not very well constrained due to the relatively inaccurate GPS from your drone (e.g., from a DJI Inspire 1/2 or Phantom 4). Also note that while X/Y coordinates of DJI drones are quite accurate (around 1-4m), the Z accuracy can be quite far off due to the way it is recorded by the drone (altitude above point of take off, not absolute altitude above MSL).
Good to know! Another point on unchecking all cameras and leaving just the GCPs.

To sum it up. All things checked in the reference pane (markers, photos, scale bars) are used by Photoscan to optimize the geolocation/position and scale of the sparse point cloud (tie points) and all associated files 'downstream' such as the dense point cloud, mesh, orthomosaic and DEM.

So it's not a good thing if you have good quality GCP (accuracy and geographic distribution) to leave the photos checked as I guessed.

Thank you SAV!

Pages: 1 2 3 [4] 5