correct triangle height calculations

Hi,
This is perhaps the most accurate way to do the LBP/sobel filtering.
Previously the "y" offset was not being calculated so this was added. The equation for the offset includes a "buffer" term to avoid mixing border pixel values.