Skip to content

XinyuYang/VideoProcessing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VideoProcessing

Our code is able to take any picture and replace the sky background of the video. To achieve this goal, we track the video, separate the sky from the rest of the image, and then replace the sky part of the video with an image. In order to separate the sky in each frame, we calculate how likely each pixel is the sky by its brightness and height in each frame. The brighter and higher the pixel is, the more likely it is a pixel of the sky. We then replace each pixel with corresponding pixel in the picture in proportion to its likeness to the sky

File Structure

src/ - Directory with source code
  Makefile - Unix/Mac makefile for building the project with "make". 
  imagepro.[vcproj/sln/suo] - Project file for Visual Studio 2005 on Windows
  imgpro.cpp - Main program, parses the command line arguments, and calls the appropriate image functions
  R2Image.[cpp/h] - Image class with processing functions (this is the only file that you need to edit)
  R2Pixel.[cpp/h] - Pixel class 
  R2/ - A library of useful 2D geometric primitives
  jpeg/ - A library for reading/writing JPEG files
input/ - Contains example input images. 
output/ - Es empty to start -- it will contain the images produced by your program (see below)
runme.bat - a script (for Windows) that you will fill in to demonstrate execution of your program
runme.sh - same as <code>runme.bat, but for Mac OS X

Compilation

Windows

If you are developing on a Windows machine and have Visual Studio installed, use the provided project solution file (assn1.sln) in the src/ directory to build the program.

Mac/Linux machine

If you are developing on a Mac or Linux machine, cd into the src/ directory and type "make". In either case, an executable called imgpro (or imgpro.exe) will be created in the src/ directory.

How To Run

# Clone this repository
$ git clone https://github.com/XinyuYang/VideoProcessing.git

# Go into the repository
$ cd VideoProcessing

# To see all the options of operations
$ src/imgpro -help

# Image processing (Drag the image into the input folder, put the method name in the end of the command line such as brighntess,blur,harris...)
$ src/imgpro input/testpattern.jpg output/testpattern_brighntess_0.5.jpg -brightness 0.5

# Video processing (Drag the images of the video into the videoinput folder; create a new folder called "videooutput" to save the output sequence)
$ src/imgpro -video

Run your own video

Prerequisites

FFmpeg

# The FFmpeg command line syntax to convert a video into a JPG sequence
$ ffmpeg -i video.mp4 -qscale:v 1 videoinput/input%07d.jpg

# The FFmpeg command line syntax to convert a JPG sequence into a video (24fps)
$ ffmpeg -r 24 -f image2 -s 1920x1080 -i videooutput/output%07d.jpg -vcodec libx264 -crf 25 -pix_fmt yuv420p test.mp4

Demo

Alt text Link to all test videos: https://drive.google.com/drive/folders/1KeugXYiWssy2Q9LSo9bAoQtYl70Z99Oe?usp=sharing

Authors

  • Xinyu Yang
  • Weiqiu You
  • Megan Zhao

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published