Artem,
The first important thing so consider when using any of these equations is that you must use Kelvin, not degrees Celsius.
John is correct. Stefan-Boltzmann is meant to calculate the power emitted by a perfect blackbody over the entire electro-magnetic spectrum. An IR temperature measurement device only measures in a certain portion of this spectrum (with the exception of a total radiation thermometer). In the case of many handheld devices this can be 8-12um or 8-14um.
The second comment is that assuming a material to be a graybody is dangerous, since most materials do not act as graybodies. (graybody being defined as a material with constant emissivity over all wavelengths) See http://masterweb.jpl.nasa.gov/reference/paints.htm
If you are measuring an opaque material, τ=0. This simplifies the power equation to:
Wtot= ε Wobj + (1 - ε) Wamb
(The original equation you had came from this one by assuming (1 - ε) Wamb<< ε Wobj, assuming both Wtot1=Wtot2, and assuming Wobj=σT^4.)
The problem now is properly calculating W. Planck's Law gives us a possible solution for a single bandwidth.
L=c1/λ^5/(exp(c2/λT)-1)
To get W from this for a wideband instrument you can do one of two things. You can use a center bandwidth (say 11um for the 8-14um band) for λ. The second way is to do a numerical integration on Planck's Law over the entire bandwidth.
Either way, it is a complicated problem to solve. It may be easier to do this calculation in a spreadsheet.
Frank