Skip to content

Instantly share code, notes, and snippets.

@ZHAOZHIHAO
Last active November 24, 2020 21:06
Show Gist options
  • Save ZHAOZHIHAO/c27abfd5647805c1d558bae1221f908d to your computer and use it in GitHub Desktop.
Save ZHAOZHIHAO/c27abfd5647805c1d558bae1221f908d to your computer and use it in GitHub Desktop.
1. Convert images to a video via ffmpeg
Example: ffmpeg -framerate 4 -i 000%3d.jpg -vcodec mpeg4 -b 800k output.mp4
Detail: https://trac.ffmpeg.org/wiki/Slideshow
The output video may be blured compared to the original images, here is a solution: https://stackoverflow.com/questions/3158235/image-sequence-to-video-quality
2. Capture a video on ubuntu via ffmpeg
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 15 -s $(xdpyinfo|grep 'dimensions:'|cut -c14-26) -i :0.0+0,0 -acodec flac -vcodec mpeg4 -qscale 0 -y ~/out.mkv ;
ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+0,0 -f alsa -ac 2 -i hw:0 -qscale 0 output.mkv;
3. Check CPU info, including supported instructions
cat /proc/cpuinfo
4. Timing a terminal command
Add time before the command you want to measure.
5. Script that copies *0002.jpg and *0001.jpg in any folder if *0002.jpg exist in that folder.
for file in ./* ; do
if find ./$file -name "*0002.jpg"|grep -q . ; then #find always returns true, so add grep
echo "Copying files in $file."
cp ./$file/*0002.jpg ./lfw_test
cp ./$file/*0001.jpg ./lfw_stored
else
echo "Only one file found in directory $file."
fi
done
6. Find available versions for tensorflow
curl -s https://storage.googleapis.com/tensorflow |xmllint --format - |grep whl
https://stackoverflow.com/questions/40416056/how-to-download-previous-version-of-tensorflow
7. Record video on ubuntu via gifine
(straightforward install)Read readme on how to install https://github.com/leafo/gifine
Note: 1. When save to a file(*.mp4/*.gif), you need to write the full name with mp4/gif, otherwise you won't get the record video.
2. When save a to file, pay attention to the framerate, the default is 60, which is different than the record framerate.
8. Add google map location to your html:
sample code: https://gist.github.com/labnol/122d4de95c6a127b1c9b
result looks like: http://bl.ocks.org/labnol/raw/122d4de95c6a127b1c9b/
9. Install docker-ce
https://docs.docker.com/install/linux/docker-ce/ubuntu/
10. Download/read online mjpg video
Here is the simplest code, which works for me. There are also other available codes.
https://stackoverflow.com/questions/21702477/how-to-parse-mjpeg-http-stream-from-ip-camera
import cv2
cap = cv2.VideoCapture('http://218.255.234.74:8020/mjpg/video.mjpg')
frame_id = 0
while True:
frame_id += 1
ret, frame = cap.read()
#cv2.imshow('Video', frame)
cv2.imwrite("./images/20180825" + str(frame_id) + ".jpg", frame)
11. ubuntu16.04, kinect v1, elasticfusion
https://www.cnblogs.com/sp-li/p/7680640.html
ubuntu16.04 kinectV2 跑ElasticFusion
https://www.cnblogs.com/sp-li/p/7680640.html
12. Alienware install ubuntu
https://blog.csdn.net/xiaohu50/article/details/78514564
13. install kinect driver with openni2
cmake .. -DBUILD_OPENNI2_DRIVER=ON
run Elasticfusion with -r -f -ftf
Ubuntu16.04安装ROS kinetic
https://blog.csdn.net/softimite_zifeng/article/details/78632211
Installing and Configuring Your ROS Environment
http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment
calibrate:
roslaunch kinect2_bridge kinect2_bridge.launch
rosrun kinect2_bridge kinect2_bridge _fps_limit:=2
calibrate for 512 424:
http://www.mamicode.com/info-detail-1886444.html
install rgbd slam for kinect2
https://blog.csdn.net/Siyuada/article/details/78927065
14. crinacle's IEM Ranking List
https://www.head-fi.org/threads/crinacles-iem-ranking-list-275-entries-06-01-19-update.857498/
15. A very simple and powerful screen recorder on Windows
https://www.screentogif.com/
16. Left / Right (Stereo) Sound Test. Check whether the wire is connected correctly to left and right earbuds.
https://www.audiocheck.net/audiotests_stereo.php
17. A cool website that generates gaussian kernel for given sigma and kernel size
http://dev.theomader.com/gaussian-kernel-calculator/
18. Calibration chessboards
https://markhedleyjones.com/projects/calibration-checkerboard-collection
19. Online edit image, add text to image
https://www.fotor.com
20. MNIST in image format
https://github.com/myleott/mnist_png
21. ImageFolder of Pytorch
https://pytorch.org/docs/stable/torchvision/datasets.html#imagefolder
https://blog.csdn.net/weixin_40123108/article/details/85099449
https://discuss.pytorch.org/t/how-to-use-the-imagefolder-function-to-load-single-channel-image/3925
22. 18 Tar Command Examples in Linux
https://www.tecmint.com/18-tar-command-examples-in-linux/
23. Resize images in a folder
import os
from PIL import Image
path = "./high_resolution/"
low_resolution_path = './resized/'
dirs = os.listdir(path)
os.makedirs(low_resolution_path, exist_ok=True)
24. Online video edit
https://mp3cut.net
https://youtu.be/heuBOEnfMOM
def resize():
for item in dirs:
print(path + item)
if os.path.isfile(path+item):
im = Image.open(path+item)
im_resize = im.resize((int(8005/3), int(1339/3)), Image.ANTIALIAS)
im_resize.save(low_resolution_path + item, 'JPEG', quality=90)
resize()
MMMMMMMMMusiccccccccccccccccccc!
The Last of the Mohicans - Promentory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment