added a new calcHist function to take an image mask