本文整理汇总了C++中TImage::SetZero方法的典型用法代码示例。如果您正苦于以下问题:C++ TImage::SetZero方法的具体用法?C++ TImage::SetZero怎么用?C++ TImage::SetZero使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TImage
的用法示例。
在下文中一共展示了TImage::SetZero方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rgb
bool TTransRemain::RemainCapsule ( const TAlloc<PixelMem> &rawImg,
const TImgDim &rawImgDim,
TImage<PelGray8> &remain,
RemainParam &remainParam,
REMAINMODE remainMode,
bool frontLight)
{
m_mode = remainMode;
if(rawImgDim.bytesPerPixel == 3)
{
TImage<PelRGB24> rgb(rawImg, rawImgDim);
if(frontLight) { TImgProcess::RGBToGray (rgb, m_rawImage); }
else { TImgProcess::RGBToGray2(rgb, m_rawImage); }
}
else
{
m_rawImage.SetImage(rawImg.Base(), rawImgDim);
}
remain.SetZero();
try
{
TImgProcess::BinaryGray(m_rawImage, m_binImage, remainParam.binaryLowThres, remainParam.binaryUpThres);
// m_sortObserver.ObserverIMG(SortObserver::MAll, m_cvbProfileImg);
IMG minImage = NULL;
FilterBoxMin( m_binIMG,
remainParam.minBoxWidth,
remainParam.minBoxWidth,
remainParam.minBoxWidth/2,
remainParam.minBoxWidth/2,
minImage);
unsigned char *pImage = NULL;
PVPAT VPA = NULL;
GetImageVPA ( minImage, 0, (void**)&pImage, &VPA);
memcpy ( m_minBoxImage.Base(), pImage, m_minBoxImage.Width()*m_minBoxImage.Height());
ReleaseImage( minImage);
TImgProcess::SobelFilter( m_rawImage, m_sobelImage);
CapsuleProc::ObservedIMG(SortObserver::MEnh, m_sobelIMG);
TImgProcess::AndGrayImg ( m_minBoxImage, m_sobelImage, m_andedImage);
CapsuleProc::ObservedIMG(SortObserver::MAnd, m_andedIMG);
}
catch (...)
{
static int count = 0;
CString txt;
txt.Format("D:\\\n%d.txt", count);
count++;
FILE* pFile = NULL;
fopen_s(&pFile, "D:\\CatchFile.txt", "wb");
fwrite(txt, sizeof(char), strlen(txt), pFile);
fclose(pFile);
return false;
}
try
{
WhiteBlob ( m_binIMG, m_whiteBlob);
vector<RECT> rectSet = GetMouldRect(m_whiteBlob);
ExcludeEmpty ( rectSet, remain.Height(), remain.Width());
CheckPosition ( m_andedImage, remain, rectSet, remainParam.radius);
TImgProcess::AndGrayImg(m_rawImage, remain, remain);
}
catch (...)
{
static int count = 0;
CString txt;
txt.Format("D:\\\n%d.txt", count);
count++;
FILE* pFile = NULL;
fopen_s(&pFile, "D:\\CatchFile1.txt", "wb");
fwrite(txt, sizeof(char), strlen(txt), pFile);
fclose(pFile);
return false;
}
return true;
}