Also, the second image has wrong type.

Also, I don't think you actually need to initialize these - `source` will be initialized by the first read from `video`, and `grayImage` will be initialized by the `cvtColor` above.