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
  • 0 Views
  • 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

I have a program that will calculate the minimal area taken by fitting rectangles
We have one large xslt that renders a whole shop area including products, manifacturers
So I have an area on my page that I would like to update
I have form area in my view. If I click button A , I
I have a text area and a function to do syntax highlighting on it.
I have a page which has a rectangular area with text and icons in
I have a web page x.php (in a password protected area of my web
I have a multi-user eclipse (3.4) installation with a shared master configuration area. Users
In my XUL I have the following code fragments: <map name=KeypadMap> <area href=javascript:pad('A') coords=1,1,31,31
Header, footer and sidebars have fixed position. In the center a content area with

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.