Improving the speed of ros-python script

asked 2016-01-06 15:08:45 -0600

pnambiar gravatar image

updated 2016-01-06 15:23:54 -0600

ahendrix gravatar image

The python script that I'm running becomes significantly slower when I try to write images and data using cv2.imwrite(twice-for raw image and segmented images) and numpy.savetxt respectively.

The other possibility I explored was to publish the images using ros and save it into a rosbag file and extract the images later using image_view. However after this process, quite a few images were missing ( I tried to save the images simultaneously using cv2,imwrite for just processed images).

Please let me know if you have leads as to how to solve this problem.


  np.savetxt(depth_data_raw, depth_image_raw)
 cv2.imwrite(crop_img_name, crop_img);
  # Publishing the cropped image to the Jetson
  msg = Image()
  msg.encoding = 'bgr8'
  msg.height = crop_img.shape[0]
  msg.width = crop_img.shape[1]
  msg.step = crop_img.shape[1] * 3 = crop_img.tostring()
edit retag flag offensive close merge delete