Skip to Content
Mastering Computer Vision with TensorFlow 2.x
book

Mastering Computer Vision with TensorFlow 2.x

by Krishnendu Kar
May 2020
Beginner to intermediate
430 pages
10h 39m
English
Packt Publishing
Content preview from Mastering Computer Vision with TensorFlow 2.x

Image inpainting using OpenCV

OpenCV provides two image inpainting methods, as follows:

  • cv.INPAINT_TELEA is based on the paper An Image Inpainting Technique Based on the Fast Marching Method, by Alexandru Telea in 2004. This method replaces the pixel in the neighborhood to be inpainted by the normalized weighted sum of all the known pixels in the neighborhood. More weight is given to those pixels lying near to the point and on the boundary contours. Once a pixel has been inpainted, it moves to the next nearest pixel using the fast marching method:
import numpy as npimport cv2 as cvimg = cv.imread('/home/.../krishmark.JPG')mask = cv.imread('/home/.../markonly.JPG',0)dst = cv.inpaint(img,mask,3,cv.INPAINT_TELEA)cv.imshow('dst',dst)cv.waitKey(0) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Computer Vision with TensorFlow 2

Hands-On Computer Vision with TensorFlow 2

Benjamin Planche, Eliot Andres

Publisher Resources

ISBN: 9781838827069Supplemental Content