Automatic EBSD map stiching

So let's say you have two maps A and B and you want to stich them automatically to get the big map AB without any seams:

The following matlab function merges two mtex ebsd objects using the phase correlation method as explained in this presentation:

The function takes the following entry parameters:

ebsd1, ebsd2: the two ebsd object to stich (2 must be at the right of 1 for the x axis, or at the bottom of 1 for the y axis)

fact: the length ratio of the zone to use in image 2 for the phase correlation method

axis: chose either to stich map 1 on top of map 2 or map1 at the left of map 2 (could be generalized I guess..)

phase: the phase to use to generate the orientation field used for stiching

Here's an example using the function to automatically stich several maps along the y and x axis successively. The scripts pauses after each column and after stiching two columns to ask if the stiching is correct. Is not, the fact parameter can be changed until it works.