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
General / Re: PhotoScan Handling Different Flights
« on: February 21, 2018, 05:09:59 PM »
On both flights the altitude above ground were closely fixed despite the differences on terrain altitude (more than 200m of unevenness) due to DEM terrain tracking.

Flight #1:
Flying altitude: 60.4 m
Ground resolution: 2.62 cm/pix
Camera stations: 88
Tie points: 66,031 of 69,358
Projections: 154,798

Reprojection error RMS: 0.326 pix
Reprojection error MAX: 9.201 pix
Mean key point size: 2.43 pix
Effective overlap: 2.38

Using geotags. Xerror: 0.61m, Yerror: 0.98m Zerror: 0.55m, Total error: 1.29m

Flight #2:
Flying altitude: 86.9 m
Ground resolution: 3.77 cm/pix
Camera stations: 60
Tie points: 62,454 of 65,961
Projections: 151,253

Reprojection error RMS: 0.582 pix
Reprojection error MAX: 16.528 pix
Mean key point size: 4.05 pix
Effective overlap 2.50

Using geotags. Xerror: 1.10m, Yerror: 1.73m, Zerror: 0.93m, Total error: 2.26m

Flights 1 + 2: (processed together)
Flying altitude: 70.2 m
Ground resolution: 3.04 cm/pix
Camera stations: 149
Tie points: 130,728 of 138,234
Projections: 312,085

Reprojection error RMS: 0.483 pix
Reprojection error MAX: 16.308 pix
Mean keypoint size: 3.26 pix
Effective overlap: 2.463

Using geotags. Xerror: 0.86m, Yerror: 1.40m, Zerror: 0.91m, Total error: 1.88m

Merged chunks from individual processed flights 1 and 2
This uses the PS feature of Workflow > Merge chunks.... (merge tie points)
Flying altitude: 71.2m
Ground resolution: 3.09 cm/pix
Camera stations: 148
Tie points: 128,485 of 135,319
Projections: 306,051

Reprojection error RMS: 0.471 pix
Reprojection error MAX: 16.528 pix
Mean keypoint size: 3.23 pix
Effective overlap: 2.44

Using geotags. Xerror:0.85m, Yerror: 1.34m. Zerror: 1.58, Total error: 1.74m

Chunks aligned + merged from individually processed flights (chunks) 1 and 2
This uses the PS feature of Workflow > Align chunks... Then, Merge chunks.... (merge tie points)
Flying altitude: 71.2m
Ground resolution: 3.09 cm/pix
Camera stations: 148
Tie points: 128,485 of 135,319
Projections: 306,051

Reprojection error RMS: 0.471 pix
Reprojection error MAX: 16.528 pix
Mean keypoint size: 3.23 pix
Effective overlap: 2.44

Using geotags. Xerror:1.76m, Yerror: 1.38m. Zerror: 1.36, Total error: 2.62m

General / Re: Workflow and Errors
« on: February 15, 2018, 08:36:09 PM »
I just have updated my workflow on my last post. Open to comments...

Python and Java API / Re: Creating and Managing Multiple Chunks
« on: February 15, 2018, 07:59:48 PM »
And as for the previous comments on the reprojection error calculation, are you still observing the difference between GUI output and script?

Hello, Alexey;

I'm still observing differences between GUI and script.
Also when running the script several times I get different tie-points for the same group of photos and parameters.

See the attached image! I also attached the python code... Now when running it in PS the user view after running it shows the cameras completely messed up (as a globe).

Python and Java API / Re: Creating and Managing Multiple Chunks
« on: February 06, 2018, 01:13:53 PM »
Putting it to use... Before the alignment process.

Code: [Select]
    # enabling rolling shutter compensation
        for sensor in chunk.sensors:
            rolling_shutter = True
    except Exception as e:
        print("Error:", e)

    print("Rolling shutter compensation done!")

Python and Java API / Re: Creating and Managing Multiple Chunks
« on: February 02, 2018, 10:29:32 PM »
When you are optimizing the alignment - the relative positions of the cameras are changed, so the same projections of the markers would result in different 3D point for the marker (estimated location), so the error value (source - estimated) would be also different.

Ok! That justifies the marker's errors difference between the original and the new project.
Then would you recommend to import the markers anyway thus optimize or to start from ground zero and place them again hoping to achieve equivalent total error?

In the version 1.4 you can enable the rolling shutter compensation before the optimization:
Code: [Select]
sensor.rolling_shutter = Truethen it will be estimated automatically during the optimization. In principle, the rolling shutter property can be modified before the initial alignment, then it will be taken into account during that stage.

General / Re: Altitude or height.
« on: February 02, 2018, 10:22:53 PM »
Several solutions:

1. Fix the Z value in EXIF by adding the altitude relative to mean sea level of the point of take-off to your flight height above point of take-off (which is recorded by your DJI drone). Can be done using a custom Python script or externally.

2. Adjust the accuracy settings for ground control points and camera locations. If you enter a very large number for camera accuracy (Photoscan default value is 10m) and a low number for marker accuracy (default is 0.005m), then the optimisation and height of the model will mainly depend on the Z value of your your ground control points/markers.

Hello SAV!

Do you have this python script to change the altitude in EXIF? Does it need to install a module in PS (when thinking of using it in PS)?

Would not be good to apply the first 2 fixes (exif edit and adjusting the accuracy of photos/markers and uncheck) at the same time?

3. Uncheck all images in the reference pane so Photoscan will ignore their locations during Photo alignment (and only use GCPs).

On your workflow you recommend to uncheck the photos after placing or importing markers which is a step after photo alignment. Would you care to comment?

Best regards,

Python and Java API / Re: Creating and Managing Multiple Chunks
« on: February 02, 2018, 08:08:04 PM »
In this post - -  neither of the images containing the marker is aligned.

That's true! Just realized it now! Thanks for pointing it out.

But in your latest post I see that on both screenshots there are 9 projections for the marker, since all the corresponding images are aligned.

Cameras are aligned due to higher alignment parameters! That's why the projections are shown on the Reference Pane.

As for the difference in the errors, I think that the following situation is being observed:
- the images were aligned and optimized in the version 1.3.2, then marker projections have been exported to XML,

That's what I've done... Aligned (with a default set of parameters+ highest) and optimized

- when you import the XML back to the new project aligned with the different parameters - you load only the projections of the markers, not their 3D positions. The position of the marker in 3D is defined by it's projections on the images.

I did a step further. Maybe this is what I was missing... I optimized the cameras and the errors diminished significantly! Total error for all markes came down to 0.03m according to expectations. Nonetheless not exactly like it was before due to different alignment parameters set (?) even with the cameras unchecked.

Also I see that in the second case the georeferencing is performed both on the cameras and markers, but it seems to give considerably smaller impact (due to the difference in the accuracy for cameras and markers) then the different alignment results.
I know about the difference in accuracy for cameras and markers. I only highlighted on the second screenshot because it was, for both of cameras and markers, different from the first screenshot. Even the cameras errors were different from the original project.

I guess I was indeed missing a step after all. The optimize after uncheck the cameras and importing the markers.

By the way, talking about optimizing. I have this data set made with Phantom 4 that I'm aware that it has a rolling shutter effect becaused it has an electronic shutter. I was reading here ( that it might have a huge effect. I wonder how to activate it through Python coding?

Code: [Select]
    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=False,
                                                         fit_p1=True, fit_p2=True, fit_p3=False,

I saw in the 1.4.0 API:
Enable rolling shutter compensation.

Python and Java API / Re: Creating and Managing Multiple Chunks
« on: February 02, 2018, 06:39:12 PM »
The number in the Projections column in the Reference pane shows the number of projections on the aligned photos. According to the screenshot is seems that all nine photos are not aligned.


On the last screenshot, from my last post, I filtered the photos on Photos Pane to show only the ones related to the marker #113 (Filter photos by selection...). So in the Photos Pane it shows 9 photos aligned with its valid and pinned markers and projections from marker #113.

But in the Reference Pane the number of projections for marker #113 is 0 (despite having in the photos pane the 9 aligned with its projections). This happens not only for #113 but also for the rest of the markers.

This was aligned with 10,000 keypoints / 4,000 tie-point limite / lowest (just to go fast and see if the markers were correctly imported).

To be clear about it... I added another 2 screenshots comparing the project made with 1.3.2 and a new one:
1. the first shows the project that was saved on 1.3.2 which opened normally on 1.4. With the reference pane showing the errors, projections etc as it was saved last time. That was aligned with Highest / 80,000 keypoints / 8,000 tie-points.

2. the second shows a new project created, with the same photos, same steps (add chunk, add photos, convert coordinates, align photos, add markers -- exported from the opened 1.3.2 project). The alignment with HIghest / 40,000 / 4,000. The screenshot shows the difference in errors.

Considering that in the 1.3.2 PS version in different projects, with different alignment parameters when importing the markes XML all the results were the same! Always with the values of the 1. first screenshot.

A) Are the differences caused by different alignment parameters?
B) Or are they caused by the XML format from 1.3.2 to 1.4.0?
C) Or are the differences caused by different PS versions?
D) Am I missing something?

Looking forward for the reply!

Python and Java API / Re: Creating and Managing Multiple Chunks
« on: February 02, 2018, 04:23:08 PM »
That might be the reason of the problem. As a workaround, you can import the XML to the 1.3.x version project, then open it in the version 1.4 and export XML in new format.

As always, thank you for the reply Alexey!
I've opened a saved project in 1.3x on the 1.4 version and exported markers through the File > Export > Export Markers...

And then I tested it on a new project: added photos, converted to markers coordinate system and then went to import File > Import > Import Markers...
It opened all of the markers! Great! But there are some problems... The error (m), error (pix) and projections are quite different from what's is shown in the previous version of PS (1.3.x). Look at the attached image!


Python and Java API / Re: Creating and Managing Multiple Chunks
« on: February 02, 2018, 03:13:35 PM »
Hello Alexey!

It was created with version 1.3.2 and now I'm using 1.4.0 b5076.x64.

Python and Java API / Re: Creating and Managing Multiple Chunks
« on: February 02, 2018, 01:14:55 PM »
When importing markers XML file into PhotoScan I get this error:

Error: Missing sensor id

Have I lost the file and have to start over?

Python and Java API / Re: Creating and Managing Multiple Chunks
« on: January 13, 2018, 06:25:01 AM »
Any comments on the matter presented above? ?

Python and Java API / Re: Creating and Managing Multiple Chunks
« on: December 20, 2017, 04:22:36 PM »
For reprojection error, got the following code from:
Code: [Select]
        # open empty lists to get exported when done
        list_npoints = []
        list_index = []
        list_x = []
        list_y = []
        list_z = []
        list_error = []

        for i in range_chunks:  # for every chunk in workspace
        # number of tie-points (sparse cloud) for each chunk
            chunk = doc.chunks[i]
            point_cloud = chunk.point_cloud
            points = point_cloud.points
            npoints = len(points)

        # Reprojection error
            M = chunk.transform.matrix
            crs =
            projections = point_cloud.projections
            tracks = point_cloud.tracks

            points_coords = {}
            points_errors = {}

            for photo in chunk.cameras:
                if not photo.transform:

                T = photo.transform.inv()
                calib = photo.sensor.calibration

                point_index = 0
                for proj in projections[photo]:
                    track_id = proj.track_id
                    while point_index < npoints and points[point_index].track_id < track_id:
                        point_index += 1
                    if point_index < npoints and points[point_index].track_id == track_id:
                        if not points[point_index].valid:

                        coord = T * points[point_index].coord
                        coord.size = 3
                        dist = calib.error(coord, proj.coord).norm() ** 2
                        v = M * points[point_index].coord
                        v.size = 3

                        if point_index in points_errors.keys():
                            point_index = int(point_index)
                            points_errors[point_index].x += dist
                            points_errors[point_index].y += 1
                            points_errors[point_index] = PS.Vector([dist, 1])


                for point_index in range(npoints):
                    if not points[point_index].valid:

                        w = M * points[point_index].coord
                        w.size = 3
                        X, Y, Z =
                        X, Y, Z, w = M * points[point_index].coord

            error = math.sqrt(points_errors[point_index].x / points_errors[point_index].y)


For chunk test gives error = 1.6664504017324355
And testing again, a different value = 1.2779145775553513
Actually, everytime I run the code I get a different value for the "error".

In the Show Info pane comes as RMS = 0.145085 (4.41861 pix) and Max = 0.437942 (54.9417 pix)

What is wrong? Or the code returns in different format?

General / Re: Work Flow for GCP
« on: December 20, 2017, 02:19:11 PM »
[...] future lies in UAVs that have PPK/RTK capabilities which completely eliminates the need of ground control points and instead uses the highly accurate location of each image ('air control points'). This means that you will then have as many 'air control points' as you have images, which is never the case when using ground control points.

As a reminder, if you plan to deliver your product/research with afered error then even with a drone capable of RTK/PPK surveys you would need some GCP to use as check points to validate the precision of the flight. Unless you present a whole study comparing the accuracies of both survey methods on different survey scenarios (slopes, flat terrain, urban areas etc.). Even so you wouldn't be able to prove that in some particular flights they have low errors and high accuracy out of the RTK/PPK system boarded in the drone.

Am I correct? I mean... despite the promising future of RTK/PPK on drones it still doesn't eliminate the need of GCP for some uses.

Python and Java API / Re: Creating and Managing Multiple Chunks
« on: December 18, 2017, 11:22:08 PM »
Now I'm stuck with exporting the Show Info for every chunk on a single txt file:

Code: [Select]
    # path to write file
    path_report = path_export
    path_report += "\Showinfo_chunks_{}.txt".format(prjrun)
    print("\nCreating export file and analyzing chunks...\n")
    # open file
        # getting chunk labels
        lis_label = []
        for i in range_chunks:

        # returning aligned cameras for each chunk
        list_align = []
        for i in range_chunks:
            chunk = doc.chunks[i]
            for cameras in chunk.cameras:
                if camera.transform:
                    align_cams = len(chunk.cameras)

        # returning total cameras for each chunk
        list_cams = []
        for i in range_chunks:
            chunk = doc.chunks[i]
            cam_total = len(chunk.cameras)

        # alignment time for each chunk
        list_align_dur = []
        for i in range_chunks:
            chunk = doc.chunks[i]
            align_dur = chunk.point_cloud.meta["align/duration"]

        # matching time for each chunk
        list_match_dur = []
        for i in range_chunks:
            chunk = doc.chunks[i]
            match_dur = chunk.point_cloud.meta["match/duration"]

        # list comprehension to avoid None values (substitutes for 0)
        # and to convert its strings into float to sum values
        align_time = [0 if i is None else i for i in list_align_dur]
        align_time = [float(i) for i in align_time]  # converting to float
        match_time = [0 if i is None else i for i in list_match_dur]
        match_time = [float(i) for i in match_time]  # convert to float

        # sum lists to get total time for each chunk
        total_time = [sum(i) for i in zip(align_time, match_time)]

        # number of tie-points (sparse cloud) for each chunk
        list_sp_points = []
        for i in range_chunks:
            chunk = doc.chunks[i]
            point_cloud = chunk.point_cloud
            points = point_cloud.points
            sp_points = len(points)

    except Exception:
        print("Error: unable to get data from chunks!")

        with open(path_report, "wt", newline="") as showinfo:
            lists = [lis_label, list_align, list_cams, align_time,
                     match_time, total_time, list_sp_points]
            for i in zip(*lists):
        print("Successfully generated and exported to TXT report!")
    except Exception:

UPDATE: managed to get:
- number of aligned cameras
- number of cameras
- alignment time
- matching time
- align + match = total time
- sparse cloud number of points

I'm still stuck with:
- RMS reprojection error
- Max reprojection error
- Mean key point size
- effective overlap

Pages: 1 2 [3] 4 5