mrgloom
mrgloom

Reputation: 21652

Opencv Inpaint for CV_32FC1?

Seems Inpaint in OpenCV can accept only 8UC1 images.

Is there exist Inpaint for CV_32FC1 images in OpenCV? Or there is some workaround how it can be used for CV_32FC1 images? Or is there any analogue of this function?

Upvotes: 0

Views: 263

Answers (1)

James Koo
James Koo

Reputation: 141

Inpaint still don't support float32 data. The issue is open state (https://github.com/Itseez/opencv/issues/4542).

You can use the code below as an alternative.

src32f.convertTo(src8b, CV_8U, 255.0f/max, min);

inpaint(src8b, mask, dst8b, inpaintRadius, flags);

dst8b.convertTo(dst32f, CV_32F, max/255.0f, -min);

//optional, copy only inpainted data
mask.convertTo(mask, CV_32F, 1 / 255.0f);
dst32f = src32 + (dst32f - src32).mul(mask);

Upvotes: 1

Related Questions