Smoothing image to a Gradient-like state

asked 2017-07-29 03:05:09 -0600

Mohammad gravatar image

I have a dataset of Depth images where the structure is mostly like this:

image description

Is there a way I could use OpenCV to convert this block-like artifacts to a smooth gradient-like image? to something like this:

image description

Using Gaussian blurring actually blurs the details too much to be useful... Here's an example image I want to smooth:

image description

Thanks

edit retag flag offensive close merge delete

Comments

Actually my best guess is your depth data is higher precision than the data in which you store it in OpenCV. That is why you get these discretized values (we got similar issues with some depth cameras). Make sure you import the full precision data and store it in the correct container. The issue will remove itself completely.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-07-29 07:59:37 -0600 )edit

And do not apply smoothing on the image. That is actually altering data, while my suggestion keeps the data as is.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-07-29 07:59:44 -0600 )edit

Actually this is an example from the Sun RGBD dataset... the only thing I've done on it is Histogram Equalization... but even without Histogram Equalization, nearly all of the images are like the one I showed above... Opening them with different viewers always gives the same style even without altering them in any way... I wanted the smoothing for some other reason and I was actually curious if there was a way to smooth these images without blurring them out...

Mohammad gravatar imageMohammad ( 2017-07-29 10:48:57 -0600 )edit

Did you tried CLAHE?

jsxyhelu gravatar imagejsxyhelu ( 2017-07-30 08:15:50 -0600 )edit

I did... But since CLAHE is also another Histogram Equalization algorithm, it doesn't do anything about smoothing the image... only the intensities change but the raggedness stays the same...

Mohammad gravatar imageMohammad ( 2017-07-31 01:03:44 -0600 )edit

Look at their video ... their data in there is not discretized. Again, most viewers are not made for reading depth data. Can you at least look up the precision of these images?

StevenPuttemans gravatar imageStevenPuttemans ( 2017-07-31 08:14:23 -0600 )edit

Thanks for coming along with me and having patience... how can I check the precision of depth images? I guess it's not the resolution nor the bit depth...

Mohammad gravatar imageMohammad ( 2017-08-01 12:36:11 -0600 )edit

Well lets start with bit depth. For example, if it is 12 bit, which is frequently used in computer vision, reading it through opencv basic API reduces is to 8 bit, hence the quantization of values.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-08-02 02:40:39 -0600 )edit

I went and checked the Sun-RGBD dataset images... the bit depth for the images is 16 bits... What should I do?

Mohammad gravatar imageMohammad ( 2017-08-02 11:35:24 -0600 )edit

Ok so now update the question above with the exact code you are using to load the images from the database. Probably you will be opening 16bit images in 8bit containers and thus clipping happens.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-08-03 02:47:28 -0600 )edit