About connected-components

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
adil@alfasoft.ro
Posts: 24
Joined: 2012-01-10T05:19:23-07:00
Authentication code: 8675308

About connected-components

Post by adil@alfasoft.ro »

Can someone explain me why I get "convert.exe: too many objects" and how can be handle it this error.
It seems that does not matter the value of " -define connected-components:area-threshold ".
By the way, this value represent the minimum number of pixels of rectangle ( width x height ) or what?
I do not found many information about that.

Here is the image. https://www.dropbox.com/s/02erfct6buplxtc/ll.jpg?dl=0

Thank you.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: About connected-components

Post by magick »

Type 'convert -version'. Does it return Q8? If so, you are limited to 256 unique objects. With the Q16 version of ImageMagick you are limited to 65536 unique objects. We have the Q16 version and connected component labeling completed without complaint, it contains 46570 unique objects.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: About connected-components

Post by fmw42 »

It is always best to provide your IM version and platform when asking questions on this forum. It saves a lot of back and forth questions. See viewtopic.php?f=1&t=9620. It is the very top listed post on the User's page.
adil@alfasoft.ro
Posts: 24
Joined: 2012-01-10T05:19:23-07:00
Authentication code: 8675308

Re: About connected-components

Post by adil@alfasoft.ro »

Thank you very much.
Yes, Magic has right, I use 6.9.0.1 Windows Q8.
I don't understand why Q8 use only 256 and Q16 65K (except a simple 1 byte or 2 bytes representation). For most images Q8 is enough, but the limitation at only 256 connected components is too low.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: About connected-components

Post by magick »

Connected components labels are stored as an index in the image colormap index. Q8 is limited to 256 colors (1-byte) where Q16 is limited to 65536 colors (2-bytes).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: About connected-components

Post by fmw42 »

All channels of Q8 compile IM are limited to 8-bits per channel. In Q16 compile of IM all channels are limited to 16-bits per channel when the image is written. Thus Q8 can only store 256 values in any channel, whereas Q16 can store 65535 values per channel.
Post Reply