Created
March 3, 2015 18:41
Revisions
-
aviraldg created this gist
Mar 3, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #!/usr/bin/python import subprocess, cv2, os PATH = '/home/aviraldg/Pictures/gitpic/' def main(): sha = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip() repo_name = os.path.basename(subprocess.check_output(["git", "rev-parse", "--show-toplevel"])).strip() try: os.makedirs(os.path.join(PATH, repo_name)) except OSError: pass outpath = os.path.abspath(os.path.join(PATH, repo_name, '%s.jpg' % sha)) import cv2 camera_port = 0 camera = cv2.VideoCapture(camera_port) return_value, image = camera.read() cv2.imwrite(outpath, image) del(camera) # so that others can use the camera as soon as possible if __name__ == '__main__': main()