本文整理汇总了C++中GrayImage::invert方法的典型用法代码示例。如果您正苦于以下问题:C++ GrayImage::invert方法的具体用法?C++ GrayImage::invert怎么用?C++ GrayImage::invert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrayImage
的用法示例。
在下文中一共展示了GrayImage::invert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computePreprocessings
void PreprocessingResults::computePreprocessings(const PreprocessingParameters parameters, ImageChar *pImageChar)
{
this->clear();
// extract glyph from document image:
GrayImage<> *pImage = pImageChar->pImage;
BoundingBox bbox = pImageChar->bBox;
GrayImage<> glyphImage;
#pragma omp critical // critical region, since a pointer to common images is set
{
pImage->setRoi(bbox);
pImage->computeRoiImage(glyphImage);
pImage->releaseRoi();
}
// printf("Hello World from thread %d\n", omp_get_thread_num());
// std::cout << bbox << std::endl;
// 1st: preprocess glyph image:
mpProcessedImage = new GrayImage<>();
PreprocessingResults::preprocessGlyph(parameters, glyphImage, *mpProcessedImage, &isWhiteSpace);
// pImageChar->pPreprImage = mpProcessedImage;
// std::cout << "finished processing image " << i << std::endl;
// std::cout << mProcessedImagesVec[i] << std::endl;
if (isWhiteSpace) { // jump out as this is a whitespace character
return;
}
#if 1
// 2nd: compute integral invariant image:
int radius = 2; bool oddSize = true;
Kernel<> mask;
Kernel<>::createSphereKernel( mask, radius, oddSize );
// std::cout << mask << std::endl;
mpIntInvImage = new GrayImage<float>();
ImageIntegralInvariant::calcIntegralInvariantImage( mask, *mpProcessedImage, *mpIntInvImage );
#endif
#if 1
// 3rd: compute distance transform of inverted(!) glyph:
GrayImage<> invPreprocessedGlyphImage = *mpProcessedImage;
invPreprocessedGlyphImage.invert();
mpDistTransformImage = new GrayImage<float>();
ImageFilter::distTransform(invPreprocessedGlyphImage, *mpDistTransformImage);
#endif
return;
} // end computePreprocessings(ImageChar *pImageChar)
示例2: computeOtherPreprocessings
/*static*/
void PreprocessingResults::computeOtherPreprocessings(
const GrayImage<> &preprocessedImage, GrayImage<float> &intInvImage, GrayImage<float> &distTransformImage)
{
#if 1
// 2nd: compute integral invariant image:
int radius = 2; bool oddSize = true;
Kernel<> mask; Kernel<>::createSphereKernel( mask, radius, oddSize );
// std::cout << mask << std::endl;
ImageIntegralInvariant::calcIntegralInvariantImage( mask, preprocessedImage, intInvImage );
#endif
#if 1
// 3rd: compute distance transform of inverted(!) glyph:
GrayImage<> invPreprocessedGlyphImage = preprocessedImage;
invPreprocessedGlyphImage.invert();
ImageFilter::distTransform(invPreprocessedGlyphImage, distTransformImage);
#endif
return;
}