Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 97531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:01:21+00:00 2026-05-11T00:01:21+00:00

I have a 2D area with dots distributed on this area. I now am

  • 0

I have a 2D area with ‘dots’ distributed on this area. I now am trying to detect ‘clusters’ of dots, that is, areas with a certain high density of dots.

Any thoughts on (or links to articles with thoughts on) how to elegantly detect these areas?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T00:01:22+00:00Added an answer on May 11, 2026 at 12:01 am

    How about defining an arbitrary resolution for your space, and calculate for each point in that matrix, a measure of the distance from that point to all dots, then you could make a ‘heat graph’ and use a threshold to define the clusters.

    It’s a nice exercise for processing, maybe later I will post a solution.

    EDIT:

    Here it is:

    //load the image PImage sample; sample = loadImage('test.png'); size(sample.width, sample.height); image(sample, 0, 0); int[][] heat = new int[width][height];  //parameters int resolution = 5; //distance between points in the gridq int distance = 8; //distance at wich two points are considered near float threshold = 0.5; int level = 240; //leven to detect the dots int sensitivity = 1; //how much does each dot matters  //calculate the 'heat' on each point of the grid color black = color(0,0,0); loadPixels(); for(int a=0; a<width; a+=resolution){   for(int b=0; b<height; b+=resolution){     for(int x=0; x<width; x++){       for(int y=0; y<height; y++){         color c = sample.pixels[y*sample.width+x];                 /**          * the heat should be a function of the brightness and the distance,           * but this works (tm)          */         if(brightness(c)<level && dist(x,y,a,b)<distance){           heat[a][b] += sensitivity;         }       }     }   } }  //render the output for(int a=0; a<width; ++a){   for(int b=0; b<height; ++b){     pixels[b*sample.width+a] = color(heat[a][b],0,0);   } } updatePixels(); filter(THRESHOLD,threshold); 

    EDIT 2 (slighly less inefficient code but same output):

    //load the image PImage sample; sample = loadImage('test.png'); size(sample.width, sample.height); image(sample, 0, 0); int[][] heat = new int[width][height]; int dotQ = 0; int[][] dots = new int[width*height][2]; int X = 0; int Y = 1;   //parameters int resolution = 1; //distance between points in the grid int distance = 20; //distance at wich two points are considered near float threshold = 0.6; int level = 240; //minimum brightness to detect the dots int sensitivity = 1; //how much does each dot matters  //detect all dots in the sample loadPixels(); for(int x=0; x<width; x++){  for(int y=0; y<height; y++){    color c = pixels[y*sample.width+x];    if(brightness(c)<level) {        dots[dotQ][X] += x;        dots[dotQ++][Y] += y;    }  } }  //calculate heat for(int x=0; x<width; x+=resolution){  for(int y=0; y<height; y+=resolution){    for(int d=0; d<dotQ; d++){      if(dist(x,y,dots[d][X],dots[d][Y]) < distance)        heat[x][y]+=sensitivity;    }  } }  //render the output for(int a=0; a<width; ++a){  for(int b=0; b<height; ++b){    pixels[b*sample.width+a] = color(heat[a][b],0,0);  } } updatePixels(); filter(THRESHOLD,threshold);  /** This smooths the ouput with low resolutions * for(int i=0; i<10; ++i) filter(DILATE); * for(int i=0; i<3; ++i) filter(BLUR); * filter(THRESHOLD); */ 

    And the output with (a reduced) Kent sample:

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a development area that I deleted files from a certain folder/directory,
In my application I have an area in the main window that at any
I need something like this: http://hitconsultants.com/dragscroll_scrollsync/scrollpane.html I have an area that should be dragscrollable
I have an Area called Admin. The folder structure in Visual Studio is this:
I have text area and and down to that ok and cancel button. when
I have an area that is identified by a #id and there is a
I have area and in that area I have Home/Index that contains Authorize attribute.
I have an area on a site that I am working on that will
I have an Area named 'Subscribers' and a controller in that area named 'SubscriptionsController'
I have an area on a page that uses with overflow. In side that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.