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

Pages: [1] 2 3
General / Re: Waving a white flag
« on: June 10, 2022, 01:20:45 PM »
Refine markers does indeed work for this workflow, white flags turn blue as an image is loaded after the initial points are manually defined, thanks.

Not sure what you mean about the names not being important, please clarify. I need to match the names to update the coordinates from the GCP file. (That's a minor issue, as you can edit the GCP csv to match the labels, i.e. "point 1".)
In the import reference dialogue there is a checkbox that "ignore labels", try it and you will understand. Metashape manages to match markers and ground points on its own (obviously it can fail if points distribution is too much regular making several matches plausible)
Also you may need to see if by enabling "refine markers" under tools menu, you get the boost you want for your workflow. (also needs some user care, that is why it is not enabled by default)
Best regards,

José Martínez
Geobit & Accupixel
Metashape traning

General / Re: Waving a white flag
« on: June 10, 2022, 12:55:52 PM »
Exactly what I was looking for, thanks Alexey

Hello Martin,

The following code should create marker projections (blue flags) on the images, based on the marker 3D location, which can be defined either by the reference coordinates only, or by other manually placed projections:

Code: [Select]
import Metashape
chunk = #active chunk
for marker in chunk.markers:
if not marker.position:
point = marker.position
for camera in [c for c in chunk.cameras if c.transform and c.type == Metashape.Camera.Type.Regular]:
if camera in marker.projections.keys():
continue #skip existing projections              
x, y = camera.project(point)
if not(x) or not(y):
if (0 <= x < camera.sensor.width) and (0 <= y < camera.sensor.height):
marker.projections[camera] = Metashape.Marker.Projection(Metashape.Vector([x,y]), False)
print("Script finished")

Is it what you are looking for?

General / Re: Waving a white flag
« on: June 09, 2022, 12:41:49 PM »
Thanks for the response

To clarify, green marker=user placed, blue marker=system placed, both used in processing, white marker=system placed but not used in processing, that's understood. I also understand I need to check all blue flags, as mentioned in the OP.

Correct me if I'm wrong, Add Marker adds a marker and works out the projections on the other images, Place marker adds it in 2D on that image only.

Not sure what you mean about the names not being important, please clarify. I need to match the names to update the coordinates from the GCP file. (That's a minor issue, as you can edit the GCP csv to match the labels, i.e. "point 1".)

At the moment you have two workflows as I see it, and my question is if they can be merged, as both are cumbersome in their own way.

WF1 - using add markers: Add marker by right clicking on each marker once, move a few blue flags, check the others and leave them if good enough. Then load GCP file with matching names to update the coordinates of the markers to the GCP. Issues are that you need to find each GCP, not always easy on e.g. glacial rubble.

WF2 - using a GCP file: Load GCP file, some white flags pop up, if you fix about 4 in place and Update Transform all other GCP are roughly located, which is better in terms of finding them. After manually updating a couple of markers each the others show up in the right place, but need to be clicked on to turn green. With several markers on several images each that's a lot of clicking.

So my question is, can you use the gcp workflow and get blue flags, best of both worlds.

This is not a big issue, but I'm trying to find the most efficient way of marking GCP, just tired of clicking markers, either way.

General / Waving a white flag
« on: June 08, 2022, 05:52:10 PM »

 When adding markers, if a markers are placed you get an automatically aligned blue flag on the other images it appears on. They still need to be checked, but are often ok, making the process less manually intensive.

 When loading a GCP file and placing a marker the flags never turn blue, they are white, and not used in processing. You need to click on every white flag to turn it green. Now, you can add points, rename them to match your markers, and then load the coordinates later, but that's cumbersome. Is there a way to turn the white flags blue, mirroring the add points workflow? I ask this before I spend time coding some python to turn flags green.


TBH, I can't remember why it is False. This script develops as and when I need it, SfM is only a small part of what I do. I'll look into it when I next edit it, but you seem to have the skill to develop it further for your needs.

Thanks Paul, I'll look at your version and perhaps merge them.

The maintained version is on Github:

Hi Luiz,

 Thanks for your code. Not been able to do much on this lately, and to go through your code properly, but have updated to accommodate Metashape and some minor tweaks. Thought I'd share until I have more time.


Hi Luiz,

 thanks for commenting. PhotoScan doesn't seem to update the points until the model is optimised.

 The approach in your second post works, but only until the session is shut down. Tracks would allow you to re-open the document later and carry on. But tracks give all points, what I'm really after is the valid points after alignment. I might not change to tracks because of this. I've made a few changes to the code and am testing, will possibly upload a newer version soon-ish.


Currently needs to be run as one session, valid ties not accessible after
    gradual selection. To be fixed in next version using tracks.
    len(chunk.point_cloud.points) - valid ties
    len(chunk.point_cloud.tracks) - all ties

With gradual selection:
    After alignment the model is optimised and then a gradual selection is run.
    After the align process all tie points have errors attached
            to them. The values used are a matter of debate.
            Rec Uncert is normally set to 10 and run only once. If
            the value of 10 selects more than 50% of the tie points the value
            self-adjusts to less than 50%.
            Proj acc is set to start at 2 and self adjusts so less
            than 50% of the tie points left after Rec Uncert are selected.
            For Reprojection Error the aim is to select up to a set percentage
            (default 80) of the initial tie points. The value used is self
            selecting. The selection process is in steps of 10% and optimisation
            is run after each step.
            Values used are saved in the log file.
Without gradual selection:
    After alignment the model is optimised once.

3D Model/Geo: Geo basically is anything where the photos have coordinates or you are using Ground Control Points(GCP). If you have photos of objects without that info use 3D Model

Set-up workflow:
1. Set up your chunk(s)
    import photos
    name chunks (optional - helps in sorting the output)
    save a copy of the PS Doc

Custom workflow:
2. (Geo) Set reference system for each chunk
3. Load script
    chose output folder
    chose file prefix (this gets added to each output file - helps if trying different settings)
4. Under "Change Values" select "Get Current Parameter info" (check console window for output)
    check image quality threshold
    check filtering (options: Mild (default), Moderate, Aggressive, none)
    (Geo) check export CRS (in case you want the output to be different from the CRS of the camera/GCP)

No GCP or checking alignment - runs whole process and exports:
5a. (Geo) Choose "Custom":"Run - Geo" (with or without gradual selection)
5b. (3D Model) Choose "Custom":"Run - 3D Model" (with or without gradual selection)

With GCP or scales or if wanting to check alignment:
5. Choose "Custom":"Align only" (with or without gradual selection)
6. Set up GCP for each chunk or set scale
7. Check alignment
8a. (Geo) Choose "Custom":"Run all after alignment - Geo" (with or without gradual selection)
8b. (3D Model) Choose "Custom":"Run all after alignment - 3D Model" (with or without gradual selection)

Files generated depend on method used (3D or Geo) and input photos.

You can run methods individually as well after opening the script, in console type "ps_doc." and then hit "TAB" to see the options.

Python and Java API / Re: How do you access total tie point number in Python
« on: September 01, 2018, 04:06:06 PM »
Thanks Alexey!


needs to run as one session though, i.e if you've run the script keep the session open for grad sel process

General / Re: Your opinion on USGS Agisoft Processing Workflow
« on: August 31, 2018, 05:52:12 PM »
I understand commercial implications, it's a shame though as sharing our settings and experiences helps the community overall. We'll slog on, cheers.

Spotted a mistake, gradual selection currently only works for single chunks...

Python and Java API / How do you access total tie point number in Python
« on: August 31, 2018, 03:42:35 PM »

 In the tie point information PS gives you y of x tie points. You can get the active number of tie points (y) by using len([i for i in chunk.point_cloud.points]). How do I access x, i.e the original number of tie points in Python, I can't find it in the reference doc?


General / Re: Your opinion on USGS Agisoft Processing Workflow
« on: August 31, 2018, 11:58:48 AM »

Funny, seeing how I followed this workflow and got worse results than following our own developed workflow.

I suppose it all depends on your data set.

Could you outline your workflow and describe your type of data, out of interest?

Pages: [1] 2 3