def linbleeched_F0(data):
"""
Calculate a linear fit (:math:`y(t)=m t+y_0)` for each pixel, which is assumed to correct for bleeching effects.
:param data: he video data of shape (M,N,T).
:return: tuple (m,y0) with two images each with shape (M,N).
"""
# generate c coordinates
x = numpy.arange(data.shape[-1])
# reshape the data to two d array, first dimension is pixel index, second dimension is time
d = numpy.reshape(data, (data.shape[0] * data.shape[1], data.shape[-1]))
# find fit parameters
m, y0 = numpy.polyfit(x, d.T, 1)
# reshape fit parameters back to image shape
return m.reshape(data.shape[0:2]), y0.reshape(data.shape[0:2])
评论列表
文章目录