Handled target to take image_data correctly.

The case when target_type==TARGET_TYPE_MAT has been handled and the target now gets image data using imread.