Inconsistent DM Stack Kernel-Based Hough Transform (KHT) Results

I am studying images of a projected satellite streak on LSST Camera CCDs (data taken at UC Davis) and am exploring using the Hough transform to automatically detect the location of the streaks in the images.

However, I have found that the results obtained by using the DM stack implementation are inconsistent with the implementation using Scikit-Image tools.

import lsst.kht
from skimage import feature

edge_image = feature.canny(image, sigma=10, low_threshold=1, high_threshold=25)
lines = lsst.kht.find_lines(edge_image, 10, 2, 0.5, 0.002, 2, 10)

This gives two lines, both with angles of 18.5 degrees, reported only to tenths, compared to:

from skimage import feature
from skimage.transform import hough_line, hough_line_peaks
import numpy as np

tested_angles = np.linspace(-np.pi / 2, np.pi / 2, 360)
edges = feature.canny(image, sigma=10, low_threshold=1, high_threshold=25)

h, theta, d = hough_line(edges, theta=tested_angles)
_, angle, dist = hough_line_peaks(h, theta, d)

Which also gives two lines but with angles of 18.80222841225625 degrees with seeming full precision.

Over-plotting the results of both methods, it is clear to see that the 18.5 degree results obtained from the first method is incorrect. Is there perhaps some internal rounding being performed in the DM stack implementation; I find it rather suspicious that the angle results from the DM stack KHT are perfectly to the half degree.

1 Like

Very interesting. Will you post the image somewhere (whatever you have in your variable image, so that I can package this up as a how-to-reproduce and file a ticket?

satellite_streak.fits (3.9 MB)

The image itself was the output of some pre-processing, so I have output the array as a FITS file (attached here); then recreating the above results should be possible using

hdul = fits.open('satellite_streak.fits')
image = hdul[0].data

I tested this and verified that the issue still remained. I did not include the plotting code, as the discrepancy is clear simply by printing the output of the Hough Transform results in each case.

The Kernel Hough Transform finds lines in bins of angle and distance from the center of the image. The delta parameter determines the bin size in lsst.kht.find_lines. In the example above, delta is 0.5, which is why the result is only accurate to 0.5.

1 Like

Perfect, I had only run the DM stack KHT using default values, whereas the example code of the Scikit-image Hough Transform used a much finer step size in angles. I decreased the delta parameter and verified this improves the accuracy of the DM stack KHT results.