C Board  

Go Back   C Board > Cprogramming.com and AIHorizon.com's Artificial Intelligence Boards > General AI Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 09-18-2009, 04:20 AM   #1
Registered User
 
Join Date: Aug 2007
Posts: 268
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
File Type: c process.c (5.3 KB, 32 views)

Last edited by taurus; 09-18-2009 at 04:56 AM.
taurus is offline   Reply With Quote
Old 09-18-2009, 11:34 AM   #2
Rampaging 35 Stone Welsh
 
abachler's Avatar
 
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   Reply With Quote
Old 09-19-2009, 12:48 PM   #3
Crazy Fool
 
Perspective's Avatar
 
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.
Perspective is offline   Reply With Quote
Old 09-19-2009, 09:14 PM   #4
Super Moderator
 
Bubba's Avatar
 
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   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 02:06 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

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