Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Improving the speed of ros-python script

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.

-P cv2.imwrite(raw_img_name,cv_image_orig); 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 msg.data = crop_img.tostring() self.pub_seg.publish(msg)

Improving the speed of ros-python script

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.

-P -P

  cv2.imwrite(raw_img_name,cv_image_orig);
   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
   msg.data = crop_img.tostring()
      self.pub_seg.publish(msg)

self.pub_seg.publish(msg)