KBMOD (Kernel-Based Moving Object Detection)
Clone or download
Latest commit ac3449c Nov 2, 2018



An image processing library for moving object detection implemented with GPUs.
Based on a Maximum Likelihood detection algorithm for moving astronomical objects.

Build Status LicenseDOI

KBMOD is a set of Python tools to search astronomical images for moving objects based upon method of maximum likelihood detection.



The packages required to build the code are:

  • python3 development headers
  • Scipy (Numpy, Matplotlib)
  • Scikit-learn
  • Cuda 8.0
  • CMake 3

To install:
Open search/pybinds/CmakeLists.txt and verify in the "include_directories" section that the paths to the python headers and to the cuda installation are correct.

Then run source install.bash This will build the python library and run the tests.

If you log out, next time run source setup.bash to reappend the library to the python path


A short example injecting a simulated object into a stack of images, and then recovering it.

from kbmodpy import kbmod as kb
import numpy as np

# Create a point spread function
psf = kb.psf(1.5)

# load images from list of file paths
imgs =  [ kb.layered_image(file) for file in example_files ]

# Specify an artificial object
flux = 175.0
position = (100.7, 150.3)
velocity = (50, 35)

# Inject object into images
for im in imgs:
                  flux, psf)

# Recover the object by searching a wide region
velocity_guess = (40, 40)
radius = 20
min_lh = 9.0
min_obs = 10
stack = kb.image_stack(imgs)
search = kb.stack_search(stack, psf)
results = search.region_search(*velocity_guess, radius, min_lh, min_obs)

Short Demonstration

Processing Real Images


API Reference.


The software is open source and available under the BSD license.