Restore the selected region in an image using the region neighborhood (to fill missing areas of image or erase blemishes).
First overload needs a mask to identify the area to be inpainted.
Second overload builds automatically the mask using specified brush size.
Parameter
Description
mask
Inpainting mask, 8-bit 1-channel image. Non-zero pixels indicate the area that needs to be inpainted
range
Radius of a circular neighborhood of each point inpainted that is considered by the algorithm (3 is a reasonable starting value)
method
Inpainting algorithm, either Navier-Stokes method (ievINPAINT_NS) or the Telea algorithm (ievINPAINT_TELEA)
brushWidth
Width of area to inpaint
brushHeight
Height of area to inpaint
subimageRect
Rectangle of area of interest (which includes the area to inpaint)
// Perform inpainting on a specified rect of an image
rangeSize := 4; roiSize := ( (selRect.Width + selRect.Height) div 2 + rangeSize * 2); // Ensure region of interest (ROI) > selection size
// Get ROI ipRect := IEVisionRect( selRect.Left + selRect.Width div 2 - roiSize div 2, selRect.Top + selRect.Height div 2 - roiSize div 2, roiSize, roiSize ); // Ensure ROI rect is inside image rect ipRect := IEVisionLib.createMath().rectIntersect(ipRect, IEVisionRect(0, 0, ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height));
// perform inpaint if valid ROI if (ipRect.width > 0) and (ipRect.height > 0) then begin ImageEnView1.IEBitmap.GetIEVisionImage().InPaint( selRect.Width, selRect.Height, ipRect, rangeSize, ievINPAINT_TELEA ); ImageEnView1.Update(); end;