🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.multimedia
1 messages
1 total messages Started by Neurone66 Thu, 02 May 2002 17:49
Webcam, Pictures and number of colors
#1008
Author: Neurone66
Date: Thu, 02 May 2002 17:49
39 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads