Agisoft Metashape

Agisoft Metashape => General => Topic started by: Pkroks on February 19, 2018, 04:47:04 PM

Title: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Pkroks on February 19, 2018, 04:47:04 PM
Hi Everyone,
I have used Agisoft at work for some time now. I am currently doing a 1800 ha map of a farm. The client requires DSM and Ortho and then contours. Accuracy was not a priority as he wants a general overview of the land for planning purposes.

Drone was flown at 240m AGL. Sony NEX5T with 16mm lens. GSD was approx 7cm/px.  80% overlap, 70% sidelap. Approximately 4600 images are used.

I am constructing the Ortho and DSM but am experiencing a problem. There are these ridges appearing in the DSM at it appears to be where some flights over lap.

I have gone through processed 3 times now.

First time I didn't use any manual tie points and markers. I saw the ridges and so thought immediately to place manual tie points.

Second time processing I used the manual tie points - this corrected the initial ridges only to discover other ridges appeared elsewhere on the model. I used approximately 45 markers across the area.

Third time processing - I aligned all the flights in chunks, and then merged the chunks and aligned. Still have the same issue.

I am currently redoing the alignment on High as we speak and will be doing medium dense cloud with no depth filtering. including even more manual tie points and markers.

Please if anyone can advise on how to fix these ridge lines that would be great.

The settings I am using are:
Align - High,
Dense cloud - medium,
depth filtering - mild

My system is -
intel i7 8700k at 3.7ghz
nvidia gtx 1070, 8gb
32gb ddr4 ram
250gb samsung 850 evo SSD
1tb SSHD seagate hybrid drive


I have even looked at purchasing one month license for pix4d to see if that will improve the output.
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Alexey Pasumansky on February 19, 2018, 05:02:55 PM
Hello Pkroks,

Such artifacts usually indicate that there are alignment issues for the related area.

Can you provide the report for this project?
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Pkroks on February 19, 2018, 05:16:13 PM
Thanks for the quick reply. I've attached the report for the processed version using markers.

What I don't understand is why the ridges shifted after using markers - the markers corrected the first ridges but now these are new ones.

thanks

edit: The report was too large to upload here so I placed it on dropbox. Here is the link: https://www.dropbox.com/s/fltwc69471kd5zh/report1.pdf?dl=0
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Alexey Pasumansky on February 19, 2018, 07:32:24 PM
Hello Pkroks,

Is it possible to send the project re-saved in PSZ format with only alignment results (no dense cloud, DEM, orthomoisaic) to support@agisoft.com, so that we could try to realign the set based on the existing matching points using different combinations of settings.

Reprojection error looks quite high in this project (maybe it is caused by optiization, basing on the incorrect markers) - usually mean value is about 1 pix, whereas here it is 5.5 pix.
The residuals pattern on the calibration pages also looks strange - I would rather not expect large residuals on Sony NEX cameras.
And a few manual markers demonstrate quite large reprojection errors: point 27, point 28, point 29 and point 30. Usually such large errors indicate that either some of their projections are not placed correctly, or the cameras where the projections are present are incorrectly aligned.
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Pkroks on February 19, 2018, 07:36:10 PM
Hi. You would like me to upload the project images to Dropbox?

I am currently on the middle of mozambique near malawi with very limited internet so this could be a problem.

Any chance I could do it without having to do that?
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Alexey Pasumansky on February 19, 2018, 07:48:35 PM
Hello Pkroks,

Project file with only alignment results should have considerably smaller size.

Otherwise I can suggest the following:
- make sure that the following settings values are set in the Reference pane settings dialog: marker accuracy (m) = 0.005 (or similar according to the measurement device precision), marker accuracy (pix) = 0.1 pix, tie point accuracy (pix) = 1 pix,
- export markers to XML file,
- remove markers from the project,
- reset camera alignment for all the cameras,
- execute the following command from the Console pane (equal to Align Selected, but without adaptive camera model fitting):
Code: [Select]
PhotoScan.app.document.chunk.alignCameras(adaptive_fitting = False)- then optimize camera alignment,
- then import only GCPs and optimize the alignment again.
Then check, if any surface reconstruction artifacts are observed, for example, by generating lower quality dense cloud.

And can you also please check, if the surface reconstruction issues are related to the areas of the flights overlap (as it seems that multiple flights are processed at once, and possible reason of the problem may be related to the difference in flight conditions)?
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Paulo on February 19, 2018, 07:58:04 PM
Hello,

i would say there seems to be a big problem with one of the chunk`s camera calibration. All other chunks have a calibrated F of around 3300 pix which corresponds to around 16 mm given the sensor pixel sixe of 4.89 um.

However the chunk with 296 images has a calibrated focal of some 5500 pixel which corresponds to some 26 mm focal.

If this is fixed lens then there is a big problem there. Reflected also in th hi image residuals...

Hope this helps,

Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Pkroks on February 19, 2018, 08:03:10 PM
Hi Alexey,

Okay I can try to do that. I have deleted the dense cloud and the dem, ortho and am saving the psx file now.

I believe the issues would possibly be due to flights conducted at different times of day which are struggling to align. Multiple flights the shadow and time of day would affect lighting conditions but I have never had a problem before.

The only reason we used markers was to try to improve the model, the markers accuracy is probably a few meters as best because we used a Reach RS to determine their locations, but I was aware that they wouldn't be accurate down to millimeters. As I said accuracy isn't exactly of utmost importance here but having a massive 6-20m ridge through the farm definitely doesn't work.
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: SAV on February 20, 2018, 02:12:22 AM
Hi Pkroks,

According to your processing report, image overlap is definitely not an issue. But have you checked the image quality? Maybe there are a lot of blurry images that a) lead to inconsistent camera calibration results, b) high reprojection errors and c) might result in the artefacts as shown in your DEM. Especially for fixed wing UAVs image blur can be an issue due to the higher flight speed and the lack of a gimbal that stabilizes the camera. Additionally, the shutter speed needs to be adjusted based on your horizontal speed, distance to the object and lens that was used (focal length) to mitigate motion blur.

Try to estimate the image quality for all your pictures by right clicking onto one of the pictures in the photo pane, then choose ESTIMATE IMAGE QUALITY for ALL CAMERAS. Generally you would want to have an image quality higher than 0.7.

Regarding your marker accuracy. If you used a REACH RS in PPK mode to survey your ground control points, then you should be able to achieve cm-accuracy (ca 2-5cm) if post  post processing was done correctly.

Regards,
SAV



Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Pkroks on February 20, 2018, 07:25:31 AM
Hi SAV ,

Thanks for the reply. I have estimates the image quality. On average they are about 0.85.. I did a quick sample and saw one at 0.65 out of maybe 100. The rest were above 0.7

If this was the case then to correct the issue I would have to refly the area at a lower altitude to improve the gsd and image quality? Already my camera settings were shutter priority and the shutter varied from 1/1600 to 1/2000. Never went below 1/1250.iso was automatic.

Even so refly the entire area would be an issue for me as it's rainy season here. What should have been about 3 days doing 6-8 flights per day ended up at 6 days flying mostly mornings only due to weather changes in the afternoon so I have to get back to Zambia for another project now.

We are using a tuffwing here.

The reach rs and post processing can almost guarantee was inaccurate as it is the first time we have used it. Literally bought it about two weeks ago and it is extremely difficult as we don't have any rinex logs or stations nearby. There is no cors  network or vrs around us. We planned to use known trig beacons as the base coordinate however the nearest one to the project is 14km away and access is extremely limited.. Being portuguese, and being a Foreigner here it's not easy to just walk into an agrivuotural research facility to use their trig beacon. Wait on approvals

We considered ppp to obtain a more accurate base station to work with but again the tutorials we have found are not the best so we have been tearing our hair out. Perhaps you can point us to an article or two which can assist
Thanks
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: SAV on February 20, 2018, 08:10:08 AM
Hi Pkroks,

If the image quality was a problem, then you would have to acquire new imagery (aka re-fly the survey).

You can filter/sort your photos based on quality. With the high image overlap you are dealing with, you can probably disable all cameras with an image quality below 0.7 to improve your reconstruction accuracy.
 
By flying at lower altitude you would actually increase the motion blur issues because you are closer to the object.

To mitigate motion blur you would have to do one of the following things:
1) Adjust shutter speed (will influence your ISO and aperture values, google for exposure triangle)
2) Increase distance to object
3) Reduce horizontal flight speed (trickier with a fixed wing because it has a minimum horizontal speed to stay in the air)
4) Change lens (smaller focal length)
5) Use 3-axis gimbal for stabilisation and dampeners to remove any vibration coming from the motor

For Tuffwing, there should be an RTK solution available using Emlid Reach. See here: https://emlid.com/tuffwing-reach/

Regarding Reach RS. Use two Reach RS units (one as your own base station, the other one as a rover). Set up the base station on a known point (i.e., survey point) OR let it estimate it's location over a longer period of time (e.g., 1h). The location of the base station itself won't be super accurate (~1m), but the GCPs that you measure using the rover will have an accuracy of 1-5cm RELATIVE to the base station. This would mean the hole model/3D reconstruction is internally consistent and accurate, but might be shifted along X, Y and/or Z by up to ~1m depending on the accuracy of the base station location.

Have a look at the Emlid tutorial. It explains everything pretty well:
1) https://docs.emlid.com/reachrs/common/tutorials/placing-the-base/
2) https://docs.emlid.com/reachrs/common/tutorials/gps-post-processing/

All the best.

Regards,
SAV



Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Pkroks on February 20, 2018, 09:01:10 AM
Hi Sav, Thanks for the info.

So I have since finished and estimated all of the images quality, there was about 55 out for 4600 total images that were below 0.7 and I have since disabled these.

I have read through the reach tutorials, I will attempt to go out and re-read some ground control points and any recognisable features that I could also use as GCPs/markers, such as corners of buildings or corner of roads that are distinct, and will attempt to use the base to provide corrections using Lora radio. The gcps and then the model will then be accurate to within a metre of the base, which is perfect for this survey.

Once I have corrected the markers using the new points, I can then reoptimise and process the images again and hopefully the model will improve.

If that does not help, what would you recommend? Fly higher with a lower GSD and slower to prevent motion blur, increase shutter speed to 1/2500.

Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Pkroks on February 20, 2018, 10:39:13 PM
Hello Pkroks,

Project file with only alignment results should have considerably smaller size.

Otherwise I can suggest the following:
- make sure that the following settings values are set in the Reference pane settings dialog: marker accuracy (m) = 0.005 (or similar according to the measurement device precision), marker accuracy (pix) = 0.1 pix, tie point accuracy (pix) = 1 pix,
- export markers to XML file,
- remove markers from the project,
- reset camera alignment for all the cameras,
- execute the following command from the Console pane (equal to Align Selected, but without adaptive camera model fitting):
Code: [Select]
PhotoScan.app.document.chunk.alignCameras(adaptive_fitting = False)- then optimize camera alignment,
- then import only GCPs and optimize the alignment again.
Then check, if any surface reconstruction artifacts are observed, for example, by generating lower quality dense cloud.

And can you also please check, if the surface reconstruction issues are related to the areas of the flights overlap (as it seems that multiple flights are processed at once, and possible reason of the problem may be related to the difference in flight conditions)?

Hi Alexey,

I have reprocessed the images using the above recommendations and still have ridges in the final product. I'm starting to think the only way to correct this is to refly the entire area.

Does anyone have any recommended settings for a sony nex5t for optimal image quality.

Manual focus, autofocus? I have been reading manual focus set to infinity, or autofocus set to multiple spots. I am not sure which is the best. Shutter priority or full manual? Aperture set to f8 or less? Struggling to find recommended settings anywhere.

Thanks
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: SAV on February 21, 2018, 01:09:43 AM
Yes, if you don't have any strict GSD requirements (note that GSD also influences your achievable accuracy), flying at higher elevation might help.

Also fly when there is ample of light available (not early morning or early evening) to allow to use a high shutter speed without having to pump up your ISO (try to stay below ISO 400). One last thing. If you can, choose to fly when wind speed is low, which means your fixed wing has to 'fight' less against the wind and is flying in a generally more stable manner, which can positively influence image quality (as well as image overlap).

Your dataset seems to be OK. I think you should be able to get rid of the ridge line simply by changing your processing settings and/or using GCPs and markers.

Regards,
SAV

Hi Sav, Thanks for the info.

So I have since finished and estimated all of the images quality, there was about 55 out for 4600 total images that were below 0.7 and I have since disabled these.

I have read through the reach tutorials, I will attempt to go out and re-read some ground control points and any recognisable features that I could also use as GCPs/markers, such as corners of buildings or corner of roads that are distinct, and will attempt to use the base to provide corrections using Lora radio. The gcps and then the model will then be accurate to within a metre of the base, which is perfect for this survey.

Once I have corrected the markers using the new points, I can then reoptimise and process the images again and hopefully the model will improve.

If that does not help, what would you recommend? Fly higher with a lower GSD and slower to prevent motion blur, increase shutter speed to 1/2500.
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: SAV on February 21, 2018, 01:34:49 AM
Hi again Pkroks,

You could try to run photo alignment on ALL images (choose quality setting MEDIUM unless you have a high-end computer) to see if the ridge problem persists (also use your GCPs). For the dense point cloud you would then divide your project into several chunks (using a Python script) and then merge all chunks at the end for the final product (unless you have a high-end computer/multi-GPU setup that can compute a dense point cloud from over 4,500 images).
In some areas where aerial surveys overlap (as seen in your processing report) you could even disable a few images to speed up processing.

Regarding settings for your camera. Many people use manual focus set to infinity (when flying high above the ground) because autofocus might a) be too slow which means the picture is not taken where it should be taken and b) might simply get it wrong (leading to out-of-focus/blurry images).
Use ISO 100 or 200 (if necessary even 400), shutter priority or manual and set your aperture to f/6.3 or f/7.1 (which is generally OK because you don't want to 'suffer' shutter speed-wise; remember the exposure triangle). These are the settings I commonly use on my Sony Nex 7 and A6000 (attached to a multi-rotor though).

If you shoot fully manual, adjust your aperture/shutter speed/ISO by using the live histogram on your camera. When working outdoors it is hard to tell on the tiny screen of your camera if the picture is properly exposed or not, but it is easy to see in the live histogram.

Last but not least, DON'T use the automatic white balance, but manually set it to cloudy or sunny (depending on the weather/light conditions).

All the best.

Regards,
SAV
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Alexey Pasumansky on February 21, 2018, 11:58:41 AM
Hello Pkroks,

If the same artifacts can be reproduced, when processing only two flights together, I can suggest to try running the alignment for such smaller dataset with the disabled pre-selection and check if any valid matching points are found in the area of overlap.
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Pkroks on February 21, 2018, 07:42:40 PM
Hello Pkroks,

If the same artifacts can be reproduced, when processing only two flights together, I can suggest to try running the alignment for such smaller dataset with the disabled pre-selection and check if any valid matching points are found in the area of overlap.

Hi Alexey,

I reprocessed the entire data set with no GCPs or markers, on medium alignment, medium dense cloud and mild depth filtering.

The DSM ridges are improved in the initial area, but have moved to another area that had no issues before.

I will try to process the area in chunks separately on medium, only with reference pre-selection on, not generic.
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Pkroks on February 22, 2018, 08:27:06 AM
Hi again Pkroks,

You could try to run photo alignment on ALL images (choose quality setting MEDIUM unless you have a high-end computer) to see if the ridge problem persists (also use your GCPs). For the dense point cloud you would then divide your project into several chunks (using a Python script) and then merge all chunks at the end for the final product (unless you have a high-end computer/multi-GPU setup that can compute a dense point cloud from over 4,500 images).
In some areas where aerial surveys overlap (as seen in your processing report) you could even disable a few images to speed up processing.

Regarding settings for your camera. Many people use manual focus set to infinity (when flying high above the ground) because autofocus might a) be too slow which means the picture is not taken where it should be taken and b) might simply get it wrong (leading to out-of-focus/blurry images).
Use ISO 100 or 200 (if necessary even 400), shutter priority or manual and set your aperture to f/6.3 or f/7.1 (which is generally OK because you don't want to 'suffer' shutter speed-wise; remember the exposure triangle). These are the settings I commonly use on my Sony Nex 7 and A6000 (attached to a multi-rotor though).

If you shoot fully manual, adjust your aperture/shutter speed/ISO by using the live histogram on your camera. When working outdoors it is hard to tell on the tiny screen of your camera if the picture is properly exposed or not, but it is easy to see in the live histogram.

Last but not least, DON'T use the automatic white balance, but manually set it to cloudy or sunny (depending on the weather/light conditions).

All the best.

Regards,
SAV


Hi Sav,

Please can you share or help with the python script to split and then merge after the dense cloud processing. The system is as follows:
Intel i7 8700k 3.7ghz
32gb ddr4 ram 2400mhz
nVidia GTX1070 8gb
samsung 850 evo 250gb ssd
1tb seagate sshd harddrive.
Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: Pkroks on February 24, 2018, 09:14:01 AM
Hello Pkroks,

If the same artifacts can be reproduced, when processing only two flights together, I can suggest to try running the alignment for such smaller dataset with the disabled pre-selection and check if any valid matching points are found in the area of overlap.

Hi Alexey,

I have managed to process the project in Two areas, one is about 995ha and the other about 800ha. There are no ridge lines in these two areas, however there is a ridge where they join. A variation of approximately 3-4m.

Any tutorial or links on a way to merge the two files now?

Thanks for the help. Very weird how it processes fine in two halves, yet as a complete project it gives ridges.. ??

Title: Re: Urgent help needed - Ridge lines in DSM/DEM export
Post by: SAV on February 24, 2018, 10:02:08 AM
Hi Pkroks,

You can find the Python script here:
https://github.com/agisoft-llc/photoscan-scripts/tree/master/src

Regards,
SAV

Hi again Pkroks,

You could try to run photo alignment on ALL images (choose quality setting MEDIUM unless you have a high-end computer) to see if the ridge problem persists (also use your GCPs). For the dense point cloud you would then divide your project into several chunks (using a Python script) and then merge all chunks at the end for the final product (unless you have a high-end computer/multi-GPU setup that can compute a dense point cloud from over 4,500 images).
In some areas where aerial surveys overlap (as seen in your processing report) you could even disable a few images to speed up processing.

Regarding settings for your camera. Many people use manual focus set to infinity (when flying high above the ground) because autofocus might a) be too slow which means the picture is not taken where it should be taken and b) might simply get it wrong (leading to out-of-focus/blurry images).
Use ISO 100 or 200 (if necessary even 400), shutter priority or manual and set your aperture to f/6.3 or f/7.1 (which is generally OK because you don't want to 'suffer' shutter speed-wise; remember the exposure triangle). These are the settings I commonly use on my Sony Nex 7 and A6000 (attached to a multi-rotor though).

If you shoot fully manual, adjust your aperture/shutter speed/ISO by using the live histogram on your camera. When working outdoors it is hard to tell on the tiny screen of your camera if the picture is properly exposed or not, but it is easy to see in the live histogram.

Last but not least, DON'T use the automatic white balance, but manually set it to cloudy or sunny (depending on the weather/light conditions).

All the best.

Regards,
SAV


Hi Sav,

Please can you share or help with the python script to split and then merge after the dense cloud processing. The system is as follows:
Intel i7 8700k 3.7ghz
32gb ddr4 ram 2400mhz
nVidia GTX1070 8gb
samsung 850 evo 250gb ssd
1tb seagate sshd harddrive.