Calculations/Data-Analyzer/+Helper/subtractBackgroundOffset.m

16 lines
618 B
Matlab

function ret = subtractBackgroundOffset(img, fraction)
% Remove the background from the image.
% :param dataArray: The image
% :type dataArray: xarray DataArray
% :param x_fraction: The fraction of the pixels used in x axis
% :type x_fraction: float
% :param y_fraction: The fraction of the pixels used in y axis
% :type y_fraction: float
% :return: The image after removing background
% :rtype: xarray DataArray
x_fraction = fraction(1);
y_fraction = fraction(2);
offset = Helper.getBkgOffsetFromCorners(img, x_fraction, y_fraction);
ret = img - offset;
end