This file contains 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
''' | |
Using OpenCV takes a mp4 video and produces a number of images. | |
Requirements | |
---- | |
You require OpenCV 3.2 to be installed. | |
Run | |
---- | |
Open the main.py and edit the path to the video. Then run: |
This file contains 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
#!/usr/bin/env python | |
from threading import Thread, Lock | |
import cv2 | |
class WebcamVideoStream : | |
def __init__(self, src = 0, width = 320, height = 240) : | |
self.stream = cv2.VideoCapture(src) | |
self.stream.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, width) | |
self.stream.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, height) |
This file contains 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
pip show tensorflow | |
pip uninstall tensorflow | |
# Tensorflow 1.4 works only with Python 3.5 | |
# to install downgrade Python 3.6 to Python 3.5 in Anaconda | |
conda install python=3.5 | |
# now install tensorflow 1.4 | |
sudo apt-get install python3-pip python3-dev | |
pip install tensorflow |
This file contains 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 os | |
import io | |
import glob | |
import hashlib | |
import pandas as pd | |
import xml.etree.ElementTree as ET | |
import tensorflow as tf | |
import random | |
from PIL import Image |