本文整理汇总了C++中DImage::drawRect方法的典型用法代码示例。如果您正苦于以下问题:C++ DImage::drawRect方法的具体用法?C++ DImage::drawRect怎么用?C++ DImage::drawRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DImage
的用法示例。
在下文中一共展示了DImage::drawRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTextlineRects
//.........这里部分代码省略.........
pxlThresh = sumPxls/10;
printf(" pixel threshold=%ld\n",pxlThresh);
//now get rid of lines with few pixels
for(int p=(*numTextlines)-1; p >=0; --p){
if(rgNumPixels[p] < pxlThresh){// one-twentieth of weighted avg
printf(" remove textline %d (y=%d to y=%d) with %ld pixels\n",p,
(*rgTextlineRects)[p].y,(*rgTextlineRects)[p].y+
(*rgTextlineRects)[p].h, rgNumPixels[p]);
for(int r=p; r < ((*numTextlines)-1); ++r){
(*rgTextlineRects)[r] = (*rgTextlineRects)[r+1];
}
--(*numTextlines);
}
}
free(rgNumPixels);
}
printf(" There are now %d textlines\n", (*numTextlines));
//debug: save an image with the textline rectangles drawn
{
DImage imgTextlines;
imgTextlines = img.convertedImgType(DImage::DImage_RGB);
for(int p = 0; p < (*numTextlines); ++p){
int colorR, colorG, colorB;
printf("\trect%d: x,y wxh=%d,%d %dx%d\n",p,(*rgTextlineRects)[p].x,
(*rgTextlineRects)[p].y,
(*rgTextlineRects)[p].w,(*rgTextlineRects)[p].h);
colorR = ((p+1)*127) % 255;
colorG = (p*127) % 255;
colorB = (p) % 255;
imgTextlines.drawRect((*rgTextlineRects)[p].x,(*rgTextlineRects)[p].y,
(*rgTextlineRects)[p].x+(*rgTextlineRects)[p].w-1,
(*rgTextlineRects)[p].y+(*rgTextlineRects)[p].h,
colorR, colorG, colorB);
imgTextlines.drawRect((*rgTextlineRects)[p].x+1,(*rgTextlineRects)[p].y+1,
(*rgTextlineRects)[p].x+(*rgTextlineRects)[p].w-1-1,
(*rgTextlineRects)[p].y+(*rgTextlineRects)[p].h-1,
colorR, colorG, colorB);
imgTextlines.drawRect((*rgTextlineRects)[p].x+2,(*rgTextlineRects)[p].y+2,
(*rgTextlineRects)[p].x+(*rgTextlineRects)[p].w-1-2,
(*rgTextlineRects)[p].y+(*rgTextlineRects)[p].h-2,
colorR, colorG, colorB);
}
sprintf(stTmp,"%s_tl_rects.pgm",stDebugBaseName);
imgTextlines.save(stTmp);
}
// // now get x-height estimate using profiles (or black runlengths of smears)
// #if 0
// //debug: save an image with all of the profiles
// {
// DImage imgProfsAll;
// imgProfsAll = prof.toDImage(500,true);
// imgProfsAll = imgProfsAll.convertedImgType(DImage::DImage_RGB);
// sprintf(stTmp,"%s_allprofs.pgm",stDebugBaseName);
// imgProfsAll.save(stTmp);