![]() |
| | #1 |
| Registered User Join Date: Aug 2007
Posts: 268
| Hey I am looking for a quick way to count objects in a binary image (object = 1, background = 0). I have tried Connected Component Labeling and it works for square shapes but the rounded shapes it has a problems. Could someone have a look at the code and let me know where am wrong. Attached is what I have done for the connected component labeling. Last edited by taurus; 09-18-2009 at 04:56 AM. |
| taurus is offline | |
| | #2 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,929
| Are you just just counting bits or do you need to do image analysis of a binary image to find the number of geometric shapes?
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet |
| abachler is offline | |
| | #3 |
| Crazy Fool Join Date: Jan 2003 Location: Canada
Posts: 2,588
| It sounds like your just trying to find connected components. Think of it this way: You have a graph, each cell of your image with a 1 is a node, two nodes are connected if they are adjacent to each other. Now you can just use any old connected component algorithm. If you are trying to find components based on pixel intensity (ie., not just 0's and 1's) things get a little trickier.
__________________ jeff.bagu.org - Terrain rendering and other random stuff |
| Perspective is offline | |
| | #4 |
| Super Moderator Join Date: Aug 2001
Posts: 7,472
| Wouldn't you want to perform some type of Laplace or Sobel edge filter on it first before doing a connected component algo?
__________________ If you aim at everything you will hit something but you won't know what it is. |
| Bubba is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| using this as synchronization object | George2 | C# Programming | 0 | 03-22-2008 07:49 AM |
| circular doubly linked list help | gunnerz | C++ Programming | 5 | 04-28-2007 08:38 PM |
| I believe I've found an official Answer to my Problem (Object Factories) | Shamino | Game Programming | 60 | 12-20-2005 11:36 PM |
| Question on l-values. | Hulag | C++ Programming | 6 | 10-13-2005 04:33 PM |
| A question about constructors... | Wolve | C++ Programming | 9 | 05-04-2005 04:24 PM |