MCPcopy Create free account
hub / github.com/DeepLabCut/DeepLabCut / rotate_video

Function rotate_video

deeplabcut/utils/auxfun_videos.py:554–593  ·  view source on GitHub ↗

Auxiliary function to rotate a video and output it to the same folder with "outsuffix" appended in its name. Angle is in degrees. Returns the full path to the rotated video! Parameter ---------- vname : string A string containing the full path of the video. angle:

(vname, angle, rotatecw="Arbitrary", outsuffix="rotated", outpath=None)

Source from the content-addressed store, hash-verified

552
553
554def rotate_video(vname, angle, rotatecw="Arbitrary", outsuffix="rotated", outpath=None):
555 """Auxiliary function to rotate a video and output it to the same folder with
556 "outsuffix" appended in its name. Angle is in degrees.
557
558 Returns the full path to the rotated video!
559
560 Parameter
561 ----------
562 vname : string
563 A string containing the full path of the video.
564
565 angle: float
566 Angle to rotate by in degrees. Negative values rotate counter-clockwise.
567
568 rotatecw: str
569 Default "Arbitrary", rotates clockwise if "Yes", "Arbitrary" for arbitrary rotation by specified angle.
570
571 outsuffix: str
572 Suffix for output videoname (see example).
573
574 outpath: str
575 Output path for saving video to (by default will be the same folder as the video)
576
577 Examples
578 ----------
579
580 Linux/MacOs
581 >>> deeplabcut.rotate_video('/data/videos/mouse1.avi',angle=90)
582
583 Rotates the video by 90 degrees and saves it in /data/videos as mouse1rotated.avi
584
585 Windows:
586 >>> shortenedvideoname=deeplabcut.rotate_video('C:\\yourusername\\rig-95\\Videos\\reachingvideo1.avi',
587 ... angle=180,rotatecw='Yes')
588
589 Rotates the video by 180 degrees and
590 saves it in C:\\yourusername\\rig-95\\Videos as reachingvideo1rotated.avi
591 """
592 writer = VideoWriter(vname)
593 return writer.rotate(angle, rotatecw, outsuffix, outpath)
594
595
596def draw_bbox(video):

Callers

nothing calls this directly

Calls 2

rotateMethod · 0.95
VideoWriterClass · 0.85

Tested by

no test coverage detected