GithubHelp home page GithubHelp logo

make-j64 / camera-pipeline Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anyong298/camera-pipeline

0.0 0.0 0.0 22.64 MB

License: MIT License

Python 2.15% Makefile 0.45% C++ 95.78% C 0.71% MATLAB 0.90% CMake 0.01%

camera-pipeline's Introduction

Camera Pipeline

Authors: Prikshet Sharma, Oliver Ziqi Zhang

University of Rochester

The under development ISP pipeline is written in Halide that aims optimize optical systems and camera pipeline for computer vision and computational photography applications. Feel free to contact the co-author of the pipeline and the author of this README at [email protected]

Getting Started

Mix and match the various pipeline stages by editing pipeline.cpp

Command to compile the pipeline: make pipeline

Prerequisites

Currently, we use the OpenCV library for computing Optical Flow for the temporal denoising stage. We are implementing an Optical Flow algorithm in Halide. Download the OpenCV latest release here: https://opencv.org/releases.html

Installing the Pipeline Framework

Clone Halide: https://github.com/halide/Halide/releases

After cloning the Halide repo, copy the contents of this repo in the Halide folder.

In the subfolder pipeline, run make pipeline.

Implemented Pipeline Stages

All stages are implemented in pipeline.cpp, except 'Temporal Denoising using Optical Flow', which is implemented in temporal.cpp.

Optically Black Region (OBR)

For those who don't know, camera sensors have one edge coated with an optically black region, which is used to correct image brightness. In pipeline.cpp the function Buffer<uint8_t> obr(Buffer<uint8_t> input) averages of the intensities of the optically black region pixels, and subtracts the average from each channel of every pixel in the image.

Demosaic (Naive and Advanced)

Research shows that this stage is mandatory for any computational photography and computer vision application. This implementation is for Bayer Filters.

We implemeted two versions, naive and advanced.

The naive version Buffer<uint8_t> demosaic_naive(Buffer<uint8_t> input) naively averages the adjacent pixels to compute current pixel(for each color channel).

Advanced Demosaic Buffer<uint8_t> demosaic(Buffer<uint8_t> input0) is implemented using this research paper.

Spatial denoising

Spatial denoising comprises of a spatial and a range filter. Explanation of the implementation: Suppose the noisy image is composed of small n x n pixel tiles.

Concise Spatial Filter Algorithm

  1. Multiply each pixel in a given tile by a weight--the weight is a function (standard gaussian) of the pixel's displacement from the central pixel of the tile.
  2. Take mean of weighted pixels.
  3. Use the mean to denoise the tile's central pixel. (See Spatial Denoising Algorithm)

Concise Range Filter Algorithm

  1. Multiply each pixel in a given tile by a weight. The weight is a function (standard gaussian) of how similar the pixel is to the central pixel of the tile.
  2. Take mean of the weighted pixels in the tile.
  3. Use the mean to denoise the tile's central pixel. (See Spatial Denoising Algorithm)
  • Concise Spatial Denoising Algorithm*
  1. Multiply spatial filter mean * range filter mean *central pixel.
  2. Normalize the product. Result is the denoised version of the central pixel of the tile.
  3. Repeat for each tile in the image (for each color channel).

Research paper reference: M. Elad, β€œOn the origin of the bilateral filter and ways to improve it,” IEEE Transactions in Image Processing, vol. 11, no. 10, pp. 1141-1151, 2002.

White Balance

White balance corrects the color temperature. It takes the lightest pixel in the image, replaces it with white (R=0, G=0, B=0), and then normalizes every other pixel based on lightest pixel's previous value.

Gamma Correction

Gamma correction requires that the image be converted to YCbCr format, which hasn't yet been implemented.

Temporal Denoising using Optical Flow

Temporal Denoising performs the algorithm taken from this MIT and Microsoft research paper people.csail.mit.edu/celiu/pdfs/videoDenoising.pdf. The Optical Flow is computed using OpenCV. We're currently implementing Optical Flow in Halide.

Break down into end to end tests

An example of how to stage the pipeline is given in main.cpp. For example:

Buffer<uint8_t> stage1 = load_image("images/inputs/" + std::string(argv[1]));
Buffer<uint8_t> stage2 = denoise_no_approx(stage1);
save_image(stage2, "images/outputs/" + std::string(argv[1]) + "_obr.png");

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

See also the list of contributors who participated in University of Rochester's Visual Computing research project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • Special thanks to Yuhao Zhu for making this possible.

camera-pipeline's People

Contributors

zendevil avatar ziqizh avatar yuhao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.