First time here? Check out the FAQ!
answered 2015-04-21 11:50:59 -0600
prevGrey's scope is within the imageDetect scope, thus it is destroyed on every iteration of the function. Either define prevGrey as static or make it a member variable that is updated at each iteration.