Object counting

This is a discussion on Object counting within the General AI Programming forums, part of the Cprogramming.com and AIHorizon.com's Artificial Intelligence Boards category; EDITED: Hey I am looking for a quick way to count objects in a binary image (object = 1, background ...

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    270

    Question Object counting

    EDITED:

    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.
    Attached Files Attached Files
    Last edited by taurus; 09-18-2009 at 04:56 AM.

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    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?
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    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
    Posts
    9,596
    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, 10: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21