  We consider the model of the focusing one-dimensional nonlinear Schr\"odinger
equation (fNLSE) in the presence of an unstable constant background, which
exhibits coherent solitary wave structures -- breathers. Within the inverse
scattering transform (IST) method, we study the problem of the scattering data
numerical computation for a broad class of breathers localized in space. Such
direct scattering transform (DST) procedure requires a numerical solution of
the auxiliary Zakharov--Shabat system with boundary conditions corresponding to
the background. To find the solution we compute the transfer matrix using the
second-order Boffetta--Osborne approach and recently developed high-order
numerical schemes based on the Magnus expansion. To recover the scattering data
of breathers, we derive analytical relations between the scattering
coefficients and the transfer matrix elements. Then we construct localized
single- and multi-breather solutions and verify the developed numerical
approach by accurately recovering the complete set of the scattering data,
which provides us with information about the amplitude, velocity, phase, and
position of each breather. To combine the conventional IST approach with the
efficient dressing method for multi-breather solutions, we provide the exact
relation between the parameters of breathers in these two frameworks.
