Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Interpolation Of Data Stored As An Array (Virtual Sandbox Project)

Discussion in 'Scripting' started by Vitally, Aug 8, 2015.

  1. Vitally

    Vitally

    Joined:
    Aug 29, 2012
    Posts:
    8
    Hi guys,

    So a while back I watched a video of an interactive sandbox, using a kinect and a projector it rendered a topographical overlay onto the sand. I decided this was pretty damn cool and I wanted to make my own version of this device!

    My Inspiration:

    and so far my progress has been shockingly quick. I have created a program witch renders a 640x480px texture every one second onto a plane under a 2d camera. Its pretty cool and has the basic features necessary to display (almost) the raw kinect depth data:
    KinectRawData.PNG
    (My oscilloscope and TV sitting on my work desk)

    From here however I am a little lost, my image processing flow should look like this in the end

    Capture Depth Array From Sensor
    V
    Convert Depth Array into 2d Array for manipulation
    V
    Clean up missing data (black sections of the image)
    V
    Draw topographical lines
    V
    Apply texture
    So far I have steps 1 and 2 done well. I am very happy with my raw data output however it is rather unsightly once applied to the texture. At this point I need to start working on the code to clean up the image and fill in the missing data. I am not even sure IN THE SLIGHTEST how to go about doing this. Are there any helpful libraries for cleaning up/interpolating/polishing the data before I write it to a texture? How would I render topographical lines on this data? At this point i have a foundation but I need all the help I can get!

    Thanks so much for your help guys!
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    You probably want to run over the data with some sort of blurring function (Gaussian?) to smooth out the data points:
     
  3. Vitally

    Vitally

    Joined:
    Aug 29, 2012
    Posts:
    8
    Hey,

    Okay so I put in a blur effect, Gaussian isn't harsh enough to smooth out large areas of bad data however i do like the effect of another blur algorithm I found. It still doesn't fill missing data but it gives a less rough output:
    Blur.png
    Of course testing with a sandbox will be the definitive factor.