convert to cpp add waitKey to give time to display window