Skip to content

"Kinect Smoothing" helps you to smooth and filter the Kinect depth image as well as trajectory data

License

Notifications You must be signed in to change notification settings

intelligent-control-lab/Kinect_Smoothing

Repository files navigation

Kinect Depth Image Smoothing

  • "Kinect Smoothing" helps you to smooth and filter the Kinect depth image and trajectory data.

How to Use it

  • Installation
git clone https://github.com/intelligent-control-lab/Kinect_Smoothing.git
pip install -r requirements.txt
  • Running

    Please check example.ipynb and kinect_preprocess_example.py.

  • Data preparation
    We saved many frames of depth images in data/sample_img.pkl and saved corresponding frames of position coordinates in data/sample_pose.pkl
    e.g. sample_img = [ [ image_1 ] , [ image_2 ], ... , [ image_t ] ]. each image_i has a shape of (width, height).
    In case if anyone wants to use it for multiple files, then the code below should work.

import joblib 
import cv2
import glob 

X_data = []
file_lists = glob.glob("/*.bmp")  # image path
for files in sorted(file_lists):
    if files.endswith(".bmp"):
        image = cv2.imread(files)
        X_data.append(image)
        joblib.dump(X_data, 'image_frames.pkl')

Features

1 . Depth Image Smoothing

2 . Trajectory Smoothing

  • Crop Filter:

    The x, y coordinates of the trajectory were captured by some object detection algorithms (e.g. Openpose). Sometimes the object will be positioned on the background, and the depth coordinates might register as invalid values on the Kinect. The Crop-Filter crops the invalid value and run some interpolation methods to replace it. The methods for invalid value replacement are as follows:

  • Gradient Crop Filter:

    Similar to Crop-Filter, the GradientCrop_Filter crops the large gradient values between near pixels maybe miss-labeled as background. The methods for invalid value replacement are as follows:

    • conventional interpolation methods: such as "zero","linear","slinear","quadratic","cubic","previous","next","nearest".
    • "pchip": PCHIP 1-d monotonic cubic interpolation.
    • "akima": Akima 1D Interpolator.
  • Smooth Filter:

    Smooth the data with a specific filter, which is effectively reducing the anomaly in the trajectory series. The methods for smoothing filter are as follows:

    • "kalman": smooth the signal with Kalman filter, refer to Fundamentals of Kalman Filtering
    • "wiener": smooth the signal with Wiener filter
    • "median": smooth the signal with median filter
    • "moving_average": smooth the signal with moving average filter
    • "exponential_moving_average": smooth the signal with exponential moving average filter
  • Motion Sampler:

    Motion detection and filtering out the stationary part of the trajectory. (Significant movements are preserved.)

3 . Real World Coordinate Calculation

  • Coordinate Calculator

    Transforming the pixel level coordinate of Kinect image to the real world coordinate.

About

"Kinect Smoothing" helps you to smooth and filter the Kinect depth image as well as trajectory data

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published