×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

New All Sky camera management software: indi-allsky

  • Posts: 257
  • Thank you received: 66
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.
2 years 5 months ago #77416

Please Log in or Create an account to join the conversation.

Aaron, I was just reading about OpenCV method a couple of days ago. Can you share more details? how much faster was it compared to SEP I suppose? but SEP alone is not enough, you need to perform some star matching using triangles/quads..etc (not just based on number).
2 years 5 months ago #77417

Please Log in or Create an account to join the conversation.

  • Posts: 257
  • Thank you received: 66
At the moment, I am just counting the instances of an image of a single star in the picture.  I am not using it for SEP or plate solving, but it would not be too difficult to do that.

From reading the documentation, it seems to be best described as finding instances of a picture within another picture.  You can use this for complex pattern matching, but stars are very simple objects.  In most of the examples I looked at, they included an example image of a star.  In my case, instead of using a real star image, I just generate a fake star image using cv2 by drawing a white circle and applying a blur() function to it--a perfect star every time.

As for the speed, it is one of the faster methods I have used.  It can find all of the stars in a 1920x1080 image covering 120 degress of the sky in about a second.  The only problem is that it generates a lot of duplicate findings, finding the same star multiple times.  Eliminating the duplicates slows things down a lot, but still *at least* 2-3 times faster than scikit-image blob_dog() for similar results.  It is not perfect, but it is good enough for my purposes. 

Here is an example.  I only look for patterns in the central box of the image.  This is to stay away from the trees.  The gaps in the leaves look like stars to the pattern matching.
1035 "stars" were detected in 0.5 seconds on a Raspberry PI 3.  The brighter the red circle, the more times it was duplicated.
Eliminating the duplicates brings the star count to 198 which adds another 2 seconds to processing.
 
The following user(s) said Thank You: Jasem Mutlaq
2 years 5 months ago #77419
Attachments:

Please Log in or Create an account to join the conversation.

That looks great! It would be nice to compare it against SEP (after crop) and see the differences. Of course, SEP gives back much more data on each star as well.
2 years 5 months ago #77425

Please Log in or Create an account to join the conversation.

  • Posts: 10
  • Thank you received: 1
What lens are you using on the SVBony camera?
2 years 5 months ago #77438

Please Log in or Create an account to join the conversation.

  • Posts: 257
  • Thank you received: 66
I am just using a ZWO 2.1 or 2.5mm CS mount lens that came with one of my other cameras I use for autoguiding.
2 years 5 months ago #77439

Please Log in or Create an account to join the conversation.

  • Posts: 257
  • Thank you received: 66
I have a test script for each method and some example images to torture them.

I will post each set of test images for cv2 matchTemplate() and scikit blob_dog().  There is quite a bit of tuning that can be done to each method that can affect the results.  You can increase sensitivity in one case but increase the false positive rate in another.  The settings I have found seem to work well across each type of image I have.

cv2 settings:
stars = cv2.matchTemplate(image, star_template, cv2.TM_CCOEFF_NORMED)
stars_filtered = numpy.where(result >= 0.55)

scikit settings:
stars = blob_dog(image, max_sigma=5, min_sigma=1, threshold=.1, overlap=0.1)
2 years 5 months ago #77462

Please Log in or Create an account to join the conversation.

  • Posts: 257
  • Thank you received: 66
Image:  Clear, no clouds

cv2 matchTemplate
INFO:root:SEP processing in 0.3813 s
INFO:root:Deduplication in 1.0220 s
INFO:root:Total in 1.4033 s
INFO:root:Found 297 objects
 

scikit blob_dog
INFO:root:SEP processing in 5.0061 s
INFO:root:Found 78 objects
 
The following user(s) said Thank You: Jasem Mutlaq
2 years 5 months ago #77463
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 257
  • Thank you received: 66
Image: Transparent clouds

cv2 matchTemplate
INFO:root:SEP processing in 0.3807 s
INFO:root:Deduplication in 0.0089 s
INFO:root:Total in 0.3896 s
INFO:root:Found 27 objects
 


scikit blob_dog
INFO:root:SEP processing in 4.9986 s
INFO:root:Found 4 objects
 
2 years 5 months ago #77464
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 257
  • Thank you received: 66
Image:  Full clouds (no stars)

cv2 matchTemplate
INFO:root:SEP processing in 0.3782 s
INFO:root:Deduplication in 0.0001 s
INFO:root:Total in 0.3783 s
INFO:root:Found 0 objects
 

scikit blob_dog
INFO:root:SEP processing in 5.0570 s
INFO:root:Found 0 objects
 
The following user(s) said Thank You: Jasem Mutlaq
2 years 5 months ago #77467
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 257
  • Thank you received: 66
I also tried to use the python sep module, but ultimately, it would not accept any data from INDI.  INDI [mostly] produces 16-bit unsigned integer FITS data, where sep seemed to want 32-bit floating point FITS data.  I may have the types slightly wrong, but I never could get sep to accept FITS data from INDI.
2 years 5 months ago #77468

Please Log in or Create an account to join the conversation.

Great job Aaron! This method certainly provides an acceptable alternative to SEP for such applications! I gotta get running in my observatory!
2 years 5 months ago #77471

Please Log in or Create an account to join the conversation.

Time to create page: 1.077 seconds