I have integrated some star detection code. I initially used your example, but it was slower than I really wanted. It worked very well, but it was just slow-ish and processor intensive.
I found another method using OpenCV template matching that is much faster and more sensitive.