Skip to content

Commit

Permalink
Merge pull request #4 from farad91/master
Browse files Browse the repository at this point in the history
fix method names for CV2 module
  • Loading branch information
dlaz committed Feb 21, 2018
2 parents ee47c22 + 630fc9e commit 4522cb7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bag2video.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2

from __future__ import division
import rosbag, rospy, numpy as np
Expand Down Expand Up @@ -50,7 +50,7 @@ def write_frames(bag, writer, total, topic=None, nframes=repeat(1), start_time=r
iterator = bag.read_messages(topics=topic, start_time=start_time, end_time=stop_time)
for (topic, msg, time), reps in izip(iterator, nframes):
print '\rWriting frame %s of %s at time %s' % (count, total, time),
img = np.asarray(bridge.imgmsg_to_cv(msg, 'bgr8'))
img = np.asarray(bridge.imgmsg_to_cv2(msg, 'bgr8'))
for rep in range(reps):
writer.write(img)
imshow('win', img)
Expand Down Expand Up @@ -96,7 +96,7 @@ def noshow(win, img):
rate, minrate, maxrate, size, times = get_info(bag, args.topic, start_time=args.start, stop_time=args.end)
nframes = calc_n_frames(times, args.precision)
# writer = cv2.VideoWriter(outfile, cv2.cv.CV_FOURCC(*'DIVX'), rate, size)
writer = cv2.VideoWriter(outfile, cv2.cv.CV_FOURCC(*'DIVX'), np.ceil(maxrate*args.precision), size)
writer = cv2.VideoWriter(outfile, cv2.VideoWriter_fourcc(*'DIVX'), np.ceil(maxrate*args.precision), size)
print 'Writing video'
write_frames(bag, writer, len(times), topic=args.topic, nframes=nframes, start_time=args.start, stop_time=args.end, encoding=args.encoding)
writer.release()
Expand Down

0 comments on commit 4522cb7

Please sign in to comment.