Open brunicardoso opened 4 months ago
Hi, Alexandre
We have a more sophisticated and (brittle) approach to register different frames using a flow field; it's used on this example.
If your jitter is mostly a translation shift, using skimage
to register when pre-processing your image will be more robust.
This function is a good starting point:
import numpy as np
import scipy.ndimage as ndi
from skimage.registration import phase_cross_correlation
from tqdm import tqdm
def _register(video: np.ndarray) -> np.ndarray:
# registration using channel 1
reg_channel = 1
for t in tqdm(range(video.shape[0] - 1), "register"):
shift, error, _ = phase_cross_correlation(
video[t, reg_channel],
video[t + 1, reg_channel],
normalization=None,
overlap_ratio=0.25,
)
video[t+1] = ndi.shift(video[t+1], (0, *shift), order=1)
return video
Thank, Jordao! I will try it
I am not sure if Ultrack has a function to correct for jittering? In may dataset, when there is a little jitter (usually occurs in the first to the second frame and when a treatment is added), the tracks are messed up.