Filtering and Parameter Estimation for a Class of Hidden Markov Models with Application to Bubble-Counting in Microfluidics