Last active
March 21, 2018 00:45
Revisions
-
celoyd revised this gist
Mar 19, 2018 . 1 changed file with 3 additions and 3 deletions.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 @@ -17,14 +17,14 @@ row = int(row) viddy = cv2.VideoCapture(movf) width = int(viddy.get(3)) # can you tell this API is by C programmers? height = int(viddy.get(4)) frame_count = int(viddy.get(7)) rows = np.empty((frame_count, width, 3)) # 3 channels for frame_n in range(frame_count): print("%s/%s" % (frame_n, frame_count)) # or not okay, frame = viddy.read() if not okay: break rows[frame_n] = frame[row] -
celoyd revised this gist
Jun 15, 2014 . 1 changed file with 3 additions and 3 deletions.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 @@ -19,12 +19,12 @@ viddy = cv2.VideoCapture(movf) width = viddy.get(3) # can you tell this API is by C programmers? height = viddy.get(4) frame_count = int(viddy.get(7)) rows = np.empty((frame_count, width, 3)) # 3 channels for frame_n in range(frame_count): print "%s/%s" % (frame_n, frame_count) # or not okay, frame = viddy.read() if not okay: break rows[frame_n] = frame[row] -
celoyd revised this gist
Jun 15, 2014 . 2 changed files with 32 additions and 22 deletions.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 @@ -1,22 +0,0 @@ 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,32 @@ #!/usr/bin/env python # ./sscan.py input.mov rownumber output.png # This is meant to be hyper-simple and makes # some assumptions like: you want a row (not # a column), the video is RGB (not gray), etc. # Bug: frame_count is sometimes fractional. # int() and the "if not okay" are workarounds. import numpy as np import cv2 from sys import argv movf, row, outf = argv[1:] row = int(row) viddy = cv2.VideoCapture(movf) width = viddy.get(3) # can you tell this API is by C programmers? height = viddy.get(4) frame_count = viddy.get(7) rows = np.empty((frame_count, width, 3)) # 3 channels for frame_n in range(int(frame_count)): print frame_n okay, frame = viddy.read() if not okay: break rows[frame_n] = frame[row] cv2.imwrite(outf, rows) -
celoyd revised this gist
Jun 12, 2014 . 1 changed file with 3 additions and 1 deletion.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 @@ -1,4 +1,6 @@ # draft # - factor out constants (including output filename) # - find more efficient way of appending ndarrays import numpy as np import cv2 -
celoyd created this gist
Jun 12, 2014 .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,20 @@ # draft; needs to have constants factored out import numpy as np import cv2 from sys import argv v = cv2.VideoCapture(argv[1]) rows = np.zeros((1, 1920, 3)) n = 0 while n < 8000: # try: _, frame = v.read() print n #print frame[0].shape rows = np.vstack((rows, np.reshape(frame[655], (1, 1920, 3)) )) n += 1 # except: # break cv2.imwrite('dingo.png', rows)