Skill Session INTRODUCTION TO VIDEO PROCESSING PROGRAMMING BASICS
Skill Session INTRODUCTION TO VIDEO PROCESSING PROGRAMMING BASICS AND TOOLS Spring 2017 Jeehyun Choe, Soonam Lee
OUTLINE INTRO BASICS TOOLS INSTALLATION SIMPLE EXAMPLES CONTACT 2 January, 2017
INTRO http: //www. svcl. ucsd. edu/projects/ tracking/ www. nanit. com 3 January, 2017 How-old. net
INTRO Detecting Parking Violation (Car plate recognition) http: //www. pyimagesearch. com/2015/05/25/basic-motion-detection-and-tracking-with-python-and-opencv/ 4 January, 2017
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. 5 January, 2017
BASICS IMAGE AND VIDEO Image x y Video x t y 6 January, 2017
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, …) 7 January, 2017
BASICS IMAGE AND VIDEO R G B Bit depth: 8 bits Q: How many different colors can be represented? 8 January, 2017
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, …) 9 January, 2017
BASICS IMAGE AND VIDEO 0 1 2 3 4 5 6 7 8 9 10 10 frames Q: What is duration in seconds if ? 10 January, 2017
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 11 January, 2017
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 12 January, 2017
TOOLS FFMPEG EXAMPLE • • • Go to https: //ecegrid. ecn. purdue. edu/main/ Log in with guest account (distributed during lab) Open terminal • • Download Video • • mkdir <DIR NAME> Convert video to sequence of images in separate file • 13 wget https: //engineering. purdue. edu/~choe 11/vid. avi Make Directory • • Applications->System Tools->Terminal ffmpeg -i vid. avi <DIR NAME>/image%04 d. png January, 2017
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 14 January, 2017
TOOLS POPULAR PROGRAMMING LANGUAGES [Article] Interactive: The Top Programming Languages 2016 Languages popular on open source hubs 2015 http: //spectrum. ieee. org/static/interactive-the-top-programming-languages-2016 15 January, 2017
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 16 matplotlib January, 2017 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 17 January, 2017
INSTALLATION OPENCV-PYTHON IDE • Eclipse – Installing Py. Dev (Python IDE for Eclipse) • Py. Charm 18 January, 2017
SIMPLE EXAMPLE: VIDEO READ/SHOW OPENCV-PYTHON Input video file Video property Processing each frame 19 January, 2017
SIMPLE EXAMPLE: VIDEO READ/SHOW OPENCV-PYTHON 20 Running in Windows from Eclipse January, 2017
SIMPLE EXAMPLE: VIDEO READ/SHOW OPENCV-PYTHON 21 Running in Linux from Terminal January, 2017
SIMPLE EXAMPLE: VIDEO READ/SHOW OPENCV-C++ Input video file Video property 22 January, 2017
SIMPLE EXAMPLE: VIDEO READ/SHOW OPENCV-C++ Processing each frame 23 January, 2017
SIMPLE EXAMPLE: VIDEO READ/SHOW OPENCV-C++ Running in Linux from Terminal 24 January, 2017
SIMPLE EXAMPLE: VIDEO READ/SHOW MATLAB Input video file Video property Processing each frame 25 January, 2017
CONTACTS Jeehyun Choe (choe 11@purdue. edu) Soonam Lee (lee 714@purdue. edu) Let us know if you want further Skill Session on any Specific Topic 26 January, 2017
- Slides: 26