Thread: Object counting

  1. #1
    Registered User
    Join Date
    Aug 2007

    Question Object counting



    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.

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    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?

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    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.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Wouldn't you want to perform some type of Laplace or Sobel edge filter on it first before doing a connected component algo?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. using this as synchronization object
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 03-22-2008, 07:49 AM
  2. circular doubly linked list help
    By gunnerz in forum C++ Programming
    Replies: 5
    Last Post: 04-28-2007, 08:38 PM
  3. Replies: 60
    Last Post: 12-20-2005, 11:36 PM
  4. Question on l-values.
    By Hulag in forum C++ Programming
    Replies: 6
    Last Post: 10-13-2005, 04:33 PM
  5. A question about constructors...
    By Wolve in forum C++ Programming
    Replies: 9
    Last Post: 05-04-2005, 04:24 PM