Calculating Calories from Heart Rate

Hi All,
I usually depend on the exercise machine to tell me how many calories I burned during a workout. Maybe I'm the only one that didn't think of this before but of course, there must be a formula to do my own calculation if I know what my heart rate and duration are. I looked online and there are calculators. I also learned about gross versus net calories. Here's a useful website: http://www.shapesense.com/fitness-exercise/calculators/heart-rate-based-calorie-burn-calculator.aspx