当前位置: 首页>>代码示例>>C++>>正文


C++ GrayImage::invert方法代码示例

本文整理汇总了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)
开发者ID:hashimmoosavi,项目名称:inventory-extraction,代码行数:49,代码来源:PreprocessingResults.cpp

示例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;
}
开发者ID:hashimmoosavi,项目名称:inventory-extraction,代码行数:20,代码来源:PreprocessingResults.cpp


注:本文中的GrayImage::invert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。