### Navigation

- index
- next |
- previous |
- OpenCV 3.0.0-dev documentation »
- OpenCV API Reference »
- photo. Computational Photography »

# Inpainting

## inpaint

Restores the selected region in an image using the region neighborhood.

C++:`` void `inpaint`(InputArray src, InputArray inpaintMask, OutputArray dst, double inpaintRadius, int flags)

Python:`` `cv2.``inpaint`(src, inpaintMask, inpaintRadius, flags[, dst]) → dst

C:`` void `cvInpaint`(const CvArr* src, const CvArr* inpaint_mask, CvArr* dst, double inpaintRange, int flags)

  Parameters: | src – Input 8-bit 1-channel or 3-channel image. inpaintMask – Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that needs to be inpainted. dst – Output image with the same size and type as `src` . inpaintRadius – Radius of a circular neighborhood of each point inpainted that is considered by the algorithm. flags – Inpainting method that could be one of the following: INPAINT_NS Navier-Stokes based method [Navier01] INPAINT_TELEA Method by Alexandru Telea [Telea04].

The function reconstructs the selected image area from the pixel near the area boundary. The function may be used to remove dust and scratches from a scanned photo, or to remove undesirable objects from still images or video. See http://en.wikipedia.org/wiki/Inpainting for more details.

Note

- An example using the inpainting technique can be found at opencv_source_code/samples/cpp/inpaint.cpp
- (Python) An example using the inpainting technique can be found at opencv_source_code/samples/python2/inpaint.py

[Telea04] | Telea, Alexandru. “An image inpainting technique based on the fast marching method.” Journal of graphics tools 9, no. 1 (2004): 23-34.

[Navier01] | Bertalmio, Marcelo, Andrea L. Bertozzi, and Guillermo Sapiro. “Navier-stokes, fluid dynamics, and image and video inpainting.” In Computer Vision and Pattern Recognition, 2001. CVPR 2001. Proceedings of the 2001 IEEE Computer Society Conference on, vol. 1, pp. I-355. IEEE, 2001.

## Help and Feedback

You did not find what you were looking for?

- Ask a question on the Q&A forum.
- If you think something is missing or wrong in the documentation, please file a bug report.

### Navigation

- index
- next |
- previous |
- OpenCV 3.0.0-dev documentation »
- OpenCV API Reference »
- photo. Computational Photography »