Hi,
I’m aware that I have the option to set “Don’t Care” regions/pixels for Minos instances. I was wondering how to do that programmatically?
Hi,
I’m aware that I have the option to set “Don’t Care” regions/pixels for Minos instances. I was wondering how to do that programmatically?
Hi,
For the Don’t Care mask, CVB uses an overlay image. First one has to create an overlay image by using CreateOverlayImage() and thus enabling the image to carry an overlay. In an overlay-enabled image, the lower-most valued bit of the image data is reserved for overlays. In Minos, this bit is used to define Don’t Care regions/pixels; If the bit is set to 1 it is a Don’t Care pixel, if the bit is 0 it is no Don’t Care, it’s like a binary mask.
The method CreateOverlayImage() sets all bits for the whole image to 0 automatically when first used and one only has to flip the bits for the desired Don’t Care points.
Overlay-enabled images will be displayed with colored Don’t Care points automatically if displayed with a CVB Display.
I hope this helps.
To elaborate further: It is possible, but not always necessary to descend all the way down to the level of bit manipulation for setting the “don’t care” regions. There are basically three options:
DrawLineInImage
, DrawCircleInImage
, FillCircleInImage
, DrawAreaInImage
, FillAreaInImage
, DrawEllipseInImage
and FloodFillBitwise
.TDrawMode
that defines how the functions’ intensity parameter is to be applied to the image’s pixels. For an image with 8 bits per pixel using TDrawMode::DM_AND
together with an intensity of 0xfe = 254
the lowest bit will be erased when painting, effectively removing the don’t care point. TDrawMode::OR
together with an intensity of 0x01 = 1
on the other hand will set the don’t care points.Image
property is an overlay-capable image as pointed out by @Frank and the LeftButtonMode
property of the display control has been set to LB_DRAWPOINT
, LB_DRAWFILL
, LB_DRAWLINE
or LB_DRAWRECT
then the user can directly modify the don’t care pixels by painting inside the display (hold left mouse button down and move the mouse). The control’s DrawErase
property specifies whether the pixels are to be set (DrawErase == FALSE
) or if they are to be erased (DrawErase == TRUE
).GetImageVPA
(CVCImg.dll) or GetLinearAccess
(CVCUtilities.dll). Code that does this would like similar to this: unsigned char *base = 0;
PVPAT vpa = 0;
GetImageVPA(img, 0, reinterpret_cast<void**>(&base), &vpa);
// loops over all lines and columns...
for (y = 0 ; y < height ; ++y)
{
unsigned char* line = base + vpa[y].YEntry;
for (x = 0 ; x < width ; ++x)
{
unsigned char* pPix = reinterpret_cast<unsigned char*>(line + vpa[x].XEntry);
// now you can either...
*pPix = *pPix | 1; // set lowest bit
// ... or
*pPix = *pPix & 0xfe; // unset lowest bit
}
}
Thank you for the extensive explanation!