Article View: borland.public.cppbuilder.multimedia
Article #1008Webcam, Pictures and number of colors
From: Neurone66
Date: Thu, 02 May 2002 17:49
Date: Thu, 02 May 2002 17:49
39 lines
2432 bytes
2432 bytes
Hi everybody,
I'm trying to code a small program that extract an object from a
picture.
For that, I coded somes functions in order to grab pictures from my
webcam (using VFW).
This program works fine BUT the obtained image is a DIB with 16
millions colors.
I need images with only 256 colors.
I tried to use the the macro capSetVideoFormat in order to force my
webcam (Dexxa) to use the following format :
bi.bmiHeader.biWidth = 320;
bi.bmiHeader.biHeight = 240;
bi.bmiHeader.biPlanes = 1; // This value must be set to
1.
bi.bmiHeader.biBitCount = 8; // 256 couleurs
bi.bmiHeader.biCompression = BI_RGB; // No compression
bi.bmiHeader.biSizeImage = 0; // Set to 0 for BI_RGB
bitmaps.
bi.bmiHeader.biXPelsPerMeter = 1;
bi.bmiHeader.biYPelsPerMeter = 1;
bi.bmiHeader.biClrUsed = 0; // All colors are used
bi.bmiHeader.biClrImportant = 0; // All are important
if( capSetVideoFormat(CaptureWindow,&bi,sizeof(BITMAPINFO)) ==
true)
...
but when I run the preview, I got the error 418 : Unknown format => I
guess the driver of my webcam is not able to handle a such format.
===> If you have an idea... (thanks)
OK, don't matter, I have a picture (not exactly what I want but, for
the moment ... :o) ). Now, because I really need 256 colors, I would
like to know how to decrease the number of colors of the bitmap in
order to "build" a palette. I need this palette to build an histogram
that will be used in the extraction.
Is there somebody who know how to do ?
Thanks a lot for your support.
Neurone66
Technical Details
Message-ID:
<b6ea4828.0205020949.285884a5@posting.google.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d0fc,10c0608455ae6542,start X-Google-Attributes: gid10d0fc,public X-Google-ArrivalTime: 2002-05-02 10:49:22 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail From: neurone66@yahoo.fr (Neurone66) Newsgroups: borland.public.cppbuilder.multimedia Subject: Webcam, Pictures and number of colors Date: 2 May 2002 10:49:21 -0700 Organization: http://groups.google.com/ Lines: 39 Message-ID: <b6ea4828.0205020949.285884a5@posting.google.com> NNTP-Posting-Host: 80.9.140.112 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1020361762 19361 127.0.0.1 (2 May 2002 17:49:22 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 2 May 2002 17:49:22 GMT