You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|| David Shean on 2013-04-08 06:12
|| Priority: Normal
|| Affected: None
|| Category: photo
|| Tracker: Feature
|| Difficulty: None
|| PR:
|| Platform: None / None
Inpainting support for float32 data
The geospatial data community often works with single-band int16 or float32 raster data (e.g. digital surface models [DSM], spectrometer data) that contain "holes" of nodata pixels (e.g., bad pixels, data drops during transfer from spacecraft, occlusions in photogrammetric DSM products). For some analyses, it is desirable to preserve these nodata values, but often, a continuous data product is required (e.g. removal of buildings to produce a digital terrain model, using a DSM for image orthorectification, etc.).
Contemporary inpainting methods offer highly effective hole-filling capabilities. If the OpenCV inpainting functionality offered support for float32 inputs, it would definitely be used by new communities outside of traditional CV/photography. Members of the astronomy community also face similar issues (http://astrolitterbox.blogspot.com/2012/03/healing-holes-in-arrays-in-python.html).
A quick glance at https://github.com/Itseez/opencv/blob/master/modules/photo/src/inpaint.cpp suggests that the output of both single-band inpainting methods is recast to 8-bit:
icvTeleaInpaintFMM
sat = (float)((Ia/s+(Jx+Jy)/(sqrt(Jx*Jx+Jy*Jy)+1.0e-20f)+0.5f));
CV_MAT_ELEM(*out,uchar,i-1,j-1) = cv::saturate_cast<uchar>(sat);
icvNSInpaintFMM
Ia += (float)w * (float)(CV_MAT_ELEM(*out,uchar,km,lm));
CV_MAT_ELEM(*out,uchar,i-1,j-1) = cv::saturate_cast<uchar>((double)Ia/s); #s is also float
Seems like it would be relatively straightforward to support CV_32F? I'm still learning, and I'm not quite ready to tackle on my own at this point. Thanks.
History
François-Xavier Thomas on 2015-05-04 14:50
I second this. I got a somewhat working version by pre-scaling my raster array to 8-bit, then scaling it back after calling @cv2.inpaint@, however it would be great if that use case were covered by OpenCV directly.
The text was updated successfully, but these errors were encountered:
Transferred from http://code.opencv.org/issues/2944
Inpainting support for float32 data
History
François-Xavier Thomas on 2015-05-04 14:50
The text was updated successfully, but these errors were encountered: