GithubHelp home page GithubHelp logo

Comments (6)

wangzizhe avatar wangzizhe commented on July 17, 2024 1

I remember I used this code at that time and it worked perfect! Just create a python file and copy paste these codes into that file and modify the codes according to your own camera settings.

#!/usr/bin/python3
​
# general stuff
import cv2
import numpy as np
import time
import copy
import os
import math
​
# ros stuff
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
​
from datetime import datetime
​
# is used to convert ROS message into OpenCV structure
bridge = CvBridge()
# opencv video write object
# camera resolution is 2064x1544
out = cv2.VideoWriter('test.avi',cv2.VideoWriter_fourcc('M','J','P','G'), 30, (2064,1544))
​
def cbImg(msg):
    global bridge, out
    cv_image = bridge.imgmsg_to_cv2(msg, desired_encoding="bgr8")
    # image is flipped
    out.write(cv2.flip(cv_image, -1))
​
​
def main():
    global out
​
    rospy.init_node('video_writer', anonymous=True)
​
    #change comments for different topics
    rospy.Subscriber("/ximea_cam_left/image_raw", Image, cbImg, queue_size=1)
    # rospy.Subscriber("/ximea_cam_right/image_raw", Image, cbImg, queue_size=1)
​
    # spin() simply keeps python from exiting until this node is stopped
    rate = rospy.Rate(10)
    while not rospy.is_shutdown():
        rate.sleep()
​
    # end video write
    out.release()
​
    rospy.spin()
​
if __name__ == '__main__':
    main()

from rosbag2video.

kenkainkane avatar kenkainkane commented on July 17, 2024

I have the same problem

from rosbag2video.

innovation-x avatar innovation-x commented on July 17, 2024

I have the same problem as well. Is this issue be solved now?

from rosbag2video.

innovation-x avatar innovation-x commented on July 17, 2024

However, I run the ros2 bag2videos. It stuck like the figure below.
image

from rosbag2video.

wangzizhe avatar wangzizhe commented on July 17, 2024

I don't think this problem has been solved... You'd better try other ways to transfer the files...

from rosbag2video.

innovation-x avatar innovation-x commented on July 17, 2024

I see... Would you please share some methods for converting the rosbag .db3 files into .mp4 files?

from rosbag2video.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.