- clone the repo into a new directory
- cd into it
git filter-branch --prune-empty --subdirectory-filter FOLDER-NAME BRANCH-NAME- where:
FOLDER-NAME: The folder within your project that you'd like to create a separate repository from.BRANCH-NAME: The default branch for your current project, for example,master.
- Update the remote
git remote set-url origin https://github.com/USERNAME/NEW-REPOSITORY-NAME.git - Verify
git remote -v - Push the changes
git push -u origin BRANCH-NAME
| """Simple demo of argparse in python""" | |
| import argparse | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('name') # positional argument, note no dash! | |
| parser.add_argument('-n', type=int, required=True, help="the number") # Required argument, must be a int, eg. -n 4 | |
| parser.add_argument('-e', type=int, default=2, help="defines the value") # Optional argument with a default | |
| parser.add_argument('-o', '--output', action='store_true', help="shows output") # a binary flag |
The code for this tutorial is here
Opencv provides are useful, but limited, method of building a GUI. A much more complete system could be acheived using pyqt.
The question is, how do we display images. There are quite a few possible routes but perhaps the easiest is to use QLabel since it has a setPixmap function. Below is some code that creates two labels. It then creates a grey pixmap and displays it one of the labels. code: staticLabel1.py
from PyQt5.QtWidgets import QWidget, QApplication, QLabel, QVBoxLayout
from PyQt5.QtGui import QPixmap, QColor
import sys- http://yacvid.hayko.at . - very large list
- https://www.di.ens.fr/~miech/datasetviz/
- COCO http://cocodataset.org/#home An industry standard
- Pascal VOC challenge http://host.robots.ox.ac.uk:8080 A bit old now
- Youtube https://research.google.com/youtube8m/
- Labeled Faces in the Wild http://vis-www.cs.umass.edu/lfw/
This is running on Linux Mint
- Install ffmpeg
sudo apt-get install ffmpeg
- A simple test: open two terminals, in first run
ffplay udp://127.0.0.1:23000and in the secondffmpeg -i sample.mp4 -vcodec mpeg4 -f mpegts udp://127.0.0.1:23000. This should play the videosample.mp4although the quality is rather blocky.
- Install a markdown editor. I have used Atom with the following packaged added
- markdown-preview-plus to view your pdf as you edit. This isn't configured to render the beamer slides but it produced a normal pdf document as you type which is still handy.
- highlight-bad-chars - highlights none acsii chars that cause latex a problem
- pdf-view is also handy - it opens your created pdf files directly in Atom.
- Language Markdown - for some md auto formatting
- Optional tweeks for Atom: In the core package Autocomplete-plus I would suggest changing 'Keymap For Confirming A Suggestion' to 'tab always, enter when suggestion explicity selected'. The default tab and enter is fine for programming but doesn't work well when writting English.
- Install latex - there are lots of ways of doing this depending on your OS. Make sure you have beamer installed as well.
- Install pandoc. The repo versions might be really old, so I installed the latest from here.
- Install any templates
- Stop the old service if it is running with
sudo service squeezelite stop - Remove the old version if installed with
sudo apt-get remove squeezelite - Install its dependancies
sudo apt-get install lsb-base libasound2 libavcodec57 libavcodec-extra57 libavformat57 libavutil55 libc6 libfaad2 libflac8 liblirc-client0 libmad0 libmpg123-0 libsoxr0 libvorbisfile3 - Create a directory to download the source files in your home drive
mkdir sources; cd sources - Clone the source code
git clone https://github.com/ralph-irving/squeezelite.git cd squeezelitesudo apt-get install libavcodec-dev libavformat-devsudo apt-get install libsoxr-lsr0 libsox-dev sox libsoxr-dev- Build it with
make all OPTS="-DDSD -DRESAMPLE -DFFMPEG" sudo cp squeezelite /usr/bin/.to copy the file to you path
To pipe data from one process to another as a stream in python we need to pickle the object and pass it to the pipe stream. In this example I've used Numpy arrays but this could be applied to any object that can be pickled in Python. This took far too long to get working and I could find little information online on how to put it all together so here it is. This code is Python 3 only, I've only run this on a Mac.
I've used binary as the stream rather than text purley becuase of effiencies. Numpy arrays can get huge! This means readline() is not
going to work. Instead, I send a single control byte , 1, for data and 0 for stop. This could be extended to include other control operations.
I then send the length of the data as a 8 byte int, followed by the data itself.
#Capture and stream a webcam To capture using the iSight camera on a Mac, or infact any other webcam connected to the Mac, we can use FFmpeg. First get a list of the devices installed.
ffmpeg -f avfoundation -list_devices true -i ""
This will list the aviable video and audio devices.
The below will capture at 30fps and the set video size to a file.
ffmpeg -f avfoundation -framerate 30 -video_size 640x480 -i "0:none" out.avi
OpenCV does a reasonable job of reading videos from file or webcams. It's simple and mostly works. When it comes to writing videos, it however leaves a lot to be desired. There is little control over the codecs and it is almost impossible to know which codecs are installed. It also wants to know things like the frame size at intailisation. This isn't always a problem, but if you don't know it yet it means you have to set up the video writer inside your main processing loop.
To make something as cross-platform compatible as possible it would be nice to use FFmpeg. There are a few python wrappers around, but as far as I can tell they are mainly used for transcoding type applications. One solution is run FFmpeg as a subprocess and set its input to accept a pipe. Then every video frame is passed through the pipe. You write this yourself, in fact it's only a few lines of code. However, the scikit-video package will do this for us, with some nice boilerplate to ma