patchmatch_inpainting icon indicating copy to clipboard operation
patchmatch_inpainting copied to clipboard

Implementation of PatchMatch for image inpainting in cpp

PatchMatch for inpainting

Introduction

This repository borrows most of the code from younesse-cv. However that repository is C style, which cannot be compiled using opencv 3.x. What I did is wrapping the code using opencv 3.x API in C++ style. Thanks zvezdochiot for suggestion.

Dependencies

  • cmake > 2.8
  • opencv 3.x
  • g++-4.7

How to use

  • Download this repository

    git clone https://github.com/ZQPei/patchmatch_inpainting.git
    
  • Compile

    mkdir build
    cd build
    cmake ..
    make
    cd ..
    
  • Run
    As what does in run.sh.

    for i in 0 1 2; do
      ./build/patchmatch image_files/inpainting/image/image_0000$i.png \
                         image_files/inpainting/mask/mask_0000$i.png \
                         image_files/inpainting/output/output_0000$i.png \
                         image_files/inpainting/metrics.log \
                         $i;
    done
    

    Or simple:

      ./build/patchmatch image_files/forest/forest.bmp \
                         image_files/forest/forest_mask.png \
                         image_files/forest/forest_inpaint.png
    

Demo

mask masked image inpainting image using PatchMatch origin image

References

https://github.com/younesse-cv/PatchMatch