IC Imaging Control C++

OverlayBitmap::setColorMode Method

OverlayBitmap::setColorMode Method

Set the color mode of this OverlayBitmap. The color mode determines, whether the overlay bitmap is painted in color or grayscale. The images provided by the video capture device are converted into the selected format before drawing the overlay.
bool setColorMode( tOVBColorMode newMode );
Parameter Description

Specifies the new color mode. Possible values are members of OverlayBitmap::tOVBColorMode:

Value Description
eCOLOR Forces the overlay bitmap to operate in color mode. If the source frame type (video format or output of a filter) is a grayscale format, the images are converted into a colored format (e.g. RGB24), so that colored texts and lines can be drawn on image data.
eGRAYSCALE Forces the overlay bitmap to operate in grayscale mode. If the source frame type (video format or output of a filter) is a color format, the images are converted into a grayscale format (e.g. Y800). If colored lines or texts are drawn onto the overlay bitmap, their color will be converted to the nearest matching color of the gray image.
eBESTFIT This mode lets the overlay bitmap accept colored and grayscale images. It will select the mode at which preferably no color format conversions are necessary. Call OverlayBitmap::getColorformat to find out which format was actually chosen after live mode has been prepared or started. When drawing lines or texts onto the overlay bitmap, the drawing color is converted to its nearest equivalent in the actually used format.
Return value:
Value Description
true The color mode was set successfully.
false The color mode could not be set.

The color mode can only be changed, if the Grabber which owns this OverlayBitmap is not in live or prepared mode.


Introduced in version 3.0


The following example shows how to enable the overlay bitmap for the display path and force it to color mode:

// Check whether the OverlayBitmap object can be inserted in front of the
// display.
if( !m_Grabber.setOverlayBitmapPathPosition(ePP_DISPLAY) )
    MessageBox( m_Grabber.getLastError().toStringW().c_str(),L"Error",MB_ICONERROR);
    smart_ptr<DShowLib::OverlayBitmap> pOverlayBitmap;
    pOverlayBitmap = m_Grabber.getOverlay(ePP_DISPLAY);
    // Set the color mode to grayscale.
    pOverlayBitmap->setColorMode( OverlayBitmap::eCOLOR );

After this initialization, colored drawings can be placed onto the live display. The original, grayscale image data is sent to the sink in its original form.

See also: OverlayBitmap, OverlayBitmap::getColorMode, OverlayBitmap::tOVBColorMode, OverlayBitmap::getColorformat

<< OverlayBitmap

Get in touch with us

About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

Automated Imaging Association ISO 9001:2015 certified

Contact us