Forum

Author Topic: Bad Stitching - What causes this?  (Read 2416 times)

ashalota

  • Jr. Member
  • **
  • Posts: 93
  • Forest orthomosaics, long transects (300m agl)
    • View Profile
    • NASA: G-LiHT (Public orthomosaics)
Bad Stitching - What causes this?
« on: December 27, 2019, 08:31:12 PM »
I have a set of aerial photographs taken in long lines. Over 80% overlap along the lines. Roughly 5000 photos. The GPS data is great, and includes lat/lon, altitude, roll, pitch, yaw.

I'm experimenting with different methods to get an orthomosaic for the entire set, but it just isn't working out. Here are the current steps I take:

1. Load the photos into chunks, with each chunk containing a group of ~ 20 overlapping photos in a contiguous area along my flight line. There is overlap in the photos between the different chunks, so several photos at the edges will appear in two chunks.

2. For each chunk:
  - chunk.matchPhotos(generic_preselection=False)
  - chunk.alignCameras()
  - After some testing, I decided at this point to do some additional things that may or may not be helping things...:
    -  If after aligning the chunk, the chunk is aligned, but a section of at least 4 images in a row (which due to my naming means they would be near each other) is not aligned (says 'NA' in the gui), I would move those photos out of that chunk and into a new chunk. Then I align those new chunks, and do the same if needed, so that wherever possible I don't have large groups of unaligned photos. This was supposed to get as many photos aligned as possible...

3. For each chunk/new partial chunk:
  - Check the total error of the chunk by using the math described here: https://www.agisoft.com/forum/index.php?topic=5748.0
  - If the total chunk error is less than 10m, accept it, if not try again (a few times) to align that chunk, before giving up, and ignoring that bad chunk in the future.
    - I couldn't decide how to pick my error threshold, although usually I do not hit the 10m much smaller, like < 0.5

4. Merge good chunks:
  - doc.mergeChunks(goodChunks,merge_markers=True)
  - mergedChunk = doc.chunks[len(doc.chunks)-1]

5. Build mesh:
  - mergedChunk.buildModel(surface=Metashape.Arbitrary, interpolation=Metashape.EnableInterpolation,face_count=Metashape.LowFaceCount)

6. Build orthomosaic:
  - mergedChunk.buildOrthomosaic(surface=Metashape.ModelData,blending=Metashape.MosaicBlending,projection=Metashape.CoordinateSystem("EPSG::4326"))

My reasoning for splitting it up into the chunks was that because I had such a long varying flightline, when I tried to run it all in one model the results were no good, and I thought that might be because the program was creating a model over a long area (?) . Sometimes, this method described above has produced good results, but not consistently enough. If I ever have an area with a LOT of overlap (when the flight is more of a grid pattern instead of a line), the results are perfect.

Some of the "bad" results are like these:

You can see the roads completely warped in one, and the rim of a mountain disconnected in another.



« Last Edit: December 27, 2019, 09:12:47 PM by ashalota »

ashalota

  • Jr. Member
  • **
  • Posts: 93
  • Forest orthomosaics, long transects (300m agl)
    • View Profile
    • NASA: G-LiHT (Public orthomosaics)
Re: Bad Stitching - What causes this?
« Reply #1 on: December 27, 2019, 09:29:02 PM »
I tried out creating a mesh and orthomosaic for one of these chunks individually, and it produced nice results.

So the final question then is, what is the right way to combine several small items into one big orthomosaic?

Arie

  • Full Member
  • ***
  • Posts: 134
    • View Profile
Re: Bad Stitching - What causes this?
« Reply #2 on: December 28, 2019, 02:42:05 AM »
Hey ashalota,
why are you dividing the flight lines into separate chunks if you have enough overlap between the lines and GPS tags? What do you mean by "varying long flight-lines"?

In general, I would recommend to align all the images in one chunk. Since your images have GPS coordinates, they should be roughly pre-aligned, reducing the processing time quite a bit in comparision to deactivating preselection altogether ( make sure to select Reference preselection in the alignment dialog).
For creating a dense cloud/ mesh and DEM/ Orthomosaic you can use the "split in chunks" script (https://github.com/agisoft-llc/metashape-scripts/blob/master/src/split_in_chunks_dialog.py). This reduces the memory required for processing and will ensure a seamless transition between the separate orthoimages.

Are you using a RTK-GNSS? And don't you have ground control points?


ashalota

  • Jr. Member
  • **
  • Posts: 93
  • Forest orthomosaics, long transects (300m agl)
    • View Profile
    • NASA: G-LiHT (Public orthomosaics)
Re: Bad Stitching - What causes this?
« Reply #3 on: December 30, 2019, 06:23:02 PM »
Quote
why are you dividing the flight lines into separate chunks if you have enough overlap between the lines and GPS tags?
What do you mean by "varying long flight-lines"?

A, sorry, I meant to say VERY long. I have 5000 photos, in one line, covering 225 miles. So, at any point only about 5 photos have any overlap at all.

I decided to split it into chunks because I somehow reasoned that because the start of my flight line and end of my flight line were so disconnected, there was no value in processing it all as one item.

I think this is part of where my issue lies, but when I've run it all in one chunk it is not getting any better results.

It is flying over forest, mountain, and river terrain.

Quote
Are you using a RTK-GNSS? And don't you have ground control points?

For gps data I am using  "Applanix POS AV V6", a seperate instrument, it states 10cm horizontal & 20cm vertical position accuracies. I have gotten great results so far with the data, it's only these 200+mile long lines that are causing issues.

No ground control points because I'm 300m above wilderness terrain :)


I'll take a look at that script now and see if it helps.