added code for iplimage and removed seg faults