Git Product home page Git Product logo

opencv3's Introduction

opencv3

Fast image segmentation using MaxFlow/MinCut Boykov-Kolmogorov algorithm

Opencv grabcut algorithm is pretty good, but slow for large images. One bottleneck is the function GCGraph::MaxFlow, which implements the max-flow/min-cut Boykov-Kolmogorov algorithm. We propose a simple parallel version of this algorithm, providing a significant speedup.

  • We extend the class GCGraph (cf. file gcgraph.hpp) with an overloaded function maxFlow(int r). It computes the max flow corresponding to a subgraph of the initial graph.

  • We implement a function constructGCGraph_slim (cf. grabcut.cpp) building a partially reduced graph. The reduction is based on a paper of Scheuermann and Rosenhahn : https://pdfs.semanticscholar.org/92df/9a469fe878f55cd0ef3d55477a5f787c47ba.pdf

  • We implement a mulithreaded version of the function estimateSegmentation() (cf. file grabcut.cpp), using our overloaded function maxFlow(). Threads run on disjoint subgraphs, corresponding to disjoint subregions of the image, thus no synchronization is needed. The residual graph is updated and the partial flows are added. A second parallel run with slightly shifted regions is performed to process inter-region edges. A last call to maxFlow() on the whole residual graph achieves the segmentation.

The final segmentation is an exact min cut. 

Tests with a 24 M pixel image :

 maxFlow()                                      48 s           grabcut()                63 s
 
 parallel maxFlow() (64 regions, 8 threads)     18 s           parallel grabcut()       34 s

History

Most recent branch is workers

Last version is a test-only version

files

dist/sources/modules/imgproc/include/opencv2/imgproc.hpp

dist/sources/modules/imgproc/src/gcgraph.hpp

dist/sources/modules/imgproc/src/grabcut.cpp

opencv3's People

Contributors

bvirxx avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.