Made the explicit cast safer using an as check.
Made the previous change less redundant.
Added a normalize to the intensity function.
Removed the ref from the normalize function in Lanczos.cs because it's not necessary. Changed all calls to that function to remove ref.