|
-
Jan 27th, 2017, 06:04 PM
#1
Count shapes in image
I have an image which has a number of shapes, all are the same color and on a white background. Is there a quick way of counting how many shapes there are?
I don't want to know what shape they actually are (polygon, circle or whatever), I just want to know how many isolated shapes are present. Other than some kind of brute force method, I can't find any other way of doing this.
-
Jan 28th, 2017, 01:43 AM
#2
Re: Count shapes in image
Use a paint-bucket fill algorithm -- there's plenty to find on the web. Scan the image for the first coloured pixel you find, do a paint fill to get all the connected pixels, add 1 to your shape count and delete those pixels. Repeat until there are no coloured pixels left. Or does this count as brute force?
BB
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|