Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualazer.darkblade

Posted 23 August 2012 - 03:26 AM

Hi,
Currently i'm doing some image processing on depth map (using OpenNI and XTion)
My depth map size is 320x240 (cannot make it 640x480 due to performance issue since we're developing a game)
The image processing should be real-time so it's fully written in fragment shader.
I generate normal map using simple cross product of 8 neighbouring pixels

Posted Image

Since the depth is noisy, i do a hack, so i calculate the 8 pixels like this

[source lang="cpp"]float step = _range/512.0; // 512.0 is tex sizefloat4 top = tex2D(_SubTex, float2(i.uv.x, i.uv.y - step));float4 right = tex2D(_SubTex, float2(i.uv.x + step, i.uv.y));//and so on....[/source]

i can adjust the _range variable and looking for farther pixels

Here's the result (raw depth map, now prepocessing at all)
Posted Image


2nd result (5x5 bilateral filter is applied first)

Posted Image

My approach to estimate normal is kinda stupid and i need suggestions to do it in a better way Posted Image
And also i'm considering to apply 5x5 median filter (i've tried 3x3 media filter but it's too small to remove noise) but it will be difficult to use such a huge 5x5 window due to implementation and performance issue

#1azer.darkblade

Posted 23 August 2012 - 03:21 AM

Hi,
CUrrently i'm doing some image processing on depth map (using OpenNI and XTion)
My depth map size is 320x240 (cannot make it 640x480 due to performance issue since we're developing a game)
The image processing should be real-time so it's fully written in fragment shader.
I want to generate normal map and i use simple cross product of 8 neighbouring pixels

Posted Image

Since the depth is noisy, i do a hack, so i calculate the 8 pixels like this


[source lang="cpp"]float step = _range/512.0; // 512.0 is tex sizefloat4 top = tex2D(_SubTex, float2(i.uv.x, i.uv.y - step));float4 right = tex2D(_SubTex, float2(i.uv.x + step, i.uv.y));//and so on....[/source]


i can adjust the _range variable and looking for farther pixels


Here's the result (raw depth map, now prepocessing at all)
Posted Image

2nd result (5x5 bilateral filter is applied first)

Posted Image

My approach to estimate normal is kinda stupid and i need suggestions to do it in a better way :P
And also i'm considering to apply 5x5 median filter (i've tried 3x3 media filter but it's too small to remove noise) but it will be difficult to use such a huge 5x5 window due to implementation and performance issue

PARTNERS