Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 475

Improving the speed of ros-python script

$
0
0
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)

Viewing all articles
Browse latest Browse all 475

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>