Skill Session INTRODUCTION TO VIDEO PROCESSING PROGRAMMING BASICS
Skill Session INTRODUCTION TO VIDEO PROCESSING PROGRAMMING BASICS AND TOOLS Spring 2018 Jeehyun Choe, Soonam Lee
OUTLINE INTRO BASICS TOOLS INSTALLATION SIMPLE EXAMPLES CONTACT 2 February, 2018
INTRO http: //www. svcl. ucsd. edu/projects/ tracking/ www. nanit. com 3 February, 2018 How-old. net
INTRO Detecting Parking Violation (License Plate Reader) http: //www. pyimagesearch. com/2015/05/25/basic-motion-detection-and-tracking-with-python-and-opencv/ 4 February, 2018
INTRO Video Recognition in Clarifai Image Recognition in Tensor. Flow https: //www. clarifai. com/demo giant panda, panda bear, coon bear, Ailuropoda melanoleuca (score = 0. 88493) indri, indris, Indri indri, Indri brevicaudatus (score = 0. 00878) lesser panda, red panda, bear cat, cat bear, Ailurus fulgens (score = 0. 00317) custard apple (score = 0. 00149) earthstar (score = 0. 00127) https: //www. tensorflow. org/tutorials/image_recognition 5 February, 2018
INTRO http: //www. fakeapp. org/ There's also a nightmarish version of Cage as Gollum in "Lord of the Rings. " February, 2018
BASICS IMAGE AND VIDEO Definitions [1] (Still) Image • Visual information as a spatial distribution of intensity that is constant with respect to time Video • Visual information, including still images and time-varying images (a spatio-temporal intensity changes with time) [1] N. M. Tekalp, Digital video processing, Prentice Hall Signal Processing Series, 1995. 7 February, 2018
BASICS IMAGE AND VIDEO Image x y Video x t y 8 February, 2018
BASICS IMAGE AND VIDEO Image properties • Spatial resolution (1920 x 1080, …) • Aspect ratio (16: 9, …) • Color space (gray, RGB …) • Color depth / bits per channel / bits per color (#channels x 8 -bit) • Image Compression Format (jpeg, …) 9 February, 2018
BASICS IMAGE AND VIDEO R G B Bit depth: 8 bits Q: How many different colors can be represented? 10 February, 2018
BASICS IMAGE AND VIDEO Video properties • Spatial resolution, color space, color depth • Temporal resolution – Number of frames per second (fps) – “frame rate” • Video Compression Format (mpeg 4, …) 11 February, 2018
BASICS IMAGE AND VIDEO 0 1 2 3 4 5 6 7 8 9 10 10 frames Q: What is duration in seconds if 12 February, 2018 ?
TOOLS FFMPEG ffmpeg • a useful tool to record, convert and stream audio and video • usages – converting between different formats – cropping the video in spatial or temporal domain – checking video properties 13 February, 2018
TOOLS FFMPEG $ ffmpeg -i ocr. avi -ss 00: 00. 0 -c copy -t 00: 30. 0 ocr 30 sec. avi $ ffmpeg -i in. mp 4 -filter: v "crop=out_w: out_h: x: y" out. mp 4 $ ffmpeg -i video. format image%03 d. png $ ffmpeg -r 29. 97 -i img%03 d. png -qscale: v 0 our. Vid. avi 14 February, 2018
TOOLS FFMPEG EXAMPLE • • Go to https: //ecegrid. ecn. purdue. edu/main/ Log in with guest account (distributed during lab) Open terminal: Applications->System Tools->Terminal Download Video • • wget https: //goo. gl/z 8 DHsd mv z 8 DHsd vid. avi • [Option] ffmpeg -i in. mp 4 -filter: v "crop=out_w: out_h: x: y" out. mp 4 • Make Directory • • Convert video to sequence of images in separate file • 15 mkdir <DIR NAME> ffmpeg -i vid. avi <DIR NAME>/image%04 d. png February, 2018
TOOLS OPENCV Open. CV (Open Source Computer Vision) • A library tool useful for Image/Video Processing http: //docs. opencv. org/2. 4/doc/tutorials/objdetect/cascade_classifier. html#cascade-classifier • C++, C, Python and Java interfaces • Windows, Linux, Mac OS, i. OS and Android 16 February, 2018
TOOLS POPULAR PROGRAMMING LANGUAGES [Article] Interactive: The Top Programming Languages 2017 2016 http: //spectrum. ieee. org/static/interactive-the-top-programming-languages-2017 17 February, 2018
TOOLS C++ /PYTHON /MATLAB C++ with Open. CV Python with Open. CV Matlab Fast Slower than C++ Slow Open source Proprietary Installation can be complicated Easy installation for prebuilt binaries Easy to install gnuplot 18 matplotlib February, 2018 Built-in functions for graph plotting
INSTALLATION OPENCV-PYTHON Open. CV-Python Tutorials • Installing Open. CV in Linux • Installing Open. CV-Python in Windows – Installing Open. CV from prebuilt binaries • Python 2. 7. x • Numpy • Matplotlib • Open. CV 3. x 19 February, 2018
INSTALLATION OPENCV-PYTHON IDE • Eclipse – Installing Py. Dev (Python IDE for Eclipse) • Py. Charm 20 February, 2018
SIMPLE EXAMPLE: VIDEO READ/SHOW OPENCV-PYTHON Input video file Video property Processing each frame 21 February, 2018
SIMPLE EXAMPLE: VIDEO READ/SHOW OPENCV-PYTHON 22 Running in Windows from Eclipse February, 2018
SIMPLE EXAMPLE: VIDEO READ/SHOW OPENCV-PYTHON 23 Running in Linux from Terminal February, 2018
SIMPLE EXAMPLE: VIDEO READ/SHOW OPENCV-C++ Input video file Video property 24 February, 2018
SIMPLE EXAMPLE: VIDEO READ/SHOW OPENCV-C++ Processing each frame 25 February, 2018
SIMPLE EXAMPLE: VIDEO READ/SHOW OPENCV-C++ Running in Linux from Terminal 26 February, 2018
SIMPLE EXAMPLE: VIDEO READ/SHOW MATLAB Input video file Video property Processing each frame 27 February, 2018
CONTACTS Jeehyun Choe (choe 11@purdue. edu) Soonam Lee (lee 714@purdue. edu) 28 February, 2018
- Slides: 28