All Projects → kuan-wang → The_bilateral_solver

kuan-wang / The_bilateral_solver

Fast Bilateral Solver implementation with C++ and demos

Projects that are alternatives of or similar to The bilateral solver

Tensorflow object counting api
🚀 The TensorFlow Object Counting API is an open source framework built on top of TensorFlow and Keras that makes it easy to develop object counting systems!
Stars: ✭ 956 (+998.85%)
Mutual labels:  opencv, image-processing
Seeds Revised
Implementation of the superpixel algorithm called SEEDS [1].
Stars: ✭ 48 (-44.83%)
Mutual labels:  opencv, image-processing
Graph Based Image Segmentation
Implementation of efficient graph-based image segmentation as proposed by Felzenswalb and Huttenlocher [1] that can be used to generate oversegmentations.
Stars: ✭ 31 (-64.37%)
Mutual labels:  opencv, image-processing
Vehicle counting tensorflow
🚘 "MORE THAN VEHICLE COUNTING!" This project provides prediction for speed, color and size of the vehicles with TensorFlow Object Counting API.
Stars: ✭ 582 (+568.97%)
Mutual labels:  opencv, image-processing
Colorfilters
Image thresholding in multiple colorspaces.
Stars: ✭ 60 (-31.03%)
Mutual labels:  opencv, image-processing
Road Detection And Tracking
Involves the OpenCV based C++ implementation to detect and track roads for almost realtime performance
Stars: ✭ 17 (-80.46%)
Mutual labels:  opencv, image-processing
Grabcutweb
Full web grabcut example using opencvjs
Stars: ✭ 40 (-54.02%)
Mutual labels:  opencv, image-processing
Pycair
Content aware image resizing
Stars: ✭ 425 (+388.51%)
Mutual labels:  opencv, image-processing
Catt
Detecting the temperature from an infrared image
Stars: ✭ 60 (-31.03%)
Mutual labels:  opencv, image-processing
Opencv Face Filters
Snapchat-like Face Filters in OpenCV
Stars: ✭ 51 (-41.38%)
Mutual labels:  opencv, image-processing
Qupath
QuPath - Bioimage analysis & digital pathology
Stars: ✭ 503 (+478.16%)
Mutual labels:  opencv, image-processing
Pyscenedetect
🎥 Python and OpenCV-based scene cut/transition detection program & library.
Stars: ✭ 1,203 (+1282.76%)
Mutual labels:  opencv, image-processing
Tiler
Tiler is a tool to create an image using all kinds of other smaller images (tiles). It is different from other mosaic tools since it can adapt to tiles with multiple shapes and sizes (i.e. not limited to squares).
Stars: ✭ 4,681 (+5280.46%)
Mutual labels:  opencv, image-processing
Prlib
Pre-Recognition Library - library with algorithms for improving OCR quality.
Stars: ✭ 18 (-79.31%)
Mutual labels:  opencv, image-processing
Caer
High-performance Vision library in Python. Scale your research, not boilerplate.
Stars: ✭ 452 (+419.54%)
Mutual labels:  opencv, image-processing
Opencv Tutorials
Tutorials for learning OpenCV in Python from Scratch
Stars: ✭ 36 (-58.62%)
Mutual labels:  opencv, image-processing
Pythonsift
A clean and concise Python implementation of SIFT (Scale-Invariant Feature Transform)
Stars: ✭ 374 (+329.89%)
Mutual labels:  opencv, image-processing
Gocv
Go package for computer vision using OpenCV 4 and beyond.
Stars: ✭ 4,511 (+5085.06%)
Mutual labels:  opencv, image-processing
Facer
Simple (🤞) face averaging (🙂) in Python (🐍)
Stars: ✭ 49 (-43.68%)
Mutual labels:  opencv, image-processing
Go Cv
Computer Vision package in pure Go taking advantage of SIMD acceleration
Stars: ✭ 66 (-24.14%)
Mutual labels:  opencv, image-processing

The Fast Bilateral Solver (Contributed to OpenCV)

The Bilater Solver is a novel algorithm for edge-aware smoothing that combines the flexibility and speed of simple filtering approaches with the accuracy of domain-specific optimization algorithms. This algorithm was presented by Jonathan T. Barron and Ben Poole as an ECCV2016 oral and best paper nominee. Algorithm details and applications can be found in https://arxiv.org/pdf/1511.03296.pdf.

  • This repo is the draft codes for my GSOC2017 (google summer of code) project. The opencv_contrib branch I pull request to OpenCV was not successfully merged in master after GSOC2017 and I've no time to fix the issues.
  • [New!] Fortunately and thankfully, last year this project has been contributed to opencv as a file fbs_filter.cpp in ximgproc of opencv_contrib with the help of berak, Alexander Alekhin and Jukka Komulainen. Really thanks!
  • If you want to use the cpp version of fast bilateral solver, just compile the opencv with opencv_contrib. And This repo has some interesting demos you can play.

Introduce

Algorithm

SBS

  • Splat+Blur+Slice Procedure The two bilateral representations we use in this project, here shown filtering a toy one-dimensional grayscale image of a step-edge. This toy image corresponds to a 2D space visualized here (x = pixel location, y = pixel value) while in the paper we use RGB images, which corresponds to a 5D space (XYRGB). The lattice (Fig 2a) uses barycen-tric interpolation to map pixels to vertices and requires d+1 blurring operations, where d is the dimensionality of the space. The simplified bilateral grid (Fig 2b) uses nearest-neighbor interpolation and requires d blurring operations which are summed rather than done in sequence. The grid is cheaper to construct and to use than the lattice, but the use of hard assignments means that the filtered output often has blocky piecewise-constant artifacts.

  • Diagrammatize

st=>start: Start
e=>end

inr=>operation: Imput reference image
int=>operation: Imput target image
bg=>operation: construct BilateralGrid
sl=>operation: construct SliceMatrix
bl=>operation: construct BlurMatrix
A1=>operation: construct AMatrix step1
A2=>operation: construct AMatrix step2
cg=>operation: execute ICCG
out=>operation: output the resolt


st->inr->bg->sl->bl->A1->int->A2->cg->out->e



Installation Instructions

Build OpenCV

This is just a suggestion on how to build OpenCV 3.1. There a plenty of options. Also some packages might be optional.

sudo apt-get install libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
git clone https://github.com/Itseez/opencv.git
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D WITH_CUDA=OFF ..
make -j
sudo make install

Build The_Bilateral_Solver

git clone https://github.com/THUKey/The_Bilateral_Solver.git
cd The_Bilateral_Solver/build
cmake ..
make

This will create three executable demos, that you can run as shown in below.

Depthsuperresolution

target the target.

./Depthsuperres

result This result(use bilateral solver) is far from the optimal performance, which means there are some extra work to do, such as to patiently adjustment parameters and to optimize the implementation.

./Latticefilter reference.png target.png

enter image description here This result(use permutohedral_lattice) is quite nice.

Colorization

./Colorize rose1.webp

draw draw image, then press "ESC" twice to launch the colorization procession. colorized colorized image. you could change the rose1.webp to your own image. Thanks for timuda, his colorization implementation help me a lot.

PermutohedralLatticeFilter

./Latticefilter flower8.jpg

In Barron's another paper Fast Bilateral-Space Stereo for Synthetic Defocus, both bileteral_solver and permutohedral lattice are used to do experiment, and the result shows that bilateral_solver is faster than permutohedral lattice technique, but the permutohedral is more accurate than the bilateral_solver. In other words, this is the tradeoff between time and accuracy. Actually, both two techniques' tradeoff can be worthwhile in appropriate condition. So I want to implement both two technique for more widely use. output filter_output. input filter_input.


Basic Usage

Depthsuperresolution:

	BilateralGrid BiGr(mat_R);
	BiGr.Depthsuperresolution(mat_R,mat_T,sigma_spatial,sigma_luma,sigma_chroma);

Firstly, we use the reference image mat_R construct a BilateralGrid, the we launch a depthsuperresolution to optimize the target image mat_T. The parameter sigma_spatial is the Gaussian kernal for coordinate x y, similarly , the sigma_luma correspond luma(Y) and the sigma_chroma correspond chroma(UV). It need to be noted that he mat_R should be covert to YUV form before construct the bilateralgrid.

Colorization

	InputImage InImg(mat_in);
	mat_bg_in = InImg.get_Image(IMG_YUV);
	InImg.draw_Image();
	mat_bg_draw_in = InImg.get_Image(IMG_DRAWYUV);
	BilateralGrid BiGr(mat_bg_in);
	BiGr.Colorization(mat_in,mat_bg_draw_in);

Similar to above, we need to covert the imput image mat_in(gray image for colorization) to YUV form, then draw the gray image. when the drawing finished, press "ESC" twice to launch the colorization procession. the result will be save in specified folder.

PermutohedralLattce

	bilateral(im,spatialSigma,colorSigma);

Similar to BilateralGrid, the PermutohedralLattce also need spatial parameter and the color parameter to specified the Gaussian kernel.


Schedule

Item State Remark
C++ code of the core algorithm Completed also python
Depthsuperres module Completed need optimize
Colorization module Completed choose ICCG or others
PermutohedralLatticeFilter Completed increse Compatibility
Semantic Segmentation optimizer Ongoing try apply in CNN
Contribute project to OpenCV Ongoing coding testfile
Detail Documentation Ongoing writing toturial

Reference

article{BarronPoole2016,
author = {Jonathan T Barron and Ben Poole},
title = {The Fast Bilateral Solver},
journal = {ECCV},
year = {2016},
}
@article{Barron2015A,
author = {Jonathan T Barron and Andrew Adams and YiChang Shih and Carlos Hern\'andez},
title = {Fast Bilateral-Space Stereo for Synthetic Defocus},
journal = {CVPR},
year = {2015},
}
@article{Adams2010,
author = {Andrew Adams	Jongmin Baek	Abe Davis},
title = {Fast High-Dimensional Filtering Using the Permutohedral Lattice},
journal = {Eurographics},
year = {2010},
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].