From: charles on
Hi

Is there a way that I can quickly count the number of unique colors in
a bitmap using VB6? I have found some examples on the web which seem
to work fine but they are all quite slow, taking about two seconds to
count the number of unique colors in a 1600 x 1200 pixel bmp. Can it
be done any faster than this?

Charles

From: Mike Williams on
"charles" <cbabbage59(a)yahoo.com> wrote in message
news:273aa1c5-fb8a-47c5-b1ee-8fd191777a1b(a)u7g2000yqm.googlegroups.com...

> Hi. Is there a way that I can quickly count the
> number of unique colors in a bitmap using VB6?

Yes.

> I have found some examples on the web which seem
> to work fine but they are all quite slow, taking about
> two seconds to count the number of unique colors in
> a 1600 x 1200 pixel bmp. Can it be done any faster
> than this?

Yes.

Mike

NOTICE: This response has been deliberately kept short in order to comply
with the Posting Restrictions [Maximum Content] Order (2010) recently issued
by Larry Serflaten, the newly self appointed group moderator. We apologise
for any inconvenience which may be caused whilst Larry is attempting to
establish his new regime and to fill the vacuum left by the departure of the
Micro$oft puppeteers. Normal service will be resumed as soon as possible. In
the meantime if you should require a more detailed answer to this or to any
other question then you may contact the newly self appointed moderator
directly at serflaten(a)gmail.com



From: Dee Earley on
On 07/07/2010 11:03, charles wrote:
> Hi
>
> Is there a way that I can quickly count the number of unique colors in
> a bitmap using VB6? I have found some examples on the web which seem
> to work fine but they are all quite slow, taking about two seconds to
> count the number of unique colors in a 1600 x 1200 pixel bmp. Can it
> be done any faster than this?

Whetever method you use will need to go through all the pixels and look.
It will be faster if you run through the DIB data rather than many
GetPixel calls, but it will depend on your code.

--
Dee Earley (dee.earley(a)icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
From: Larry Serflaten on

"charles" <cbabbage59(a)yahoo.com> wrote
> Is there a way that I can quickly count the number of unique colors in
> a bitmap using VB6? I have found some examples on the web which seem
> to work fine but they are all quite slow, taking about two seconds to
> count the number of unique colors in a 1600 x 1200 pixel bmp. Can it
> be done any faster than this?

Did your examples access the image data from an array?

Did you see this?
http://www.vbaccelerator.com/codelib/gfx/dibsect.htm

LFS


From: charles on
On 7 July, 14:35, "Larry Serflaten" <serfla...(a)gmail.com> wrote:

> Did your examples access the image data from an array?
> Did you see this?http://www.vbaccelerator.com/codelib/gfx/dibsect.htm

Yes, and I also saw the following vbaccelerator code which uses a
cDibSection Class to count the colors.

http://www.vbaccelerator.com/home/vb/code/vbmedia/image_processing/Counting_Colours/Count_Colours_Sample.asp

The problem is that it is quite slow, taking about two seconds for my
sample 1600 x 1200 pixel .bmp file. It runs a bit faster on my other
machine, about one and a half seconds, but it returns a completely
different answer for exactly the same .bmp file! Is there a faster and
more reliable way?

Charles