Change to cpp usage of opencv and added a log.