1

Sorry if this question might sound like another I'm too lazy to google one, but I couldn't find what I'm looking for.

This question is for avoiding to reinvent the wheel. I think that what I'm looking for might exist, so I dont want to start out implementing it on my own:

I want to turn a heat map into a list of discrete points. I'm sure that an algorithm can be used which first thresholds the heatmap and then, for every "island" which was created by the thresholding, finds the gravitational center. This center would be a point. I want to get the list of these points:

Step 0:

Step 1:

Step 2:

I wonder if such an algorithm already exists, or if there is a better approach to this than my idea. Moreover, it would be perfect if there is a ready to use implementation, of course. E.g. computer vision libraries like OpenCV have the thresholding included. I just couldn't find the next step.

My target platform is iOS, so for implementations, Objective-C, C or C++ is preferred.

Daniel S.
  • 6,458
  • 4
  • 35
  • 78

3 Answers3

3

You could do

Haris
  • 13,645
  • 12
  • 90
  • 121
3

There are a lot of ways to reach what you are looking for. This is one of them:

By applying cv::threshold(); you should get something like this:

enter image description here

Now it's time for cv::distanceTransform();and cv::normalize();

enter image description here

You can see it better by appling cv::applyColorMap();

enter image description here

Next step, cv::connectedComponents(); to make sure there won't be anything connected:

enter image description here

And finally cv::approxPolyDP(); and cv::minEnclosingCircle(); to find centers:

enter image description here

I hope this was helpful!

Keep up the good work and have fun :)

AndersonBS
  • 158
  • 2
  • 11
0

You can look at my post for the question whose link is mentioned below. Basically, after thresholding you can get some circles or elipses. Then you can fit a gaussian mixture model on them to estimate the exact centers. There are many existing libraries to fit GMMs

Robust tracking of blobs

Community
  • 1
  • 1
Bharat
  • 2,139
  • 2
  • 16
  • 35