week3_homework4: add Capture image function