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 characters
| #SPECIFIC | |
| def loadSeparateChannelInstanceLabelNoResize(labelPath, instances): | |
| labelsInChannels = [] | |
| indexedImg = loadIndexedImage(labelPath) | |
| for indx, inst in enumerate(instances): | |
| labelsInChannels.append(getInstanceDataFromIndexedImage(indexedImg, int(inst))) | |
| labelsInChannels = np.concatenate(labelsInChannels, axis=2) | |
| if len(labelsInChannels.shape)<3: | |
| labelsInChannels = np.expand_dims(labelsInChannels, axis=2) | |
| return labelsInChannels |
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 characters
| def getFirstFrrameInfo(video,videoInstances,videoFramesPerInstance): | |
| firstFramesYT = None | |
| firstFramesYTvideoLenghts = None | |
| videoFirstFramesPerInstance = [] | |
| for inst in videoInstances[video]: | |
| videoFirstFramesPerInstance.append(videoFramesPerInstance[video][inst][0]) | |
| videoFirstFramesPerInstance = sorted(list(set(videoFirstFramesPerInstance))) | |
| firstFramesYT = videoFirstFramesPerInstance | |
| firstFramesYTvideoLenghts= len(videoFirstFramesPerInstance) |
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 characters
| ffmpeg -r 12 -i /home/jcleon/Storage/ssd0/DavisOLD/JPEGImages/480p/india/%05d.jpg -c:v libx264 -vf fps=25 -pix_fmt yuv420p india.mp4 |
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 characters
| def mat2Gray(matImg): | |
| grayImage = np.zeros((matImg.shape), dtype=np.uint8) | |
| cv2.normalize(matImg, grayImage, alpha=0, beta=255, norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_8U) | |
| return grayImage |
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 characters
| import sys | |
| caffeRoot='.../caffe/python' | |
| sys.path.insert(0, caffeRoot) | |
| import caffe | |
| import lmdb | |
| import glob | |
| import numpy as np | |
| from PIL import Image | |
| import os |
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 characters
| find . -name \*.jpg -print | while read line; do SIZE=$(identify -format '%wx%h' "$line"); echo "$SIZE -- $line"; done | sort -n -r | |
| find . -name \*.jpg -print | while read line; do SIZE=$(identify -format '%wx%h' "$line"); echo "$SIZE -- $line"; done | awk '$1<239 || $2<239' | sort -n -r |
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 characters
| import PIL.Image | |
| from StringIO import StringIO | |
| import lmdb | |
| import numpy as np | |
| import sys | |
| caffe_root = '.../caffe/' | |
| sys.path.insert(0, caffe_root + 'python') | |
| import caffe #Caffe Lib |
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 characters
| #Python code to use the PCAFlow by Wulff, input is a directory with images corresponding to the ordered video frames | |
| import os | |
| import sys | |
| import cv2 | |
| import numpy as np | |
| import re | |
| dirPath = 'XXXXX/a68k87VXX1c' | |
| targetPath='ZZZZZZ/temp' | |
| resizeTarget=256 |
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 characters
| import cv2 | |
| #Read Video Frames From video With Skip Python OpenCV. | |
| def getFramesFromVideo(videoPath,frameSkip): | |
| print ('reading vid', videoPath) | |
| cap = cv2.VideoCapture(videoPath) | |
| print ('reading done ') | |
| frames = [] | |
| print ('Loading frames to memory') | |
| success, frame = cap.read()#get frame 0 |